Coming from Haskell to play with Nitrogen and running into a few things I can’t find examples of, so if somebody could help me out:
Haskell’s where (and or let or any type of function nesting with access to parent variables) in erlang? How? Can you?
burnOrDie hotness = foldl1 (>>) $ map burn ["Jimmy", "Adam", "Gonzo"]
where burn x
| hotness < 3 = print $ x ++ ": Ouch!"
| otherwise = print $ x ++ ": GAHHH! *die*"
Partial application? Haskell: addOne = +1
in-line lambda function? Haskell: map (\x -> x+x) [1,2,3]
I am no expert in erlang but I will try to answer.
Nesting functions
here SQ function has access to parent variables.
In Lambda
This is same as above, you can use
funto define your anonymous functions.Partial application
I don’t think erlang has partial function application in any sane way. The only thing you can do is to wrap functions to return function.
Now you can do something like