merits of Lisp vs Python

Alex Mizrahi udodenko at users.sourceforge.net
Sun Dec 10 12:23:44 EST 2006


(message (Hello 'Paul)
(you :wrote  :on '(10 Dec 2006 04:36:43 -0800))
(

 ??>> so, it's very close to writting new interpreter -- but it's order of
 ??>> magnitude easier to write this interpreter via macros than from
 ??>> scratch, most other language constructs can be reused.

 PR> But now you've got an interpreter and you no longer have that Lisp
 PR> compiler.

why do you think so?
if you have C compiler that translates C to assembly, and then compiles 
assembly to machine language -- that's not C compiler, not asm compiler, or 
what?
yes, possibly it would be sub-optimal, but at least it will work. and 
normally there would be no big performance penalties.

 ??>> there is a chapter about continuations in Paul Graham's "On Lisp".
 ??>>
 ??>> "Common Lisp doesn't provide call/cc, but with a little extra effort
 ??>> we can do the same things as we can in Scheme. This section shows how
 ??>> to use macros to build continuations in Common Lisp programs."

 PR> I think he's mistaken about being able to implement call/cc in full
 PR> generality with CL macros in any reasonable way.

why do you think so?
you know some case that does not work with call/cc?
i was programming quite significant working system with call/cc in Common 
Lisp.
and although there were some glitches, it was doing quite well.

 PR>   But it might be possible to implement enough to do something like
 PR> Python generators using lexical closures that one re-enters through
 PR> some kind of cond statement selecting the yield point to be continued
 PR> from.

why are you theoretizing -- i've showed working real example of generators!
just get SBCL and ARNESI, load it, and then use call/cc as i've shown in 
example. that's real generators. there's no need for any cond -- you can 
save state as current-continuation.
if you don't understand how it works, run macroexpand -- it's quite simple 
thing.
you can find full defgenerator code here

http://www.cl-user.net/asp/Mi4$4/sdataQvxM$sStWNjUDQ3t9G8X8yBX8yBXnMq=/sdataQu3F$sSHnB==

you can find also other implementations of defgenerator's -- but with 
ARNESI's CPS call/cc works with LOOP (that's actually surprising -- since 
loop uses TAGBODY/GO -- maybe their code walker mutates TAGBODY making it 
functional-style, or something like that).

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"People who lust for the Feel of keys on their fingertips (c) Inity") 





More information about the Python-list mailing list