Brendon Towle wrote:

> > def cons(a,b)
> >    return [a,b]
>
> should be:
>      return [a].extend(b)

I seem to remember that a cons joins two items, it doesn't grow a
strait list. A lisp list is a special case of a binary tree. How would
you build a tree structure with your cons? I think you are wrong here.

> > def car(structure)
> >    return structure[0]
> >
> > def cdr(structure)
> >    return structure[1]
>
> should be:
>      return structure[1:]

With your cons yes. With mine no, as there is only two elements in each
array aka "cons cell".

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to