|
|
>> What happens if the expression is very long? For example, a function
>> could take a large amount of parameters, all of which are long
>> expressions
>> using long variable names.
>
> Put each argument on a seperate line, indented further than the function
> name.
Or... make them local variables.
(That's more usually done if a certain subexpression is needed more than
once - since, obviously, putting it in a variable makes it only evaluate
once. But you can also use it to break things up - especially if what
you're doing is complicated.)
let
thing1 = ...
thing2 = ...
thing3 = ...
in foo thing1 thing2 thing3
Notice that, unlike in "normal" languages, let is an *expression*, but a
*statement*, so it is valid absolutely anywhere an expression is valid.
That includes absurd constructions like
(let x = 5 in x) + (let y = 2 in y)
which just means "5 + 2".
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|