7 ms·
You can also use anonymous functions if you find the module syntax a little terse or clunky for shell scripting. double = fn a -> add.(a, a) end double
by irjoe 3y ago
You can also use anonymous functions if you find the module syntax a little terse or clunky for shell scripting.
double = fn a -> add.(a, a) end
double.(4)
It starts to look a bit like a weird untyped OCaml / F# if you use pattern matching:
f = fn
x, y when x > 0 -> x + y
x, y -> x * y
end