|
A function is a type, is a set, is a number. And that, frankly, is difficult to get around. Coming from the C / Java world, it is hard to understand that "types" are really sets (in a mathematical sense) which in turn, are numbers (i.e. the set of natural integers), and a function (in terms of the value it returns) is a number as well and can be considered as being an "operation" upon a set, i.e., put set A into set B and one has set C. Function == Type == Set == Number, or, perhaps, a Number is simply an instance of a Set which in turn is another way of saying Type, so, basically, Function == Set. What makes it conceptually difficult is that the word "function" entails "operation", which entails "time", when, really, one could think of "function" as sort of being "those steps one has to go through in order to define a set of type S". A set is a theorem, so now we have, Theorum == Type == Set == Number. A function is simply the way of defining or proving the Theorum, e.g. if set A == B, and B == C, then A == C is a function, which itself is a Set, conjoining A and C. The "type" of an object (integer, char, whatever) is really a Set, and the way to construct that set (also being itself a set) is a function, which is what one might call a "program". These things are different ways of looking at the same thing. A "type" (set) is the Theorum, its proof is the function (program which constructs the Theorum or Set). The only difference between function/program and Set/Theorum is the former "constructs" the later, the former being "temporal" the latter being "eternal" or put it another way, the former being the "building blocks" the latter being the "finished product". So yes pointers are numbers, which though are Sets, constructed by functions and these sets construct the Theorums. The type is the Theorum, the function is the construction of that Theorum, done vis-a-vis Sets and that is what (IMHO) that thing which we call "computer science" is all about. :-) |
Pure functions do not. Pure functions are relations from a domain to a codomain, implying a "mapping", but not an "operation", which I believe implies change. This mapping (from the domain to the codomain) can be presented as a subset of the cartesian product of the domain by the codomain (which you allude to.) This is devoid of any notion of "time".