Ruby is also not far away :-)
Here's my code:
require 'time'
def f
a = []
100.times do
a.push "What do you know"
a.push "so long ..."
a.push "chicken crosses road"
a.push "fool"
end
b = a.uniq
b.each do |x|
puts x
end
e
Sorry, I did some miscalculation what a shame.
[EMAIL PROTECTED] wrote:
> Pebblestone:
>
> >I heard that python's list is implemented as adjustable array.
>
> Correct, an array geometrically adjustable on the right.
>
>
> >Here's my lisp implemen
p
103,631,952 bytes, 8,760,495 objects.
It seems A has consumed 74M bytes, 8bytes each cell. That make sense
because a cell in list consists of 2 pointers, (car cdr), and an mem
address is 32 bit.
[EMAIL PROTECTED] wrote:
> Pebblestone:
>
> >I heard that python's lis
Here's the result:
What do you know
fool
chicken crosses road
f elapsed: 1.26 seconds
f2 elapsed 2.11 seconds
[EMAIL PROTECTED] wrote:
> Pebblestone:
> > (defun test4 ()
> > (let ((a (make-array 400 :element-type 'string
> >
Oh, I forgot.
Your python's example (use direct index array index) of my
corresponding lisp code works slower than the version which use
'append'.
This let me think how python's list is implemented.
Anyway, python's list is surprisingly efficient.
[EMAIL PROTEC
seconds of real time
2.744172 seconds of user run time
0.136009 seconds of system run time
0 page faults and
74,540,392 bytes consed.
++
BTW, I couldn't install psyco on my system (ubuntu), gcc just prompt to
me thousands of lines of errors and warnings.
I tested in Common Lisp and compared the result with python.
My PC is: 3.6GH Pentium4
My OS is: Ubuntu 6.06 i386
My lisp implementation is SBCL 0.9.8 for i386
My python's version is: V2.4.3
Both implementations were installed via apt-get install.
Here's my Lisp program:
+