Why do some functional languages not use parenthesis for function arguments? -
i've been trying adopt functional language programing. use c# , rely heavily on linq , other functional constructs. i'm focusing on elm.
one thing continues bother me lack of parenthesis in functions. math expressions use them:
f(z) = ln(z) + 1
yet in many functional languages written as:
f z = ln z + 1
it style thing or there deeper going here?
functional languages take root in lambda calculus, not use parentheses functional application.
it syntactical thing sure, way functions applied makes sense leave parentheses out since function 2 arguments first applies left argument function , output function used second argument. example function used to:
add(x,y) { return x + y }
in functional terms
add x y add :: int->int->int
where intermediate step after applying x returns function
add 4 -- returns function return 4 + y, when y applied add 4 :: int->int
to degree helps avoid confusion programming languages used add(4) throw error. reads more math associativity, ((add x) y)
.
Comments
Post a Comment