Module Note.E

module E: sig .. end
Events.

An event is a value with discrete occurences over time.



Events


type 'a t = 'a Note.event 
The type for events with occurences of type 'a.
type 'a send = ?step:Note.Step.t -> 'a -> unit 
The type for functions sending event occurences of type 'a. See Note.E.create.
val obs : 'a t -> 'a option Note.Logr.obs
obs e is an observation for e's occurences.
val log : ?now:bool -> 'a Note.event -> ('a -> unit) -> Note.Logr.t option
log ?now e f is Some (Logr.(create ?now (const f $ obs e))) if e is not Note.E.never and None otherwise.
val create : unit -> 'a Note.event * 'a send
create () is a primitive event e and a send function. The function send is such that: Warning. send must not be used in the definition of signals or events.
val value : 'a Note.event -> 'a option
value e is the value of event e at call time. If this is None the event has no occurence, if this is Some v, the event occurs with v.
val never : 'a Note.event
never is a never occuring event, [never]t = None.
val bind : 'a Note.event -> ('a -> 'b Note.event) -> 'b Note.event
bind e f is the event that results from applying f to the last event of e:
val join : 'a Note.event Note.event -> 'a Note.event
join ee is bind ee (fun e -> e).
val swap : 'a Note.event Note.signal -> 'a Note.event
swap es is the current event of es, [swap es]t = [[es]t]t.
val map : ('a -> 'b) -> 'a Note.event -> 'b Note.event
map f e applies f to e's occurrences.
val stamp : 'b Note.event -> 'a -> 'a Note.event
stamp e v is map e (fun _ -> v)
val filter : ('a -> bool) -> 'a Note.event -> 'a Note.event
filter p e are the occurences of e that satisfy p.
val filter_map : ('a -> 'b option) -> 'a Note.event -> 'b Note.event
filter_map fm e are e's occurrences filtered and mapped by fm.
val select : 'a Note.event list -> 'a Note.event
select el is the occurences of every event in el. If more than one event occurs simlutanously, the leftmost is taken and the other are lost:
val accum : 'a -> ('a -> 'a) Note.event -> 'a Note.event
accum i e accumulates a value, starting with i, using e's functional occurrences.
val until : ?limit:bool -> next:'a Note.event -> 'b Note.event -> 'b Note.event
until ~limit ~next e is e's occurences until next occurs. At that point if e occurs simultaneously the occurence is discarded (limit is false, default) or kept (limit is true) and after this the event never occurs again.
val fix : ('a Note.event -> 'a Note.event * 'b) -> 'b
fix ef allows to refer to the value an event had an infinitesimal amount of time before.

In fix ef, ef is called with an event e that represents the event returned by ef delayed by an infinitesimal amount of time. If e', r = ef e then r is returned by fix and e is such that :

Raises. Invalid_argument if e' is directly a delayed event (i.e. an event given to a fixing function).


Stdlib types support


module Option: sig .. end
Option events
module Pair: sig .. end
Pair events.