Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 1.15 KB

README.textile

File metadata and controls

37 lines (29 loc) · 1.15 KB

Lamina provides an event-driven analogue to Clojure’s sequences, called channels. Similar mechanisms have been used in languages such as Go, JoCaml, and C#.

Channels are meant to be a generic interface for the creation and consumption of asynchronous events. Within Aleph, they are used to represent network communication over a variety of protocols.

Sequences can be turned into channels, and vise-versa:

> (def ch (apply channel (range 3)))
<== [0 1 2]
> (channel-seq ch)
(0 1 2)

Channels can be altered using familiar operators:

> (channel 1 2 3)
<== [1 2 3]
> (map* inc *1)
<== [2 3 4]
> (filter* even? *1)
<== [2 4]

Channels can be connected to each other, like UNIX pipes:

> (def a (channel))
<== []
> (def b (channel))
<== []
> (siphon (map* inc a) b)
nil
> (enqueue a 1)
true
> b
<== [2]

To learn more, read the wiki. Complete documentation can be found here.