Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site Shasta.ARPA
Path: utzoo!watmath!clyde!burl!ulysses!allegra!oliveb!Glacier!Shasta!andy
From: andy@Shasta.ARPA
Newsgroups: net.lang
Subject: Re: Re: Using LISP for scientific programming? (gasp!)
Message-ID: <1464@Shasta.ARPA>
Date: Sat, 26-Oct-85 05:16:50 EST
Article-I.D.: Shasta.1464
Posted: Sat Oct 26 05:16:50 1985
Date-Received: Sun, 27-Oct-85 10:34:10 EST
References: <1057@sdcsvax.UUCP> <1418@umcp-cs.UUCP> <2034@hcrvax.UUCP>
Distribution: net
Organization: Stanford University
Lines: 45

Peter Smith (HCS in Toronto) replies to the following with:
> 
> >   You should be aware that the SYMBOLICS 3600 fits 32bit floats directly
> >   in the pointer field of objects, so for single precision there is no 
> >   garbage.  Such a capability does seem to be essential for fast numerical
> >   analysis in lisp.
>
this fallacy.
>     I don't understand? Using the car or cdr field of a CONS cell as a 
> floating point number does not stop you from getting garbage because you
> still cannot operate on that location. If you do you will change it's value
> everwhere that it is referenced (LISP avoids copying lists if possible)
>

Lisp doesn't avoid copying lists "whenever possible", it copies iff
you "tell" it to (by your choice of functions).

Suppose (setq x (cons 1 (cons 'b 'd))), (setq y (cdr x)),
(setq z (car x)), and (setq w (cons 1 y)).

Independent of the number representation, (rplacd a 3) does not
change w or z's value.  (rplaca (cdr x) 'b) changes (car y) and
(cadr w) because w, x, and y share that structure.

The immediate representation for short integers (and single precision
floats?) used by Symbolics and others is equivalent to encoding the
number's value as a pointer.  (The values of these special "pointers"
are very similar to a convenient number representation.) In other words,
there is only one "pointer" to 1.  The result of (+ 1 2) is a one of
these special "pointers".  I'm using "pointer" because the implementation
is smart enough to never dereference them; after all, the value that
the pointer points to is determined by the value of the pointer.  (Yes,
I'm saying that it adds a "pointer" to the number 3 and a "pointer" to
the number 6 and gets a "pointer" to the number 7.)

While there is only one "1", you can have lots of pointers to it (just
like any other structure).  In other words, Peter Smith's claims were
completely off-target; arithmetic doesn't have to cause garbage.
Immediate arithmetic (ie, on ""pointers") is just like normal lisp
arithmetic, except its faster and the range of numbers for which eq
is true for is larger.  (eq 1 (+ -1000 1001)) is guaranteed.

-andy

decwrl!Glacier!Shasta!andy goes to andy@sushi