« Return to Thread: Can I do var-assignment in a function?

Can I do var-assignment in a function?

by cnb :: Rate this Message:

Reply to Author | View in Thread

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.


Sök efter kärleken!
Hitta din tvillingsjäl på Yahoo! Dejting: http://se.meetic.yahoo.net

_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions

 « Return to Thread: Can I do var-assignment in a function?

LightInTheBox - Buy quality products at wholesale price!