From 64106c4d3d4ddba8c7bc2af75376e6d3d3d75601 Mon Sep 17 00:00:00 2001 From: Date: Mon, 29 Jun 2015 20:16:15 +0000 Subject: Update documentation --- carboxyl/lift/index.html | 173 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 carboxyl/lift/index.html (limited to 'carboxyl/lift/index.html') diff --git a/carboxyl/lift/index.html b/carboxyl/lift/index.html new file mode 100644 index 0000000..57f4038 --- /dev/null +++ b/carboxyl/lift/index.html @@ -0,0 +1,173 @@ + + + + + + + + + + carboxyl::lift - Rust + + + + + + + + + + + + + + + +
+

Module carboxyl::lift + + [] + + [src]

+

Lifting of n-ary functions.

+ +

A lift maps a function on values to a function on signals. Given a function of +type F: Fn(A, B, …) -> R and signals of types Signal<A>, Signal<B>, … the +lift! macro creates a Signal<R>, whose content is computed using the +function.

+ +

Currently lift is only implemented for functions with up to four arguments. +This limitation is due to the current implementation strategy (and maybe +limitations of Rust's type system), but it can be increased to arbitrary but +finite arity if required.

+ +

Example

+let sink_a = Sink::new();
+let sink_b = Sink::new();
+let product = lift!(
+    |a, b| a * b,
+    &sink_a.stream().hold(0),
+    &sink_b.stream().hold(0)
+);
+assert_eq!(product.sample(), 0);
+sink_a.send(3);
+sink_b.send(5);
+assert_eq!(product.sample(), 15);
+
+

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + +
lift0 +

Lift a 0-ary function.

+ +
lift1 +

Lift a unary function.

+ +
lift2 +

Lift a binary function.

+ +
lift3 +

Lift a ternary function.

+ +
lift4 +

Lift a quarternary function.

+ +
+ + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3