Path: utzoo!attcan!telly!lethe!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!edcastle!aiai!jeff From: jeff@aiai.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: Terminology and style (was Re: Question about INTERN) Message-ID: <4115@skye.ed.ac.uk> Date: 13 Feb 91 11:32:33 GMT References: <1991Jan29.055536.1523@magnus.ircc.ohio-state.edu> <5783@idunno.Princeton.EDU> <4037@skye.ed.ac.uk> <1991Jan30.225106.26561@Think.COM> <4092@skye.ed.ac.uk> <27B8222F.3C70@wilbur.coyote.trw.com> Reply-To: jeff@aiai.UUCP (Jeff Dalton) Organization: AIAI, University of Edinburgh, Scotland Lines: 39 In article <27B8222F.3C70@wilbur.coyote.trw.com> jay@wiley.UUCP (Jay Nelson) writes: >In article <4092@skye.ed.ac.uk> jeff@aiai.UUCP (Jeff Dalton) writes: >>My question is this: is it really the case that CAR and CDR are >>normally replaced by FIRST and REST in current programming practice? >>How about COND, for which the claim has also been made? > >My preference is always to use the operator which conveys the intent >of the code. When dealing with lists, I use FIRST and REST. If for >some reason I am using a cons cell, I use CAR and CDR. Well, there I disagree. I don't mind using FIRST and REST, and agree that they are sometimes clearer, but I see nothing wrong with considering CAR and CDR as list operations. I think there is a residual prejudice against CAR and CDR even within the Lisp community, because they were originally derived from the names for parts of a machine work on the IBM 704 (I think that was it). Some critics of Lisp, and even people who are teaching Lisp as a language that is "strange", will say that CAR and CDR stand for "contents of address register" and "contents of decrement register". They are confusing the origin of a term with its meaning. >I don't understand the comment about COND. I use WHEN and UNLESS for >single case instances, IF when I want two outcomes, and COND when a >sequential set of conditions must be evaluated that doesn't fit the CASE >construct. That's more or less what I do too. But some people claim that COND is not used except in "old fashioned" code. The suggestion seems to be to use nested IFs instead. Even though COND is just about the hardest thing in Lisp to read, I don't think nested IFs are always a good alternative. On the other hand, if established practractice really is moving away from COND, I'd like to know that. Contrariwise, if the textbooks that claim COND is obsolete are wrong, I'd like to know _that_. -- Jeff