Erlang is a crazy-arsed symbolic functional language with awesome concurrency features derived from Prolog. It implements lightweight ‘processes’ which are even lighter than OS threads, share no memory, and pass messages between each other.
mattw is finding himself quite impressed by it, and he’s halfway towards buying FP religion.
brehaut is experimenting with it
Lowercase a string (for a random example):
lower(L) ->
lower(L, []).
lower([], L) ->
lists:reverse(L);
lower([H|T], L) when H > 64, H
lower(T, [H+32|L]);
lower([H|T], L) ->
lower(T, [H|L]).
Comments
It doesn’t really look prolog-esque to me, it just has a similar list syntax, the same thing in haskell would be
lower [] l = reverse l
lower (h:t) l | h > 64 = lower t (h + 32):l
| otherwise = lower t h:l
I think (this being from old, unused memory) .. and should it really be +32, rather than -32? — Ollie
Yeah it doesnt look too prologee to me, although the language was origonally concieved as a concurrent prolog implemention, and yeah ‘a’ == 97 and ‘A’ == 65 — brehaut
Which probably explains the prolog-esque list syntax… — Ollie
