Xref: utzoo comp.lang.scheme:1166 comp.lang.lisp:2916 Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!att!cbnewsc!lgm From: lgm@cbnewsc.ATT.COM (lawrence.g.mayka) Newsgroups: comp.lang.scheme,comp.lang.lisp Subject: Re: Correct LisP (was Re: in defense of C) Message-ID: <14343@cbnewsc.ATT.COM> Date: 13 Mar 90 14:05:37 GMT References: <12572711825024@AIDA.CSD.UU.SE> Reply-To: lgm@cbnewsc.ATT.COM (lawrence.g.mayka,ihp,) Organization: AT&T Bell Laboratories Lines: 32 In article <12572711825024@AIDA.CSD.UU.SE> D89.JOHNNY-BILLQUIST@AIDA.CSD.UU.SE (Johnny Billquist) writes: >The correct argument to CAR and CDR is *not* lists, but >s-expr (punctuated pairs to be specific). The fact that most >(if not all) LisPs implement lists by punctuated pairs >is a feature you should not rely upon. That is why the >functions FIRST and REST exists. Sure, they do just CAR >and CDR, but what if you stumles upon a LisP which implement >lists in another way? If you should do it *really* right, >CAR and CDR should not be able to work on lists at all, >however convenient it might be. Your argument is conceptually appealing, and well describes my own programming practice: I use FIRST and REST for the ubiquitous list, and reserve CAR and CDR for intentional dotted pairs (such as the constituents of an association list). Formally, however, I must quote "Common Lisp: the Language - Second Edition": p. 415: "FIRST is the same as CAR, SECOND is the same as CADR..." p. 416: "REST means the same as CDR but mnemonically complements FIRST." Apparently the connection between dotted pairs and lists is deeply ingrained into Common Lisp. Lawrence G. Mayka AT&T Bell Laboratories lgm@ihlpf.att.com Standard disclaimer.