Mark Tarver <[email protected]> writes:
> Ah; so this
>
> def cons (x,y):
> return [x] + y
>
> is not accurate?
Depends what you mean by accurate!
in lisp, if you do:
(setq a '(1 2))
(setq b (cons 0 a))
(rplaca a 3)
Then
a is now (3 2)
b is now (0 3 2)
In Python, if you do:
a = [1, 2]
b = cons(0, a) # with your definition of cons
a[0] = 3
Then
a is now [3, 2]
b is now [0, 1, 2]
So in this respect, it is not accurate. But that's because Python lists
are vectors not conses.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list