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


Groups > comp.lang.python > #7953

Re: Python and Lisp : car and cdr

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python.': 0.04; 'subject:Python': 0.06; "shouldn't": 0.07; 'pm,': 0.10; 'def': 0.12; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'wrote:': 0.14; '(b,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'furman': 0.16; 'lisp': 0.16; 'lisp,': 0.16; 'ryan': 0.19; 'header :In-Reply-To:1': 0.21; 'subject: : ': 0.26; 'message- id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; '(as': 0.29; 'array': 0.30; 'sun,': 0.30; 'equivalent': 0.31; 'represents': 0.32; 'someone': 0.33; 'to:addr:python-list': 0.33; 'list': 0.33; 'lie': 0.35; 'else': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.37; 'but': 0.38; 'linked': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'system.': 0.39; 'either': 0.39; 'list,': 0.39; 'to:addr:python.org': 0.39; 'units': 0.65; 'series': 0.66; 'wish': 0.70; 'advantages': 0.77; '10:56': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=S8d+OlKEpDSptjwEN1jB3xydgbwxEwh6YeQjR7hofoE=; b=aswj7O7ipAfF2cg3wshpGxJHmi58ZneAyMlPBwhfTJAgAzsmRQhqmsfSO0Wq9tzR43 G54OXQxH3rGe4hieqBHvD8+zFW+CLEyA2di/mrjTtU/q33ll+Y9onAxUDuLioqB4sIjT X82qmIYmnQ5l8qOKpgp4lMj4Z2BAk5NrApfwY=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=xo1ZSmY0ur9PRrZY3r8BRL8BfLgOtOiWkv0dgK9k7V09xxsrvb8UGQtApzmO8dGwxg YFXYWbYc7ntGY8HIgthwBEd9i2J2xFrzCayo1r1XBhQtsTzCdbXOzz3wzve++fnWNksx 0MkwCmEzHL1UMpcmovuo+CbPtNA9kXXnPucZw=
MIME-Version 1.0
In-Reply-To <4DFDF1FB.3050907@stoneleaf.us>
References <franck-58760D.16453817062011@news.free.fr> <4dfd90de$1@dnews.tpgi.com.au> <4DFDF1FB.3050907@stoneleaf.us>
Date Sun, 19 Jun 2011 23:23:10 +1000
Subject Re: Python and Lisp : car and cdr
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.146.1308489800.1164.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 82.94.164.166
X-Trace 1308489800 news.xs4all.nl 49044 [::ffff:82.94.164.166]:44320
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7953

Show key headers only | 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