Will it be possible that implementing Clojure (or Clojure syntax) over SBCL(or Other fast Lisp)?

StackOverflow https://stackoverflow.com/questions/18221000

  •  24-06-2022
  •  | 
  •  

Pergunta

I've tried both SBCL and Clojure and found that I like the syntax of Clojure but it is very slow compared to SBCL for me. Are there any implementation of Clojure over SBCL or will it be possible?


I found https://github.com/ayrnieu/disclojure which can enlighten me. :-)

Foi útil?

Solução

Clojure is intended to target several backends. This is a side effect Clojure being a hosted language designed with the philosophy of embracing the host. It will never be the goal, for instance, to make the same code written for Clojure on the JVM run unmodified on, again for instance, the CLR. Substantial amounts of code are common between Clojure for the JVM and ClojureScript, which is a nice bonus.

It is currently stable for:

  • JVM
  • JavaScript/ECMAScript

Generally stable for:

  • CLR/.net

and I know of experimental builds for:

  • Python
  • C
  • Scheme
  • IOS (via Scheme)

More targets are showing up as interest and time intersect. If you would like to provide an implementation for your favorite Lisp, patches welcome! It would be advisable to base your implementation on the ClojureScript compiler as it best exemplifies the intended development methods for the compiler.

Outras dicas

While the previous answers stated the difficulties of hosting Clojure on different languages, there is one programming language which I think is interesting to look at: Shen. It has been designed with a minimal set of 45 primitive instructions, so that it will be easy to port to different languages. It currently runs under CLisp, SBCL, Clojure, Scheme, Ruby, Python, Java and Javascript. It seems that it's a mix of ML and Lisp, although I haven't programmed with it much.

It is possible but its unlikly that you will get much faster, then it is on the JVM.

If you want to speed it up maybe look into the more highspeed librarys build for clojure, like clojure data using low level JVM representations and stuff like that or write your own librarys that are faster.

Making clojure fast on the JVM is tricky but doable, probebly a much better bet then a port to SBCL.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top