Logix: Adding macros to Python
livelogix.net
livelogix.net
Python is close to something very, very good but not quite there. Logix in "Base Logix" mode seems to fix some of Python's problems while retaining its redeeming qualities.
If only a real Lisp would come along that had the leadership, library, community and documentation of Python.
Someone was asking for that just the other day. I was thinking myself that it would be pretty neat to write a Lisp dialect that compiled down to Python, and therefore you could get access to all the Python libraries, a decent VM, and also macros.
I've had trouble figuring out where to start, though. Would be a fun project.
Check out Bigloo Scheme...it compiles down to C, JVM and .NET bytecode. I've only had it compile down to C but it was really quick. I'll have to get the computer language shootout guys to add Bigloo to their benchmarks.
http://common-lisp.net/project/python-on-lisp/
The only thing is, I find CL a really baroque language. The issues have been touched upon by many, but CL just has many spots where due to being standardized 2 decades ago, it isn't really consistent.
Python for the most part is extremely consistent and the VM runs on any major OS (SBCL still has issues on Windows). Not to mention the language seems to be evolving naturally (Python 3).
That's the main reason I'd like to see a Lisp on Python.
That would be an incredibly bad idea. The implementation of SBCL (and CMUCL, upon which SBCL is based) is second to none--it has an optimizing compiler (available at runtime) with code-generation backends for architectures from x86 to MIPS; fantastic support for type inference, inline expansion, modular arithmetic, unreachable code deletion, constant folding, control optimization, generational garbage collection (doesn't python still use reference counts?)... amongst a bunch of other stuff.
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all...
Benchmarks are of course arbitrary, but no matter what way you dice things, SBCL is vastly superior to Python's crappy VM. In the case of the link above, over 10 times faster.
> That would be an incredibly bad idea.
And I'm just wondering...even with SBCL, why would it be an 'incredibly bad idea' to undertake such a project to convert a Lisp dialect to Python?
Well...what's the point of compiling Lisp into a language with a slower runtime? If you mean that you want it to compiel to something "pretty", well, the output of a compiler is generally not pretty. It's just meant to be used as opaque object code, not something for human consumption.
SBCL isn't a VM. It's a Lisp implementation with a compiler that generates native code.
Admittedly, many dynamic languages folks seem to find this concept odd. The idea that {dynamic typing, garbage collection, your favourite feature from ruby/python/perl/php} requires a VM unfortunately seems strongly ingrained.
Ok, I had started just that. It's called Boa Lisp. http://nearfar.org/code/boalisp/ http://nearfar.org/code/boalisp/README.txt
(sorry, site will be down for the next few hours)
OTOH, how are you? remember ugh2yay?
I'm already using matplotlib and scipy with CLisp, communicating through pipes. I can write (plot '(1 2 3)). The communication between the two is really not a speed concern. Most of the time, Lisp is not waiting for an answer, so on my dual core, the other core is handling it.
For all its power though, writing Python code in Common Lisp feels really clunky. I don't do it much. I wouldn't feel comfortable writing (funcall (dot somedict keys)) for instance. Macros can only help so much.
Edit: Unfortunately Logix seems to have been dead since 2005.