Erlang is very cool. It's functional (declarative too), supports massive concurrency and promotes a number of programming idioms I find myself applying to Tcl. You don't have to emulate it via syntactical FP sugar (Lambda in Tcl, List Comprehension, etc). The idioms are rich and Tcl is up to the task! Tcl (with Threads) can do COP too ;-)
My network servers (coded in Tcl) are starting to model the way Erlang/OTP does things.
(Some of the items below are FP idioms, not just Erlang)
Some of the simple idioms:
Some things you can't really do well (or at all) in Tcl:
Could you elaborate upon this, please?
lexfiend: To illustrate, in:
factorial(0) -> 1; factorial(N) when N > 0 -> N * factorial(N - 1).
the expression N > 0 guards the function clause factorial(N) -> N * factorial(N-1) (the reserved word when introduces the guard). It essentially says "Don't evaluate this function clause if the guard expression fails". It basically translates to an if test, so I assume Todd's commenting about it being difficult to similarly express such things in Tcl.
If one had a copious amount of time, one could adapt Erlang/OTP to Tcl. That would be very nice...
-- Todd Coram
Although I have seen variations upon this elsewhere (Tail call optimization), this continues to amuse me: Factorial Using Event Loop.
Erlang makes extensive use of dictionaries (like Tcl arrays). It has a fast and scalable implementation but Scott Lystig Fritchie discovered a way to incorporate something called Judy Arrays into Erlang. His paper http://www.snookles.com/scott/publications/pli2003-slf.pdf compares different implementations of hashes for Erlang.
-- Todd Coram