Re: Clojure on PyPy

2012-08-27 Thread Dax Fohl
Wow I can't believe my silly question actually led to a whole independent project! On Friday, February 10, 2012 9:36:53 AM UTC-6, tbc++ wrote: I have some set of algorithms that needs such-and-such operations to be as fast as possible. Can I create a VM that is tailored for that? Yes, this

Re: Clojure on PyPy

2012-02-10 Thread Timothy Baldridge
I have some set of algorithms that needs such-and-such operations to be as fast as possible. Can I create a VM that is tailored for that? Yes, this is basically what PyPy does for Regexes, they have a custom regex engine that has can_enter_jit in it. So basically what you get is a jitted regex

Re: Clojure on PyPy

2012-02-09 Thread kovas boguta
This article on RPython and PyPy is pretty good, helped me understand what the fuss is about: http://tratt.net/laurie/tech_articles/articles/fast_enough_vms_in_fast_enough_time Pretty cool stuff. Will clojure-py allow us to write our own VM's using clojure? On Mon, Nov 28, 2011 at 9:23 AM,

Re: Clojure on PyPy

2012-02-09 Thread Timothy Baldridge
Will clojure-py allow us to write our own VM's using clojure? TL/DR: yes Long version: RPython simply is a restriction on what bytecodes can do in a given set of branches in a python program. So the cool thing about RPython is, you define a main(argv[]) function, and then point the PyPy

Re: Clojure on PyPy

2012-02-09 Thread kovas boguta
This stuff is amazing. The big question for me is how this relates to macros. This sounds like a metaprogramming ability, where instead of changing the source code, you are changing the implementation layer. Here is a concrete use case I'm interested in: optimizing algorithms. I have some set of

Re: Clojure on PyPy

2012-02-09 Thread kovas boguta
Another question: can multiple VMs live inside the same process boundary? So that code in VM1 (clojure-py) can call code in VM2 (pypy) with no overhead. There is also a third case, intermediate between optimizing vms for algorithms and optimizing for full blown languages. Think about

Re: Clojure on PyPy

2011-11-28 Thread Timothy Baldridge
IMO better to hack on VMKit (llvm) than to start a new one atop of PyPy. Seeing as VMkit is a method level jit, and PyPy creates tracing JITs, basing a JVM off of VMKit to run clojure on it kindof defeats the whole purpose. Timothy -- “One of the main causes of the fall of the Roman Empire

Re: Clojure on PyPy

2011-11-27 Thread Alexander Kellett
On Thursday, November 17, 2011 5:09:49 PM UTC+1, tbc++ wrote: I also felt that sticking with the official Java implementation of Clojure would be more practical. It would certainly be fun to put Clojure on PyPy, though. There is one insanely off-the-wall idea I've been thinking about

Re: Clojure on PyPy

2011-11-22 Thread Dhananjay Nene
On Tuesday, 22 November 2011 12:26:54 UTC+5:30, Andrzej wrote: On 11/22/2011 02:10 PM, Timothy Baldridge wrote: So I got thinking about clojure pypy tonight, and got thinking how easy it would be to adapt my old code to run as a interpreter. So I pulled in a few files, implemented a few

Re: Clojure on PyPy

2011-11-21 Thread Timothy Baldridge
requirement, FFI, and a bunch of support routines. Or we can simply say slurp can only read from files, which means now you just create a doc of ways clojure-pypy differs from clojure-jvm. In some ways, this is why I'm in favor of going with a clojure-python translator. There would be a small impact

Re: Clojure on PyPy

2011-11-21 Thread Nick Zbinden
I was thinking about this too. I don't really need Clojure-on-pypy but I want to learn and understand the pypy project. I think that pypy is an extreamly cool project and I want to learn more about it and it would be fun to implment Clojure (and I would finally learn python). The problem Timothy

Re: Clojure on PyPy

2011-11-21 Thread Timothy Baldridge
I just don't like the workflow of compiling everything. If I want to use clojure on the comandline i want to write clojure-pypy mytool.cljp. Does this seam resenable? I was thinking about starting this rather soon. For me it would be a research type project (at least at first). Would anybody

Re: Clojure on PyPy

2011-11-21 Thread Brent Millare
-pypy differs from clojure-jvm. I specified that we could be looser on what we define Clojure to meet. So I was hinting at implementing in a manner similar to ClojureScript, where we simply define the lisp primitives and deftype/defprotocol. We wouldn't have to implement slurp in rpython, we

Re: Clojure on PyPy

2011-11-21 Thread Timothy Baldridge
So I got thinking about clojure pypy tonight, and got thinking how easy it would be to adapt my old code to run as a interpreter. So I pulled in a few files, implemented a few methods, and I have prototype running (+ 1 2) as interpreted lisp code. I slapped it up on github...it's ugly, but it's

Re: Clojure on PyPy

2011-11-21 Thread Andrzej
On 11/22/2011 02:10 PM, Timothy Baldridge wrote: So I got thinking about clojure pypy tonight, and got thinking how easy it would be to adapt my old code to run as a interpreter. So I pulled in a few files, implemented a few methods, and I have prototype running (+ 1 2) as interpreted lisp code

Re: Clojure on PyPy

2011-11-17 Thread Brent Millare
Couple of clarifications. My main point is the maturity of the JVM, so when comparing what is presented in the article (which isn't much), it can do what is listed. That's not to say the converse isn't true, that PyPy's JIT can do things the JVM can't do. Like I said, there are a lot of

Re: Clojure on PyPy

2011-11-17 Thread Timothy Baldridge
I also felt that sticking with the official Java implementation of Clojure would be more practical.  It would certainly be fun to put Clojure on PyPy, though. There is one insanely off-the-wall idea I've been thinking about recently, however: 1) Implement a full JVM in PyPy using GNU

Re: Clojure on PyPy

2011-11-17 Thread Gary Poster
On Nov 17, 2011, at 10:45 AM, Brent Millare wrote: ...The main point the poster should take away is the lack of any library/runtime tools, you have to build from the ground up many things you take for granted when targeting the JVM. I've thought about Clojure on PyPy too. My thought

Re: Clojure on PyPy

2011-11-17 Thread Timothy Baldridge
every single function is a object. Now look at PyPy or JS, here functions are true values in the VM. So the best way to implement Clojure in PyPy would be to take advantage of these facilities. But then you're really re-defining what clojure is and how it runs. PyPy has a very advanced JIT that works

Re: Clojure on PyPy

2011-11-17 Thread Gary Poster
On Nov 17, 2011, at 11:09 AM, Timothy Baldridge wrote: I also felt that sticking with the official Java implementation of Clojure would be more practical. It would certainly be fun to put Clojure on PyPy, though. There is one insanely off-the-wall idea I've been thinking about recently

Re: Clojure on PyPy

2011-11-17 Thread dmiller
On Nov 17, 10:07 am, Timothy Baldridge tbaldri...@gmail.com wrote: With the clojureclr for example, it supports pretty much everything clojure does sans java, and gains all the .net interop. True...true, it supports it, but it's still a 2nd class citizen. For instance, we don't have

Re: Clojure on PyPy

2011-11-17 Thread Timothy Baldridge
Although implementing Clojure-in-Clojure no doubt should be done, that does not make lein work on other platforms, Very true. But what it does do is abstract away the core elements of Clojure. ISeq, IPersistentList, PersistentList, etc. are all cross platform. All you need is a emit-class

Clojure on PyPy

2011-11-16 Thread Dax Fohl
Would Clojure have anything to gain by having something like PyPy's JIT-generator create a custom JIT for it, a'la http://morepypy.blogspot.com/2011/04/tutorial-part-2-adding-jit.html? Or does the JVM already do the stuff that is mentioned in that article? (Or does none of that stuff apply to

Re: Clojure on PyPy

2011-11-16 Thread Brent Millare
The JVM is an advanced, mature JIT compiler. PyPy's generated JIT compilers are not as mature. As a result, the JVM does many of the things in the article and more. From what I see, the benefits of Clojure targetting PyPy would be exploring the performance advantages of very experimental work

Re: Clojure on PyPy

2011-11-16 Thread Timothy Baldridge
. And in some cases, PyPy can generate code faster than hand-written C code. So all that to say, yes, I think there's a lot of potential in PyPy, but translating Clojure to it is no small task. And even when you're done, you're still in the same boat as Clojure-CLR and ClojureScript...no matter how