Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.scheme Subject: Re: Return value of SET!/SETQ/=, and order of evaluation Message-ID: <5113@goanna.cs.rmit.oz.au> Date: 4 Apr 91 12:23:51 GMT Article-I.D.: goanna.5113 References: <9104011524.AA09177@schizo> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 74 In article <9104011524.AA09177@schizo>, gjc@mitech.COM writes: > Actually, throw in the fact that in Scheme the empty list > and logical false are DIFFERENT. > As a LISP programmer for over 10 years I find it much more comfortable > to program in C than in the latest Scheme standards. Well, Pop-2 fans expect logical false to be represented by the integer 0. I generally found it to be much easier to convert published MIT lisp code to Pop than to make it run under strange Lisps, and this difference was never a noticable problem. Maybe the MIT people just wrote good code? > In C, I use the return value of assignments all the time. > It is a very common programming practice. > The way that Scheme is defined now, WELL, it just forces the > programs to be much more verbose, with lots of extra LAMBDA/LET > statements, and local variables, and even extra assignments. Not hardly. Suppose you had wanted to write (f ... (setq x -expr-) ...) In Scheme, (f ... (set! x -expr-) ...) isn't going to work. But do you need *ANY* extra LAMBDA/LET forms at all? Nope, not one. Use (f ... (begin (set! x -expr-) x) ...) Every Scheme I have provides macros, so it is possible to do (define-macro (setq var expr) `(begin (set! ,var ,expr) ,var)) and then you can continue writing Lisp code as before. Certainly macros aren't in the current standard, but extend-syntax seems to be emerging as the de facto standard. As for relying on C's NULL pointer being one of the several 'false' values in C, you will find that there has been much argument in comp.lang.c in the past to the effect that this is not a good idea and that programmers should explicitly write (x != NULL) rather than !x. > No longer do we have a LISP which is EXPRESSION oriented in the > way that BLISS and quite a bit of C was. This is counterfactual. Bliss (at any rate Bliss-10, which is what I used) had quite a few constructs that didn't return any _useful_ value. What value do loops return in C? But Scheme loops do return a useful value. > OK. Is a procedure call important? If so, then why is it not > possible to define a procedure which has no defined return value? I don't really understand this. I've seen a Scheme book which did (define Undefined-Value "undefined value") (define (proc arg1 ...) ;; "statements", if that's what you want to call them Undefined-Value) One of the Schemes I have access to has a #v (void) value for this purpose. (Of course, Pop, which lets you return any number of results, including 0, is rather prettier.) Or if you want a procedure which has no _defined_ return value, how about (define (proc arg1 ...) ... (set! arg1 arg1)) (:-) (:-) (:-) > That is, why is it not possible to extend the language (via procedure > definitions) in the class of STATEMENTS (e.g. built in SET!-CAR > vs my own defined SET!-FROB)? Why only in the class of EXPRESSIONS? Ok, so why isn't water wet? What is it that you can't do? -- It is indeed manifest that dead men are formed from living ones; but it does not follow from that, that living men are formed from dead ones. -- Tertullian, on reincarnation.