tur/core

stdlib/core.tur
defn

constant

(constant [val])

create a signal that always returns the same value.

valthe constant value to emit at every time point
A function Time -> a that ignores time and returns val.

  ((constant 0.5) 2.0)  ; => 0.5
defn

time-signal

(time-signal [t])

a signal that returns the current time at each sample.

Signal<Time> whose value equals the query time t.

  (time-signal 2.0)  ; => 2.0
defn

sample

(sample [sig t])

evaluate a signal at a specific time point.

sigthe Signal to query
tthe time point at which to sample
The signal value of type a at time t.

  (sample (constant 3.0) 0.0)  ; => 3.0
defn

map-signal

(map-signal [f sig])

lift a pure function to operate on signals pointwise.

ffunction from a to b
siginput signal of type Signal<a>
Signal<b> where each sample is f applied to the corresponding input sample.

  (map-signal (fn [x] (* x 2.0)) my-sig)
defn

pair-signals

(pair-signals [sig-a sig-b])

zip two signals into a product signal.

sig-afirst signal
sig-bsecond signal
A signal whose value at time t is a Pair of both signals' values.

  (pair-signals freq-sig amp-sig)
defn

left-signal

(left-signal [sig-a])

inject a signal into the Left branch.

sig-asignal to inject

A signal whose samples are (sig-a t). Note: Returns the raw signal value since Left/Either are not yet implemented.

defn

right-signal

(right-signal [sig-b])

inject a signal into the Right branch.

sig-bsignal to inject

A signal whose samples are (sig-b t). Note: Returns the raw signal value since Right/Either are not yet implemented.

Internal definitions
__signal_call1-- call a signal (function of time) at time t.