Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!hall From: hall@aplcen.apl.jhu.edu (Marty Hall) Newsgroups: comp.lang.lisp Subject: Re: Terminology and style (was Re: Question about INTERN) Message-ID: <1991Feb12.180213.18143@aplcen.apl.jhu.edu> Date: 12 Feb 91 18:02:13 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> Reply-To: hall@aplcen (Marty Hall) Organization: AAI Corp AI Lab, JHU P/T CS Faculty Lines: 52 In article <4092@skye.ed.ac.uk> jeff@aiai.UUCP (Jeff Dalton) writes: > >This is good advice, but unfortunately certain widely-used textbooks >do such things as (1) use EQUAL everywhere to avoid explaining the >difference between EQUAL, EQL, and EQ; (2) claim that SETQ (and CAR >and CDR) are "old fashioned" and seldom used. I confess to the "equal" sin in the early weeks of the AI classes I teach. Actually, I'm not sure it is such a terrible iniquity, as long as I admit the truth later on. Equally (:-), I have no qualms with an intro LISP text doing this in the early chapters in order to get the "big ideas" across without getting bogged down in the details. As to setq/setf for variables, I am ambivalent. Personally, I cannot break my pre-CL habit of using setq for variables. >My question is this: is it really the case that CAR and CDR are >normally replaced by FIRST and REST in current programming practice? I strongly prefer first/rest if what is being accessed can be best thought of as a list. My observation of colleagues on AI contracts I work on is that this appears to be the consensus. However, a cons doesn't have to be a list, and I have no objection to car/cdr when accessing trees, etc. Personally, I define my own accessor functions in such cases, but that is (to me) a perfectly reasonable argument for sometimes using car/cdr over the more mnemonic first, second, rest. A quick glance on my shelf shows only the following texts using first/rest for lists: Winston (_Lisp_, 3rd ed), Hasemer and Domingue (_Common LISP Programming for AI_), Norvig (_Paradigms of AI Programming_, upcoming) and Keene, if you count that (_O-O Programming in CL_). Using car/cdr is Charniak, et al (_AI Programming_), Tatar (_A Programmer's Guide to CL_), Touretzky (_CL: A Gentle Intro to Symbolic Computation_), Wilensky (_Common LISPcraft_) and Tanimoto (_The Elements of AI using CL_). >How about COND, for which the claim has also been made? I personally use "if" when there is a single "then" and possibly "else" clause, "cond" when I would need a progn or nested ifs. I tend to use when/unless also, but have no strong opinion on that. >Theer may be an sociologically interesting process here, one in >which practice is changed by describing it as having changed already >(assuming that programmers who learn Lisp from those texts go on to >program in the style they've been taught). This is a good point. - Marty Hall AI Lab, AAI Corporation and The Johns Hopkins University P/T CS Program