Posts

Showing posts from February 11, 2009

erlang ! hello

On Tuesday while reading Programming Erlang on suggestion of Andreas Cardeneo from the Research Center for Information Technology of the University of Karlsruhe , I started to experiment in Haskell with typed channels and lightweight threads to imitate Erlang style processes and networks thereof. Here is the very early and raw code from a few hours of exploration. And here is a simple interactive session in which a server is created that reads strings into integers. These integers then get _distributed one at a time_/_dealt_ to a first layer of 3 parallel nodes and they then travel to a second layer: *Erlang> (server,out) ← serve (read :: String → Integer) *Erlang> l1ts ← create 3 :: IO ([Chan Integer]) *Erlang> did ← deal move ([(\y → y - x) | x ← [1..3]]) out l1ts *Erlang> l2ts ← create 3 :: IO ([Chan Integer]) *Erlang> tids ← sequence $ zipWith (link move (2 *)) l1ts l2ts *Erlang> server ·· [ show x | x ← [2..4] ] *Erlang> all_ flush l2ts -- [[2],[2],[2]]