Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!hsdndev!husc6!carlton From: carlton@husc10.harvard.edu (david carlton) Newsgroups: comp.lang.scheme Subject: Re: Concerning standards. Message-ID: Date: 14 Jun 91 01:28:46 GMT References: <6209@goanna.cs.rmit.oz.au> Sender: news@husc6.harvard.edu Followup-To: comp.lang.scheme Organization: Citizens for Boysenberry Jam Lines: 75 In-reply-to: ok@goanna.cs.rmit.oz.au's message of 11 Jun 91 06:53:52 GMT In article <6209@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: 1. Adding and Subtracting 1. Many Lisp systems have functions for adding and subtracting 1. Over the years, the names have varied a lot, but Common Lisp has finally settled on the names (1+ expr) ; add 1 to expr (1- expr) ; subtract 1 from expr. Now, the last name is a little misleading. It suggests 1 - expr, rather than expr - 1. So the language described in "Structure and Interpretation of Computer Programs", namely "Scheme", included (1+ expr) ; add 1 to expr (-1+ expr) ; add -1 to expr == subtract 1 The Scheme standard, however, includes neither of these operations. They can easily be replaced by the entirely equivalent (+ expr 1) ; add 1 to expr (- expr 1) ; subtract 1 from expr and a smart compiler will generate the same code for those expressions that it would have generated for 1+ and -1+. A standard-conforming compiler can't - they have quite different semantics. I'd rather have named constants... Indeed, there is nothing in the Scheme standard that requires a Scheme system to accept 1+ and -1+ as valid identifiers! One reason why I use add1 and sub1. 1+ and -1+ always looked odd to me, anyways. 2. Sorting. Sorting is indispensable in Prolog. It is difficult to write a non-trivial efficient Prolog program without using it. As Scheme lacks hash tables, sorting is also very useful in Scheme. True. Another reason why I like having first-class environments - they're basically hash tables indexed by symbols. A hot implementation can even provide dynamically expanding and contracting environments and spend the time tuning it for speed, ending up with something that is likely to be much faster than whatever hash tables you implement by hand. I think that I agree with your basic point, though. (Which is why I didn't quote the parts of your posting that actually present your point.) I do think that it is a bit unfair for you to claim that thinking that '1-' is portable because CLtL says it is and Scheme is a list is a particularly reasonable thought process - Scheme has so many superficial differences from other Lisps that people who have learned to use begin instead of progn, define instead of defun, etc. probably will figure that one out, too. SICP is more of a problem - truly unfortunate that that book was written before R3RS appeared. All sorts of completely unnecessary nonconformities with current Schemes that arose from that - my favorite one is the bit where the authors admit that having '() and #f be the same thing isn't particularly necessary, but then say that Scheme has it that way so they are going to use it. Quite reasonable at the time, but a real pain in retrospect. Hopefully enough other good books about Scheme (not that SICP is really about Scheme) that conform to current standards are out there that one has enough other options for becoming familiar with the language, but it is a problem, all the more so because of the high quality of SICP. david carlton carlton@husc9.harvard.edu JOYCE: Huelsenbeck demanding, for example? TZARA: International revolutionary union of all creative men and women on the basis of radical Communism - expropriation of property - socialization... JOYCE: As opposed to Tzara's demanding? TZARA: The right to urinate in different colours. - Tom Stoppard, _Travesties_