HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
clojure-scheme: Compiling Clojure to Native Code via Scheme

Nathan Sorenson · InfoQ · 86 HN points · 0 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention Nathan Sorenson's video "clojure-scheme: Compiling Clojure to Native Code via Scheme".
Watch on InfoQ [↗]
InfoQ Summary
Nathan Sorenson discusses clojure-scheme, a ClojureScript compiler that translates Clojure code to Scheme code, showing how to compile this Schemified Clojure code to raw C or run it on iOS.
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
Aug 20, 2013 · 86 points, 25 comments · submitted by takeoutweight
Also don't forget about Clojure-c, which recently got fairly good iOS / Android bindings:

Fascinating! We use Clojure heavily, but the JVM is sometimes a bit of a headache-inducer in our environment (especially w.r.t. its eager gobbling of memory), so I'm always excited to see new potential runtimes/backends for Clojure.
I love it when several incredible technologies come together to allow things you wouldn't think possible. Take this thing over there, stir in some of that, and boom, you've got a working project that is crazy full of potential. Great work Nathan.

Really, when I think about it, it's why I love the world of programming.

This is great, especially since it removes the TCO limitation from running on the JVM. I will definitely give this a try.
I don’t know much Clojure, but I thought that lack of TCO was not a problem because you can just manually add `recur` ( when you need it. Are there situations where `recur` doesn’t work but tail-call optimization would help?
The quick answer is: mutually recursive functions. True TCO doesn't grow the stack when F calls G calls F again.
In my talk I use a finite state machine as an example of something that can really benefit from proper tail calls. In this case, the difference between proper tail calls and loop/recur is the difference between "compiling" the FSM and running the FSM in an interpreter loop.
Also in this space is Tim Baldridge's mjolnir project, which generates native code directly from Clojure using LLVM. It looks very promising, although there haven't been any commits in the last few months.
There's also other jvm lisps that you give you natives too. Kawa scheme (native chicken,bigloo,racket). Armed bear common lisp (native sbcl,clisp).
I'm interested in this, but why not just write natively in Scheme? I really like Clojure, but if you don't need the Java interop, Scheme seems just as nice.
For one thing, one might get interoperability with clojure libraries (at least those that aren't just wrappers around java libraries). For another thing, clojure has some nice language features and I'm all for supporting multiple lispy dialects on top of various compiler/runtime environments. My personal wish is to have clojure running on SBCL with trivial interoperability between common lisp and clojure code.
Clojure was initially implemented on cl. You should be able to find the lisp version in the history of the repo somewhere. Might be an interesting starting point.
> Clojure was initially implemented on cl.

Really? I thought Clojure evolved out of Rich's never-finished CL-subset-on-JVM implementation.

I'm pretty sure this is wrong.

Rich originally made two other JVM/lisp hybrids, one was running java code inside CL, the other was CL on the JVM. [1]

Clojure originally targeted the JVM and CLR, but AFAIK, one of the main motivators was always to run on a major platform.

He did not made any Lisp/JVM hybrids. More like foreign object interfaces to Java and .net.

One was a Lisp(Works) FFI to Java (jfli) and the other was a generalized version of that (foil).

I have seen too the early sketch of Clojure in CL.

Look here:

Right, I didn't mean to imply that jfli and foil were new languages.

I didn't realize there was a CL version of the compiler, cool! Thanks for the link.

Clojure running on SBCL seems like a no-brainer. I do not know why this does not exist. SBCL is super high-performance and the underlying lisp semantics should be a perfect fit.
Clojure is intended to be a hosted language. Building on and providing first class access to a rich ecosystem of libraries and tools was an explicit goal.
If one already knows Clojure, the value is obvious: you don't need to learn a new language.

It's also of course debatable that scheme is "just as nice", so you can imagine there are people who, other things being equal, prefer Clojure.

Certainly. As I said, I like Clojure, but I'd be happy to be able to program in Scheme as well. I guess the history of LISP should have told me that not all people who like one LISP necessarily don't mind using another.
Clojure has a much stronger polymorphism story than Scheme. This makes sense as Clojure was designed to live in an OO host language. Practically this could mean, say, much cleaner Objective-C interop.
For developers interested in a Lisp that cooperates with Objective-C (and C), I always recommend Nu --
> Clojure has a much stronger polymorphism story than Scheme

Many Schemes have their own OO implementations and they all support polymorphism.

Clojure polymorphism not= OO polymorphism
Scheme is great, but I think there are several key features that clojure has that scheme doesn't provide by default, including (but not limited to):

- Persistent Hash-Trie based Data Structures

- Beautiful asynchronous constructs

- Multimethods

- Protocols

Obviously I in no way intend to discredit scheme, nor start a lisp flamewar :) /sidenote I love this article comparing a game written in 4 lisp dialects (

HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.