4 ms·
The first edition of SICP form 1985 already has a discussion of numeric capabilities in Scheme as an example of programming style based on generic procedures.
by dschiptsov 12y ago
The first edition of SICP form 1985 already has a discussion of numeric capabilities in Scheme as an example of programming style based on generic procedures. It might don't have the term Numerical Tower but the ideas were well-developed before 1985. Original HP lectures of Abelson and Sussman explicitly explain the how and whys. Brian Harvey's CS61A has it.
Smalltalk also has Numerical Tower for the very same reasons - to have "generic" '+ '* '/ etc.
Here classic discussion of the topic: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/4b-generic-operators/ http://ocw.mit.edu/courses/electrical-engineering-and-comput...
Note when he emphasize how generic '+ procedure is used. This btw is one of most important realization in a whole course. It is justification behind the Numerical Tower.
- lispm 12y ago> don't have the term Numerical Tower but the ideas were well-developed before 1985 These things existed way before Scheme and Common Lisp. 60s. Lisp had a generic + shortly after the dinosaurs disappeared... Scheme hasn't introduced that. See for example the Lisp 1.6 manual from 1968. It had inums (short ints), fixnums, bignums (large ints) and reals. See chapter 4. It had generic numeric functions. See chapter 12.1 of the manual. http://www.softwarepreservation.org/projects/LISP/stanford/SAILON-28.2.pdf http://www.softwarepreservation.org/projects/LISP/stanford/S... Extensive mathematical software was written long before Scheme existed: Macsyma, Reduce, .... Maclisp's compiler was hacked up quite a lot to support Macsyma, in the mid 70s. Bignums were added to Maclisp in 70/71. Complex numbers were in S-1 Lisp and came from there to Common Lisp, it seems. Common Lisp was a successor to Maclisp and it was expected that the large amount of math software (like Macsyma or IBM's Scratchpad, both available under Maclisp) should be supported. Common Lisp had nothing numerical from Scheme. Basically it got its capabilities from Maclisp, Macsyma and S-1 Lisp. Neither CLtL1 nor HOPL2 gives any indication of any Scheme influence in that area. Scheme took CL's numeric capabilities (see the Scheme Report from 1985 - CL was under development from 81/82 onwards with CLtL1 published in 1984) and then developed new ideas... Common Lisp had some Scheme influences, but not the numeric capabilities.
- dschiptsov 12y agoOK, let's put it differently. In these old Lisps they indeed had FIXNUM+ and REAL+ or whatever and explicit coercing, the Fortran way, reflecting how a machine works, while Scheme pioneered the approach with only one '+ generic procedure exported with all the "rising" done implicitly - influenced by Algol. My point was that the second approach is an improvement compared to the first one. And it is not my own fancy - watch the lectures. They also emphasized that it works nice only with numbers, which happen to form nested sets. Actually, I cannot get what we are arguing about? That I missed some historical nuances or my sources are not credible enough, or that I got wrong the goal of switching to generic procedures in Scheme? Or, perhaps, that the original article makes any sense?
- lispm 12y ago> OK, let's put it differently. In these old Lisps they indeed had FIXNUM+ and REAL+ or whatever and explicit coercing, the Fortran way, reflecting how a machine works, Wrong. Lisp had a generic + function LOOONG before Scheme. It was called PLUS. The Lisp 1.6 manual from 1968: 'Unless otherwise noted, the following arithmetic functions are defined for both integer, real and mixed combinations of arguments... The result is real if any argument is real, and integer if all arguments are integer...' It then describes the functions MINUS, PLUS, DIF, TIMES, QUOTIENT, DIVIDE, ... Examples in the manual: (PLUS 1 2 3.1) = 6.1 (PLUS 6 3 -2) = 7 (TIMES -2 2.0) = 4.0 > Scheme pioneered the approach with only one '+ generic procedure exported with all the "rising" done implicitly - influenced by Algol. That's what Lisp did in the 60s. The function was called PLUS. It was fully generic. It is nothing Scheme has contributed.
- dschiptsov 12y ago> Unless otherwise noted, the following arithmetic functions are defined for both integer, real and mixed combinations of arguments This is good point. Thanks. It seems that the original view of John John McCarthy - before the decade of different implementations, was "right", > It is nothing Scheme has contributed. Scheme, it seems, re-emphasized it, much later, as the answer to the mess made by different implementations. I could give you an example form a complete different field, in order to show how common such pattern is. The very first Aryan Vedas emphasize the notion of taking inspirations from the nature and remaining in unity with it. They use deities as symbols for the major natural powers and appreciate them. Then these ideas has been taken by "other people" and mechanistic, ritual-based religions, based on worshiping and praising of anthropomorphic idols emerge. This, in turn, resulted in emergence of Upanishads as thinking people got sick with all that nonsense, and from the Upanishads the Advaita Vedanta and Buddhism schools has been developed (and got ruined by "commentators"). This is a social pattern. I can't tell how meany times in history these cycles of inflation and reduction, mass hysteria and returning back to the very few "great insights" happened. I am not telling you that this my analogy for the evolution of Lisps is precise - only the MIT guys behind Scheme could tell whether I am wrong or not - but I have this notion, based on what I read in books and watched in lectures, so I, if you have no objections, would still hold my opinions.