Skip to content

pmoriarty/lamina

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

an event-driven data structure for clojure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 100.0%