Rizzo.SignalSourceCreates a fresh signal given a head and a tail in the form of a delayed computation. Similar to cons (::) on lists.
Example:
let my_int_signal = 0 @: (filter_map int_of_string_opt console) Creates a constant signal. This signal will never tick, invoking head will always return the same value.
Maps a function over a signal, producing a new signal.
Example:
let doubled_signal = map (fun x -> x * 2) my_int_signalMaps a function over a delayed signal, producing a new delayed signal.
Creates a delayed signal from any delayed computation. The primary use is to instantiate signals from external channels 'a channel or internal channels trig
Example:
let every_second, every_second_stop = Rizzo.Channel.clock_signal 1.0 in
(* counts the number of seconds since application startup *)
let count_second = scan (fun n _ -> n + 1) 0 every_second in ...Shorthand for mkSig (wait c)
Returns the value for the current time tick. Every head call to a signal s will produce the same value until the tail of s ticks.
Creates a signal that acts as the first until the second argument (a delayed computation) produces a signal, at which point the signal now acts as that.
Example:
let every_second, every_second_stop = Rizzo.Channel.clock_signal 1.0 in
(* counts the number of seconds since application startup *)
let count_second = scan (fun n _ -> n + 1) 0 every_second in
let numbers_from_console : int signal later = filter_map int_of_string_opt console in
let switched = switch count_second numbers_from_console in ...Switch will act as count_second until the program receives a valid number through the console. Hereafter, switched will output any number that is read from the console.
val switchR :
'a Types.signal ->
('a -> 'a Types.signal) Types.signal Types.later ->
'a Types.signalval scanD :
('a -> 'b -> 'a) ->
'a ->
'b Types.signal Types.later ->
'a Types.signal Types.laterval filter_map :
('a -> 'b option) ->
'a Types.signal Types.later ->
'b Types.signal Types.laterval triggerD :
('a -> 'b -> 'c) ->
'a Types.signal Types.later ->
'b Types.signal ->
'c Types.signal Types.laterval pp_signal :
(Format.formatter -> 'a -> unit) ->
Format.formatter ->
'a Types.signal ->
unitinit_signal c a = a @: mkSig_of_channel c
Outputs the signal head to stdout on each tick
Outputs the eventual value of later signal to stdout on each tick
Outputs the eventual value of later signal to the given port at address
Quits the program on first tick
Misleading name, just blocks the current thread.