Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!bruce!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Concerning standards. Message-ID: <6376@goanna.cs.rmit.oz.au> Date: 18 Jun 91 06:24:34 GMT References: <6209@goanna.cs.rmit.oz.au> <504@data.UUCP> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 116 In article <504@data.UUCP>, kend@data.UUCP (Ken Dickey) writes: > >1. Adding and Subtracting 1. > -1 is a negative number, so cannot be a procedure: (- 0 1) -> -1 Irrelevant. The identifiers in question (used in SICP!) were 1+ and -1+, neither of which is a number. > This was done as part of syntax cleanup for numbers (partly because > people found the procedure names 1+, -1+, etc. confusing; partly because > of parsing complex number syntax: e.g. "-1+3i"). Bogus. Lisp tokenisers have typically read the whole token into a buffer, checked to see whether it could be parsed as a number, and if not have taken it to be a symbol. Not only do Common Lisp systems _still_ have to work that way, every actual Scheme implementation where I have been able to look at the code DOES work that way. Doesn't prove they all _do_, but does prove they _could_ without otherwise violating the standard. And the argument falls flat on its face in a steaming pile of you-name-it-but- it-ain't-roses when you remember that my complaint was not that the standard says you CAN'T use 1+ or -1+ as identifiers (it just doesn't say you CAN) and that in consequence most Schemes *DO* provide these operations, it just that you can't _quite_ rely on them, because there are a couple that don't. > > Frankly, I am getting just a little bit tired of having to go > > through Scheme code fixing references to 1+, 1-, and -1+. > This looks like a global-replace+educate to me. Sorry mate, you've forgotten that Scheme can do things with functions other than just call them. Global replace doesn't cut it. Variables are sometimes initialised to 1+ and -1+, e.g. (define add1 1+) (define sub1 -1+) At this point, add1 and sub1 HAVE to be given a suitable definition. Once you've got it, why not use it? Of course, if you're using something like TRANSOR or SEdit your global-search-and-replace MAY be able to handle ((if (< x 0) 1+ -1+) x) but mine (even in Emacs) isn't. (Things can, and do, get worse.) There really wasn't anything to gain by breaking so much of SICP. (Deleting atom? seemed rather petty, too, and has had the same effect.) > (Note: given the > growth in the Scheme community, most Scheme code had yet to be > written). Sorry, but that's not an answer. The TEXTBOOKS had ALREADY been written. Dybvig, for example, uses 1+. Nobody learning Scheme from that book would suspect that it was not in fact part of Scheme. Nor from SICP. And one of the Scheme manuals I have, whose authors took great care to flag everything that isn't standard, _don't_ flag 1+ because when they wrote the manual it *was* in the R^nRS. I note that John Stobo's book on Prolog has met the same fate, although since his book described the new language that the committee he was on were busy designing, the language he described is one which _never_ came into existence. How very sad for him. And if he had stuck to describing say, C Prolog or DEC-10 Prolog, some of his readers would have been able to use the book and would still be able to use it. > > However, sorting is not part of the Scheme standard or R^(3.99)RS. > This is because we were specifying the language, not a standard > library. Sorry, that isn't true. The last draft of the standard I saw (we've got an order for the actual thing in the pipe-line somewhere) included assq, assv, assoc, memq, memv, member. Those operations can be defined entirely in Scheme. (Book 1, Lesson 3.) What are they, if not "standard library"? In DEC-10 Prolog, member/2, and append/3 were not built in; they were part of the library. (length/2 could have been, as well.) Let's face it, (length -), (member - -), (append - -...) are all library functions that _could_ have been left out of the standard. (substring - - -) could have been left out (as (subvector - - -) has, to my annoyance). That's 9 so far. In fact, I have my own implementations of (write obj [port]) and (display obj [port]), because I wanted versions with depth bounds, length bounds, and output base control. The core takes about a page of code, because everything you need is there in the language. (This is not true for Prolog, because of variables. write/1 is _not_ definable in `kernel' Prolog.) Now we're up to 11; and (write - -) and (display - -) are comparable in complexity to (sort - -). There's no way out of it: the Scheme standard DOES include quite a few operations that _could_ have been put in a PD library instead. The only question is HOW BIG a library you are going to include. Common Lisp's designers have said "We are interested in helping people be more productive; the less they have to write again the more of their _own_ work they can do". The problem is that you can get a system which overwhelms you with things you don't want. Ok, one answer is to HAVE an explicit library. To say, we'll leave this out of the kernel of the standard. If you want it, you have to ask for it to be loaded. But it will be _there_ in a form that can be loaded; you don't have to write it. (That's the DEC-10/Quintus library approach.) > >That's looking at the effect of a `minimal' standard. > >Mind you, some of the things the standard _does_ say haven't received > >much in the way of conformance, so perhaps it doesn't really matter > >that these things _were_ left out of the standard. > > As the IEEE standard was just published this month, this should not be > suprising. Yes it should. It has been easy to get drafts of the standard. I have in fact encountered a product that claims conformance, but lies. > I expect all live compilers will be complient within a few months. How much are you willing to bet? -- Q: What should I know about quicksort? A: That it is *slow*. Q: When should I use it? A: When you have only 256 words of main storage.