How is the expression \x -> y
typically pronounced by Haskell programmers?
I ask because I ordinarily say "lambda eks dot why," because it's written λx.y
in a general context and I was introduced to the lambda calculus through books and notes, without hearing anyone translate the terms into speech. But it's an arrow, not a dot, in Haskell.
I understand that computer-science people often elide the dot in speech ("lambda eks [short pause] y"). F# and C# programmers, the web tells me, often pronounce the equivalent expression x => y
as "eks goes to why." I don't know how similar constructions are said in other contexts.
So among Haskellers is it "lambda eks arrow why," or what?
I usually pronounce it as "lambda x to y". This is very short and matches how you would type it in TeX:
\lambda x \to y
. (As a cute note, I have a TeX input mode in my editor, so I could type the above to getλ x → y
. :P)That said, I'm sure that everyone would understand you if you said "lambda x dot y"--most people are at least familiar with that notation and the it's very easy to guess what you mean from context.
I've never heard anybody say "goes to", however.
Answering for myself: in my mind I often say it as "x goes to y", or simply "x to y" -- but I think it adapts a bit for some common higher order functions. If you had
map (\x -> (x * 2) - 1) foo
, I'd think of it as "map x to x times two minus one on foo". However, for something likefilter (\x -> x /= 6) foo
I'd read it as "filter x, x doesn't equal 6, on foo" -- effectively, the arrow becomes a comma in that case.