Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7953

Re: Python and Lisp : car and cdr

References <franck-58760D.16453817062011@news.free.fr> <4dfd90de$1@dnews.tpgi.com.au> <4DFDF1FB.3050907@stoneleaf.us>
Date 2011-06-19 23:23 +1000
Subject Re: Python and Lisp : car and cdr
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.146.1308489800.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Jun 19, 2011 at 10:56 PM, Ethan Furman <ethan@stoneleaf.us> wrote:
> Lie Ryan wrote:
>> def cdr(L):
>>    return L[1]
>
> IANAL (I am not a Lisper), but shouldn't that be 'return L[1:]' ?

In LISP, a list is a series of two-item units (conses).

>> L = (a, (b, (c, (d, None))))

This represents the LISP equivalent of [a, b, c, d] in Python. A list
is a linked list, not an array (as in Python).

IANAL either though, someone else may wish to clarify the advantages
of this system.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python and Lisp : car and cdr Franck Ditter <franck@ditter.org> - 2011-06-17 16:45 +0200
  Re: Python and Lisp : car and cdr Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-17 09:29 -0600
  Re: Python and Lisp : car and cdr Nobody <nobody@nowhere.com> - 2011-06-18 15:34 +0100
  Re: Python and Lisp : car and cdr Lie Ryan <lie.1296@gmail.com> - 2011-06-19 16:00 +1000
    Re: Python and Lisp : car and cdr Ethan Furman <ethan@stoneleaf.us> - 2011-06-19 05:56 -0700
      Re: Python and Lisp : car and cdr Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-19 13:24 +0000
        Re: Python and Lisp : car and cdr Terry Reedy <tjreedy@udel.edu> - 2011-06-19 12:20 -0400
          Re: Python and Lisp : car and cdr Teemu Likonen <tlikonen@iki.fi> - 2011-06-19 19:38 +0300
      Re: Python and Lisp : car and cdr Hrvoje Niksic <hniksic@xemacs.org> - 2011-06-19 16:26 +0200
    Re: Python and Lisp : car and cdr Chris Angelico <rosuav@gmail.com> - 2011-06-19 23:23 +1000
    Re: Python and Lisp : car and cdr "Elias Fotinis" <efotinis@yahoo.com> - 2011-06-19 16:24 +0300
    Re: Python and Lisp : car and cdr Ethan Furman <ethan@stoneleaf.us> - 2011-06-19 08:07 -0700
    Re: Python and Lisp : car and cdr Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-06-19 11:36 -0700

csiph-web