[erlang-questions] Can I do var-assignment in a function?
Wed Jul 23 14:04:32 CEST 2008
You are almost there: you need to replace the period on the second
line with a comma.
A = string:tokens(Str, " "),
Generally speaking, sequential statements in a block are separated by
commas; blocks are separated by semi-colons; and functions are
terminated by a period. Watch out for guards, though - commas and
semi-colons are used differently there.
2008/7/23 Circular Function <circularfunc@REDACTED>:
> extract(Str) ->
> A = string:tokens(Str," ").
> 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
More information about the erlang-questions