[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

&Rest Lists



    (defun foo (&rest x) ...)
    
    Should behave as if it were defined:
    
    (defun foo (&rest G0047)     ;Gensym really
      (let ((x (copy-list G0047)))
         ...))
    
    I think this fully and precisely specifies the semantics of &Rest.
    
    Chris Eliot

I couldn't disagree more. This implementation prohibits the
programmer from exploiting sharing of list substructure. It really
takes away some expressive power. One can get back the behavior
that you want with the transform you've outlined here.

Common lisp is not a functional language, it has tons of destructive
operations. It is out of character for such a language to prohibit
sharing of substructure by copying data structures implicitly. 
In general, when destructive operations are being used it should be the
programmer's responsibility to copy a data structure manually.

&REST should never cause copying of a list passed to it from APPLY.

...mike beckerle
GOLD HILL