From: Eliot Handelman
Subject: Setf on NTHCDR?
Date: 
Message-ID: <13456@idunno.Princeton.EDU>
In MACL 2.0, I discovered by accident, you can write this:

(SETQ MY-LIST '(1 2 3))

(PUSH :THING (NTHCDR 3 MY-LIST))

and wind up with MY-LIST

=> (1 2 3 :THING)

In Lucid (latest release) you can't. I find this extremely useful behavior
if you want to insert something into a list without consing garbage:
Franz Lisp (the free one that came with vaxen) used to have"insert"
which I think did more or less the same thing (or was it more like
CL's MERGE?).

I don't have my manuals with me (you need a truck to drive these things
around these days) but as far as I remember NTHCDR has no SETF method.
I'm wondering why not, given that (PUSH :THING (CDR (CDR (CDR MY-LIST))))
is CL as is (PUSH :THING (NTH 3) MY-LIST). Is that an oversight of Lucid
or what?
From: Barry Margolin
Subject: Re: Setf on NTHCDR?
Date: 
Message-ID: <1991Aug23.220900.9723@Think.COM>
In article <·····@idunno.Princeton.EDU> ·····@phoenix.Princeton.EDU (Eliot Handelman) writes:
>In MACL 2.0, I discovered by accident, you can write this:
>
>(SETQ MY-LIST '(1 2 3))
>
>(PUSH :THING (NTHCDR 3 MY-LIST))

First of all, you shouldn't do this with constants.  It would be safer if
you had done

(setq my-list (list 1 2 3))

>and wind up with MY-LIST
>
>=> (1 2 3 :THING)
>
>In Lucid (latest release) you can't. I find this extremely useful behavior
>if you want to insert something into a list without consing garbage:
>Franz Lisp (the free one that came with vaxen) used to have"insert"
>which I think did more or less the same thing (or was it more like
>CL's MERGE?).
>
>I don't have my manuals with me (you need a truck to drive these things
>around these days) but as far as I remember NTHCDR has no SETF method.
>I'm wondering why not, given that (PUSH :THING (CDR (CDR (CDR MY-LIST))))
>is CL as is (PUSH :THING (NTH 3) MY-LIST). Is that an oversight of Lucid
>or what?

Since, as you said, CLtL doesn't say that NTHCDR should be SETFable, this
is simply an MCL extension.  Genera also has this extension.  Lucid just
didn't happen to think of implementing this extension.  I'd say that it was
an oversight of the original Common Lisp designers, and perhaps also X3J13,
for not including SETF of NTHCDR in the specification.  If you want it, I
suggest you send your suggestion to Lucid.
-- 
Barry Margolin, Thinking Machines Corp.

······@think.com
{uunet,harvard}!think!barmar