[erlang-questions] Can I do var-assignment in a function?

Circular Function circularfunc@REDACTED
Wed Jul 23 13:08:59 CEST 2008


extract(Str) ->
    A = string:tokens(Str," ").
    lists:sort(A).

I could of course do this:
lists:sort(string:tokens(Str," ")).

But lets say I want a bigger function that slo includes some deeper function calls, lets say 4-5
calls deep.

That's the main thing I dislike about functional programming, it is very expressive but sometimes it is hard afterwards to follow what a function does and it is hard hwen you have to read what is happening from right to the left.
It is easier to reason about when I can split into several calls.

I guess it is doable but I can't figure out the syntax.



      __________________________________________________________
Går det långsamt? Skaffa dig en snabbare bredbandsuppkoppling. 
Sök och jämför priser hos Kelkoo.
http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080723/b6ad696c/attachment.htm>


More information about the erlang-questions mailing list