tur/core
stdlib/core.tur
defn
constant
(constant [val])
create a signal that always returns the same value.
Parameters
| val | the constant value to emit at every time point |
Example
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.
Example
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.
Parameters
| sig | the Signal to query | |
| t | the time point at which to sample |
Example
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.
Parameters
| f | function from a to b | |
| sig | input signal of type Signal<a> |
Example
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.
Parameters
| sig-a | first signal | |
| sig-b | second signal |
Example
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.
Parameters
| sig-a | signal to inject |
Returns
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.
Parameters
| sig-b | signal to inject |
Returns
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.