Hacker News new | ask | show | jobs
by red_trumpet 994 days ago
> Also, speaking of notation, I wonder why you used ':=' instead of '=' to define 'f'. There is no computation going on, right?

In math, := is typically used to denote a definition. Using equality (=) only makes sense if both sides of the equality sign already have a definition.

2 comments

Well, to be fair, = is also very often used for definitions. And the reader has to figure out from context which meaning of = applies.
> In math, := is typically used to denote a definition.

i mentioned this up-thread but is that why := is assignment in Pascal? Wasn't Pascal the main academic language there for a while?

Yeah, I think that has the same origin. Though I'm not sure if programming languages or maths came first. Apparently, for programming languages it appeared first in ALGOL in 1958[1].

Edit: On math.SE[2] someone claims that it's notation borrowed form programming. Someone else claims that it was introduced by Bourbaki, which might predate programming, as Bourbaki started publishing in the 1930s. However, I couldn't find any evidence of this from skimming a few Bourbaki PDFs.

[1] https://en.wikipedia.org/wiki/Assignment_(computer_science)

[2] https://math.stackexchange.com/a/25215/312406