This is the original function
[let square x = x * x in (square 5, square 3, square 2)]
I tried to remove let from the line above, but it doesn't work.
[square x = x * x in (square 5, square 3, square 2)]
<interactive>:21:11: error:
parse error on input ‘=’
Perhaps you need a 'let' in a 'do' block?
e.g. 'let x = 5' instead of 'x = 5'
Why let is necessary to be there?
List is created from expressions. Expression for introduction local variable name should start with let
(or, more specifically, should use let ... in
syntax). square x = x * x
is a top-level function declaration.