Re: python list handling and Lisp list handling

2009-04-27 Thread Daniel Stutzbach
On Fri, Apr 24, 2009 at 10:19 AM, Mark Tarver dr.mtar...@ukonline.co.ukwrote: but also says that their representation is implementation dependent. As far as I see this should mean that element access in Python should run in constant time. Now if so this is a boon, because generally When I

Re: python list handling and Lisp list handling

2009-04-26 Thread namekuseijin
On Apr 25, 4:34 am, Michele Simionato michele.simion...@gmail.com wrote: which has some feature you may like. For instance, there is a weak form of pattern matching built-in: head, *tail = [1,2,3] # Python 3.0 only! head 1 tail [2, 3] Good seeing yet another long time Perl feature

Re: python list handling and Lisp list handling

2009-04-26 Thread namekuseijin
On Apr 26, 1:31 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: That's because Python lists aren't lists. Surely you meant to say that Lisp lists aren't lists? It-all-depends-on-how-you-define-lists-ly y'rs, Yeah, the

Re: python list handling and Lisp list handling

2009-04-26 Thread Steven D'Aprano
On Sat, 25 Apr 2009 23:51:18 -0700, namekuseijin wrote: On Apr 26, 1:31 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: That's because Python lists aren't lists. Surely you meant to say that Lisp lists aren't lists?

Re: python list handling and Lisp list handling

2009-04-26 Thread J Kenneth King
Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Sat, 25 Apr 2009 23:51:18 -0700, namekuseijin wrote: On Apr 26, 1:31 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: That's because Python lists aren't

Re: python list handling and Lisp list handling

2009-04-25 Thread Mark Tarver
On 25 Apr, 05:01, Carl Banks pavlovevide...@gmail.com wrote: On Apr 24, 8:19 am, Mark Tarver dr.mtar...@ukonline.co.uk wrote: This page says that Python lists are often flexible arrays http://www.brpreiss.com/books/opus7/html/page82.html but also says that their representation is

Re: python list handling and Lisp list handling

2009-04-25 Thread Mark Tarver
What is different is the concept of all globals that reference G.  For example: a = [1, 2, 3] b = a a[0] = 0 print b [0, 2, 3] I see that Python had an id too ;). Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: python list handling and Lisp list handling

2009-04-25 Thread Michele Simionato
On Apr 25, 9:07 am, Mark Tarver dr.mtar...@ukonline.co.uk wrote: OK; I guess the answer to the question Assuming the following Python encodings, and ignoring questions of performance, would Python and Lisp lists then be observationally indistinguishable? i.e. would these then be fair

Re: python list handling and Lisp list handling

2009-04-25 Thread Paul Rubin
Mark Tarver dr.mtar...@ukonline.co.uk writes: Assuming the following Python encodings, and ignoring questions of performance, would Python and Lisp lists then be observationally indistinguishable? i.e. would these then be fair encodings? is a 'yes'. Any disagreement? I don't think it is

Re: python list handling and Lisp list handling

2009-04-25 Thread Michele Simionato
On Apr 25, 10:01 am, Paul Rubin http://phr...@nospam.invalid wrote: Mark Tarver dr.mtar...@ukonline.co.uk writes: Assuming the following Python encodings, and ignoring questions of performance, would Python and Lisp lists then be observationally indistinguishable? i.e. would these then be

Re: python list handling and Lisp list handling

2009-04-25 Thread Carl Banks
On Apr 25, 12:07 am, Mark Tarver dr.mtar...@ukonline.co.uk wrote: On 25 Apr, 05:01, Carl Banks pavlovevide...@gmail.com wrote: On Apr 24, 8:19 am, Mark Tarver dr.mtar...@ukonline.co.uk wrote: This page says that Python lists are often flexible arrays

Re: python list handling and Lisp list handling

2009-04-25 Thread Rhodri James
On Sat, 25 Apr 2009 08:07:19 +0100, Mark Tarver dr.mtar...@ukonline.co.uk wrote: OK; I guess the answer to the question Assuming the following Python encodings, and ignoring questions of performance, would Python and Lisp lists then be observationally indistinguishable? i.e. would these then

Re: python list handling and Lisp list handling

2009-04-25 Thread Mark Wooding
Mark Tarver dr.mtar...@ukonline.co.uk writes: But are Python lists also indistinguishable from conventional Lisplists for list processing. For example, can I modify a Python list non-destructively? No. Are they equivalent to Lisp lists. Can CAR and CDR in Lisp be thought of as def

Re: python list handling and Lisp list handling

2009-04-25 Thread Steven D'Aprano
On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: That's because Python lists aren't lists. Surely you meant to say that Lisp lists aren't lists? It-all-depends-on-how-you-define-lists-ly y'rs, -- Steven -- http://mail.python.org/mailman/listinfo/python-list

python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
This page says that Python lists are often flexible arrays http://www.brpreiss.com/books/opus7/html/page82.html but also says that their representation is implementation dependent. As far as I see this should mean that element access in Python should run in constant time. Now if so this is a

Re: python list handling and Lisp list handling

2009-04-24 Thread MRAB
Mark Tarver wrote: This page says that Python lists are often flexible arrays http://www.brpreiss.com/books/opus7/html/page82.html but also says that their representation is implementation dependent. As far as I see this should mean that element access in Python should run in constant time.

Re: python list handling and Lisp list handling

2009-04-24 Thread Paul Rubin
Mark Tarver dr.mtar...@ukonline.co.uk writes: But are Python lists also indistinguishable from conventional Lisplists for list processing. Forgot to add: you might look at http://norvig.com/python-lisp.html Mark Tarver dr.mtar...@ukonline.co.uk writes: But are Python lists also

Re: python list handling and Lisp list handling

2009-04-24 Thread Paul Rubin
Mark Tarver dr.mtar...@ukonline.co.uk writes: But are Python lists also indistinguishable from conventional Lisplists for list processing. For example, can I modify a Python list non-destructively? Are they equivalent to Lisp lists. Can CAR and CDR in Lisp be thought of as Python lists are

Re: python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
On 24 Apr, 17:19, Paul Rubin http://phr...@nospam.invalid wrote: Mark Tarver dr.mtar...@ukonline.co.uk writes: But are Python lists also indistinguishable from conventional Lisplists for list processing.   Forgot to add: you might look athttp://norvig.com/python-lisp.html Mark Tarver

Re: python list handling and Lisp list handling

2009-04-24 Thread Arnaud Delobelle
Mark Tarver dr.mtar...@ukonline.co.uk 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

Re: python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
On 24 Apr, 19:54, Arnaud Delobelle arno...@googlemail.com wrote: Mark Tarver dr.mtar...@ukonline.co.uk 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))    

Re: python list handling and Lisp list handling

2009-04-24 Thread Rhodri James
On Sat, 25 Apr 2009 00:32:26 +0100, Mark Tarver dr.mtar...@ukonline.co.uk wrote: OK; I think I get it. RPLACA and RPLACD are part of the id of Common Lisp which I rarely contemplate. However what it seems to be is that the difference is this. Lisp operates a destructive operation like

Re: python list handling and Lisp list handling

2009-04-24 Thread Carl Banks
On Apr 24, 8:19 am, Mark Tarver dr.mtar...@ukonline.co.uk wrote: This page says that Python lists are often flexible arrays http://www.brpreiss.com/books/opus7/html/page82.html but also says that their representation is implementation dependent. As far as I see this should mean that element