Lumo – A fast, standalone ClojureScript REPL that runs on Node.js and V8
anmonteiro.com
anmonteiro.com
Crazy idea: if I wanted to implement Clojure on top of the ErlangVM, where should I start?
It's also not clear to me wether the Erlang VM provides what Clojure needs to efficiently implement its user-defined types, protocols, etc
That said, a Clojure-like dialect of lisp built on Erlang is a fine idea and, as others have said, I would probably start by seeing how the Lisp-Flavoured-Erlang (LFE) guys built their lisp.
Also, JVM is great. :)
...but hey, don't take my word for it:
The net result is that the prospects for Clojure going forward are
very good. The core model of Clojure has held up well and continues to
appeal - accessible, robust, thread-safe, efficient dynamic functional
programming, on a world-class infrastructure, with a huge set of
libraries. Oh yeah, and it's great fun!
- Rich Hickey, 2008
https://groups.google.com/forum/#!topic/clojure/2CA_H58Cbo0This talk should go into a bit more detail about this: https://channel9.msdn.com/blogs/charles/emerging-langs-cloju...
Now that Clojure has a varied and excellent set of libraries of its own maybe some of this is less important, but not all (the ability to interact with existing Java systems is still very useful).
Uhm... I always thought it was meant to be a Lisp for JVM. Where did you get your information from?
Just wanted to say that Erlang vanilla is robust and has a great ecosystem. So Elixir builds itself on top of a solid foundation.
[0] http://lfe.io
Joxa (just like Clojure) is a Lisp1, thus maybe more apt http://joxa.org
I just prefer to pass around functions/closures as values, and being able to invoke them like any normal function, instead of having to call an helper `apply`/`invoke`/`call` function on them (depending on the language)
That's why I said: "maybe more apt"... if OP doesn't care at all about that difference, and it's not among the details that they'd want to replicate from Clojure, it's perfectly ok to ignore
In Common lisp to refer to a function as a variable you do (function f) or as (read-table) syntactic sugar #'f. You could easily use destructuring to write HOFs without funcall.
So instead of requiring people to write
(defun bad-map (f list)
"Maps function `f' over `list', inefficiently."
(when list (cons (funcall #'f (first list) (bad-map f (rest list)))))
(bad-map #'- '(1 2 3))
A hypothetical lisp-2 could just as well allow destructuring like this: (defun bad-map (#'f list)
"Maps function `f' over `list', inefficiently."
(when list (cons (f (first list) (bad-map #'f (rest list)))))
(bad-map #'- '(1 2 3))
The fact that higher order functions stick out a bit by the extra #' is not necessarily a bad thing IMO; it helps when reading unfamiliar code to know immediately what arguments are functions and which ones are just plain objects. (funcall #'f (first list) ...)
but (funcall f (first list)) ...
f is already a function object.We could write a macro for that or a new version of defun. Here just a macro lisp1fy:
(defmacro lisp2fy ((&rest calls) &body body)
`(flet (,@(loop for (f . args) in calls
collect `(,f ,args (funcall ,f ,@args))))
(declare (inline ,@(loop for (f . nil) in calls collect f)))
,@body))
(defun bad-map (f list)
"Maps function `f' over `list', inefficiently."
(lisp2fy ((f a))
(when list
(cons (f (first list))
(bad-map f (rest list))))))This means that Lisp-1 doesn't really fit anyway so why let it limit you?
https://en.wikipedia.org/wiki/Hash_array_mapped_trie http://infoscience.epfl.ch/record/64398/files/idealhashtrees...
You might do better to create a Lisp Flavored Haskell (if one hasn't been started already). I'm sure haskeller's would be offended by the idea, but it already uses HAMT.
I would look at retargeting the ClojureScript code generator. Clojure implements a lot of primitives in Java, but ClojureScript is largely written in Clojure and ClojureScript itself so should be easier to port.
[1] http://lfe.io/
It will not be easy, but I'm no expert. I'm also not sure why you'd really want that? Just to solve the long startup time?
Might I propose Cloxure ("clock-jur") as the language name? :)
I think you're underselling the tool for beginners like myself - it's not just a ClojureScript REPL, it's actually an executable which can run node.js scripts written in clojurescript.
For example, here's the typical node http server example: https://gist.github.com/anonymous/c14b2b57184c650d9f3ff0a9e1...
You can run it with lumo test.cljs
This project seems more suited to being able to write fast starting scripts in Clojurscript.
I was like "Clojure... V8, what?!"
Interesting nevertheless, but still confusing.
https://github.com/clojure/clojurescript/wiki/Differences-fr...
Every time Clojure comes up I can rely on you to appear and attack something about it (but never the core merits of the language, as far as I can recall.)
The time you are reporting is also not that 'fast'. Other tools start in a fraction of that time.
Edit: original comment mentioned sbcl and included sbcl repl start-up time.
'less slowest starting Clojure REPL of three'
Mentioning 'fastest' at a time of 3GHZ multicore machines with SSD and a duration of 0.1 seconds is just absurd. That's >100 million instructions just to start a language prompt and evaluating a symbol to itself. The Java version is even more absurd with around 1 billion instructions just to get a REPL...
A shell on a 1 MIPS DEC VAX 11/780 started faster, while the machine had a hundred users.