Wayne Brehaut wrote:
...
> For learning DSA it's more important to have a clear, well-written and
> well-documented implementation in a language of interest (again,
> especially, the core language in one's programs) than just "using" or
> even inspecting and trying to learn subtle details of some p
On Thu, 28 Sep 2006 17:32:06 +0200, Fredrik Lundh
<[EMAIL PROTECTED]> wrote:
>Ramon Diaz-Uriarte wrote:
>
>> Going back to the original question, a related question: does anybody
>> know why there are so few books on data structures and algorithms that
>> use Python?
>
>Probably because Python has
On Thu, 28 Sep 2006 17:23:25 +0200, "Ramon Diaz-Uriarte"
<[EMAIL PROTECTED]> wrote:
>Going back to the original question, a related question: does anybody
>know why there are so few books on data structures and algorithms that
>use Python?
>
>I remember that, at least ~ 12 years ago there were man
MonkeeSage wrote:
> > def cons(car,cdr): return (car,cdr) # or [car,cdr]
> > def car(cons): return cons[0]
> > def cdr(cons): return cons[1]
>
> I guess you were talking about implementing the _structure_ of lisp
> lists in python syntax (as you seem to imply), not trying to emulate
> their _behav
Dennis Lee Bieber wrote:
> On 28 Sep 2006 21:17:38 -0700, "MonkeeSage" <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
> (Coming in from the cold)
>> I guess you were talking about implementing the _structure_ of lisp
>> lists in python syntax (as you seem to imply), not
Dennis Lee Bieber wrote:
> Though if this suddenly inspires the creation of a Common LISP
> interpreter written in Python, I may want to close my eyes
Hehe! I actually thought of trying that once, but I realized that I'm
too stupid and / or lazy to pull it off. ;)
Regards,
Jordan
--
http
sturlamolden wrote:
> Thus I stand by my original claim. Essentlially:
>
> def cons(car,cdr): return (car,cdr) # or [car,cdr]
> def car(cons): return cons[0]
> def cdr(cons): return cons[1]
I guess you were talking about implementing the _structure_ of lisp
lists in python syntax (as you seem to i
At Thursday 28/9/2006 12:23, Ramon Diaz-Uriarte wrote:
Going back to the original question, a related question: does anybody
know why there are so few books on data structures and algorithms that
use Python?
I remember that, at least ~ 12 years ago there were many (and very
good) books that use
On 9/28/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Ramon Diaz-Uriarte wrote:
>
> > Going back to the original question, a related question: does anybody
> > know why there are so few books on data structures and algorithms that
> > use Python?
>
> Probably because Python has "better than textbo
Brendon Towle wrote:
> ? (cons )
>
> returns a single level list, with as its new first item, and
> the original contents of as the remainder of the list. The
> OP's code doesn't do that; it returns a list of two items, with
> as the second item.
That is equivalent, as is the remainder of t
sturlamolden wrote:
> Remember that O(1) is not neccesarily faster than O(N)! Unless your
> linked list is very big, you will get something called a 'cache miss'
> inside your CPU. Thus it is usually more efficient to work with dynamic
> arrays.
This was a bit ackwardly formulated. What I was tr
sturlamolden wrote:
> I seem to remember that a cons joins two items, it doesn't grow a
> strait list.
http://www.lisp.org/HyperSpec/Body/fun_cons.html
"If object-2 is a list, cons can be thought of as producing a new list
which is like it but has object-1 prepended."
--
http://mail.python.
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 ar
On 28 Sep 2006, at 12:45 PM, [EMAIL PROTECTED] wrote:
> From: "MonkeeSage" <[EMAIL PROTECTED]>
> Subject: Re: Questions on Using Python to Teach Data Structures and
> Algorithms
> To: python-list@python.org
>
> [snip]
> But Brendon's code also
Bruno Desthuilliers wrote:
> Brendon Towle wrote:
> > Some of your Lisp translations are subtly off...
>
> Seems correct to me. Lisp lists are linked lists, not arrays.
Actually, Brendon was correct. In lisp / scheme:
(cons 1 '(2 3)) -> (1 2 3)
(car '(1 2 3)) -> 1
(cdr '(1 2 3)) -> (2 3)
But Bre
Brendon Towle wrote:
> Some of your Lisp translations are subtly off...
>
>
>
>>Date: 28 Sep 2006 02:49:50 -0700
>>From: "sturlamolden" <[EMAIL PROTECTED]>
>>Subject: Re: Questions on Using Python to Teach Data Structures and
>> Algorit
Ramon Diaz-Uriarte wrote:
> Going back to the original question, a related question: does anybody
> know why there are so few books on data structures and algorithms that
> use Python?
Probably because Python has "better than textbook" implementations of
core structures, and "better than textboo
Brendon Towle wrote:
> On 28 Sep 2006, at 8:05 AM, [EMAIL PROTECTED] wrote:
>
>> From: Bruno Desthuilliers <[EMAIL PROTECTED]>
>>
>> Brendon Towle wrote:
>>> Some of your Lisp translations are subtly off...
>>
>> Seems correct to me. Lisp lists are linked lists, not arrays.
>>
>>>
From: "stur
Going back to the original question, a related question: does anybody
know why there are so few books on data structures and algorithms that
use Python?
I remember that, at least ~ 12 years ago there were many (and very
good) books that used Pascal for this topic. So when I did my own
search for o
[EMAIL PROTECTED] wrote:
> efrat:
[...]
>
>>then why was the name "list" chosen?
>
>
> I'd too love to know why the wrong "list" name was chosen for them,
> instead of "array". (Maybe because "list" is shorter, or because ABC
> called them "lists"...)
>
I suspect it's because of their intrinsic
On 28 Sep 2006, at 8:05 AM, [EMAIL PROTECTED] wrote:
> From: Bruno Desthuilliers <[EMAIL PROTECTED]>
> Subject: Re: Questions on Using Python to Teach Data Structures and
> Algorithms
> To: python-list@python.org
>
> Brendon Towle wrote:
>> Some of your Li
efrat wrote:
> I'm planning to use Python in order to teach a DSA (data structures
> and algorithms) course in an academic institute. If you could help out
> with the following questions, I'd sure appreciate it:
> 1. What exactly is a Python list?
It's almost exactly what the doc says (and exa
Brendon Towle wrote:
> Some of your Lisp translations are subtly off...
Seems correct to me. Lisp lists are linked lists, not arrays.
>
>> Date: 28 Sep 2006 02:49:50 -0700
>> From: "sturlamolden" <[EMAIL PROTECTED]>
>> Subject: Re: Questions on U
Some of your Lisp translations are subtly off...
> Date: 28 Sep 2006 02:49:50 -0700
> From: "sturlamolden" <[EMAIL PROTECTED]>
> Subject: Re: Questions on Using Python to Teach Data Structures and
> Algorithms
> To: python-list@python.org
>
> If you w
efrat wrote:
> 1. What exactly is a Python list? If one writes a[n], then is the
> complexity Theta(n)? If this is O(1), then why was the name "list"
> chosen? If this is indeed Theta(n), then what alternative should be
> used? (array does not seem suited for teaching purposes.)
A Python list is
efrat wrote:
> Hello,
>
> I'm planning to use Python in order to teach a DSA (data structures
> and algorithms) course in an academic institute. If you could help out
> with the following questions, I'd sure appreciate it:
(snip)
> 2. Suppose I have some file example.py, and I'd like to incorp
In <[EMAIL PROTECTED]>, efrat wrote:
> 1. What exactly is a Python list? If one writes a[n], then is the
> complexity Theta(n)? If this is O(1), then why was the name "list"
> chosen?
Why not? It has all the methods one expect from an abstract data type
"list". It's not the O() behavior but t
efrat wrote:
> 1. What exactly is a Python list? If one writes a[n], then is the
> complexity Theta(n)? If this is O(1), then why was the name "list"
> chosen? If this is indeed Theta(n), then what alternative should be
> used? (array does not seem suited for teaching purposes.)
Indexing for pyth
efrat:
>1. What exactly is a Python list?
A dynamic array that can grow geometrically on the right.
>If one writes a[n], then is the complexity Theta(n)? If this is O(1),<
It is O(1).
>then why was the name "list" chosen?
I'd too love to know why the wrong "list" name was chosen for them,
i
Hello,
I'm planning to use Python in order to teach a DSA (data structures
and algorithms) course in an academic institute. If you could help out
with the following questions, I'd sure appreciate it:
1. What exactly is a Python list? If one writes a[n], then is the
complexity Theta(n)? If
Hello,
I'm planning to use Python in order to teach a DSA (data structures
and algorithms) course in an academic institute. If you could help out
with the following questions, I'd sure appreciate it:
1. What exactly is a Python list? If one writes a[n], then is the
complexity Theta(n)? If
31 matches
Mail list logo