Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!sdd.hp.com!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.lisp Subject: Re: weird common lisp feature Keywords: read, read-line Message-ID: <1991Feb21.165611.14986@Think.COM> Date: 21 Feb 91 16:56:11 GMT References: <12413@helios.TAMU.EDU> <1991Feb21.104336.26012@Think.COM> <18935@brahms.udel.edu> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 43 In article <18935@brahms.udel.edu> lkramer@brahms.udel.edu (Laurence Kramer) writes: >Permit me to flame a while... Last week I wrote a message that said >briefly that people doing AI R&D in C rather than Lisp needed their >heads examined. Well, this common lisp "feature" mentioned further >reinforces another opinion I have: People developing in common lisp >need their heads examined. If I write (foo a) (foo2 b), I would certainly >expect foo to be evalled before foo2. As a software developer I shouldn't >have to worry that the combination of foo and foo2 somehow is different >than most other functions I know about. This is certainly in direct >opposition to the spirit of Lisp programming! I've never heard of a case where they would be evaluated out of order, unless they are subforms of a macro call that explicitly rearranges its subforms, e.g. (defmacro do-backwards (&body body) `(progn .,(reverse body))) This can happen in any language with a sufficiently powerful macro processor. The problem that the original poster was running into has nothing to do with things being evaluated out of order. He was simply encountering problems due to the implementation's and OS's I/O buffering, which afflicts many languages, and which can have the appearance of executing things out of order. I've seen similar questions in comp.lang.c; for example, the following Unix C excerpt will likely execute out of order: printf("This should be first. "); write(1, "This should be second. ", 23); By the way, some other Lisp dialects actually *do* have the feature that forms may be evaluated out of order. Scheme deliberately does not specify the order of evaluation of arguments in a function call; if you are concerned about order, you must use BLOCK (the Scheme equivalent to PROGN). Common Lisp specifies that function arguments will be evaluated left to right. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar