#haskell question about a course exercise
f x = (\y -> y) x
This is the identity function applies to the argument x. No problem here.
f x = \y -> y
I think this is invalid syntax. Lambda functions need to be wrapped in () ?
f x = (\y -> x) x
This one is unusual. I think it outputs x as if it were a constant. That is, the lambda function always outputs x, and doesn't calculate on y. Not sure about this one.....
@rzeta0 No, the second one is valid. No parentheses are required. f is a function that ignores its argument and returns the identity function.
You are correct about the third one. f ends up being just the identity function.
@dpwiz @byorgey
thanks again - I suspect this is common advice to beginners like me