Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!bellcore!petrus!scherzo!allegra!princeton!orsvax1!pyrnj!caip!topaz!harvard!h-sc1!breuel From: breuel@h-sc1.UUCP (thomas breuel) Newsgroups: net.micro.amiga Subject: Re: shopping frustration Message-ID: <1029@h-sc1.UUCP> Date: Thu, 3-Apr-86 23:13:35 EST Article-I.D.: h-sc1.1029 Posted: Thu Apr 3 23:13:35 1986 Date-Received: Sat, 5-Apr-86 07:47:19 EST References: <5232@alice.uUCp> Reply-To: breuel@h-sc1.UUCP (thomas breuel) Organization: Harvard Univ. Science Center Lines: 45 |||one of the demos we did try was amigalisp 1.0. it at least could handle |||(cons 'a 'b), but had an infinite recursive loop when we attempted to |||execute (fib 2) (or (fib N) for N>1 for that matter) with fib defined |||as ||| |||(df fib (n) (cond ((zerop n) 1) ||| ((eq n 1) 1) ||| (t (plus (fib (sub1 n)) (fib (difference n 2)))))) || ||I have not played with AmigaLisp, but you should probably write ||'(equal n 1)' rather than '(eq n 1)'. Most Lisp implementations ||only guarantee atoms to be unique (your code would, however, work ||in Franz Lisp -- by what I would call a coincidence :-). | |until a few days ago i had not encountered a lisp in which eq did not |work on numbers. of maclisp, interlisp, uci-lisp, franz lisp, etc, and |amigalisp, i would say that amigalisp is broken. | |will someone out there who has amigalisp verify whether or not this indeed |is the problem? Well, if you type to your favourite, friendly Franz Lisp interpreter: > (eq 99999 99999) you'll get a 'nil' as an answer (at least I do, and that is what the documentation says should happen). The reason is that for the sake of efficiency, small integers in Franz are represented uniquely. If I recall correcly, the manual points out something like: if you know what you are doing, you can use 'eq' on numbers, otherwise use 'equal'. I would give you the same advice. 'eq' exists for two purposes: two compare symbols (NOT atoms), and to check whether two objects are identical (i.e. eq :-). For numbers, you don't want to know whether they are identical, (i.e. whether they are located at the same memory location) since you rarely alter the value of a number by setting the number itself! You want to know whether they are equal. Therefore, use 'equal'. It is also portable, and works. Altogether, AMIGALisp is NOT broken if (eq 1 1) fails. Thomas.