6 ms·
What do the bindings bind then? So, no, even in pure functions like f x = x + 1 x is a bound variable. It doesn't 'vary' in the sense that the value it r
by alipang 13y ago
What do the bindings bind then?
So, no, even in pure functions like
f x = x + 1
x is a bound variable. It doesn't 'vary' in the sense that the value it refers to can be mutated, as in a imperative language, but it varies between calls to the function f.
- TylerE 13y agoIt is rebound. It is improper to call it a "variable" because in any given lifetime, it's value cannot vary. That's the point. It is possible to create a new binding with the same name, but any code holding on to the old instance keeps the old value. Subtle but important difference.
- mbrock 13y agoYou're simply wrong. That's not how the term "variable" works. From http://en.wikipedia.org/wiki/Variable_(mathematics) http://en.wikipedia.org/wiki/Variable_(mathematics): "Varying, in the context of mathematical variables, does not mean change in the course of time, but rather dependence on the context in which the variable is used."
- tel 13y agoWhile I agree with your philosophy of vocabulary here, I've read the Harper article too, it's valuable to state directly that everyone knows there's the _(Programming) article too and is simply disagreeing that its a "good" way to use the term. Anyone who isn't familiar with the distinction in terminology ought to consider what things a programming variable represents that a mathematics variable does not..
- Symmetry 13y agoFrom http://en.wikipedia.org/wiki/Variable_%28programming%29 http://en.wikipedia.org/wiki/Variable_%28programming%29 "The identifier in computer source code can be bound to a value during run time, and the value of the variable may thus change during the course of program execution. Variables in programming may not directly correspond to the concept of variables in mathematics."
- mbrock 13y agoIt's wrong that it's "improper" to use the term "variable" for Haskell variables, since it is an established usage. This usage of "variable" occurs in the very first paragraph of Church's first paper on lambda calculus from 1931 in the motivation for the whole project!
- iopq 13y agoMath doesn't have vars, only vals
- mbrock 13y agoThat's a rather strange assertion, if you mean "variables" and "values." Math distinguishes between variables and values. Variables have different values. Values can be bound to variables. Sometimes we do math with mostly variables and few values -- that's called algebra.
- iopq 13y agoI mean Scala vars can be changed during the program, while Scala vals can't. val y = Console.readInt var x = y + 1 x = y + 2 //valid y = 5 //error, vals can't be changed in the same block