i like in depth optimisation posts like this post. however it starts by expressing disagreement with the statement that idiomatic common lisp is much faster than idiomatic clojure, but in the end doesnt do much to dispell this. all it does is it shows how much in depth knowledge of clojure and jvm you need in order to still be slower than a very simple implementation in common lisp. i myself am quite new to common lisp, and comming from the machine learning and scientific computing background, i am VERY impressed by its speed, interactiveness, and just general neatness of programming. i don't think there exists a language that comes close to this. i wish there were more members from ml and scientific community involved in the common lisp community. in fact there is one person in the clojure community who i would love to try common lisp: https://dragan.rocks/
That's a fair criticism, but indulge this hypothetical, if you will:
- assume the sliding window transducer existed in the standard library (there's an open jira for it)
- assume the programmer is not an expert, but is familiar with stuff like boxed maths in Clojure, which isn't hard to work around, well documented [1], and has a known performance impact
- assume the programmer will avoid using `last`
- assume the programmer is comfortable using transducers
In short, that the transducer exists and the programmer has at least 6 months of experience programming in Clojure full time.
Will you consider the resulting implementation complicated, in depth or non idiomatic? There's always the possibility I'm just used to it so it comes naturally to me, but as the title suggests, I consider the result, before dropping down to arrays, way more idiomatic than the initial implementation.
I don't begrudge CL's speed and implementation, it's the readiness with which Clojure is dismissed as being slow with only surface familiarity with it.
While I write almost all my code in Nim nowadays, lisps have a special place in my heart despite not having written large amounts of lisp code.
I'm a physicist and when checking out CL in the past, it didn't feel like scientific computing was a huge thing in CL. You intrigue me with your post though. Do you have any resources for me to check out?
my background is also in physics and mathematics. in fact i think common lisp is well suited to a physicist-hacker type mindset. i could probably write a lengthy blog post about why i think this could be, but some of the key appeal factors are:
* unmatched interactive development which could be used for exploration of problems such as dynamical and complex systems
* although it is a very high level language you can perform low level optimizations in common lisp itself
* extremely powerful macro system that allows you to develop in a declarative style to reflect your problem domain. for example you can program in a syntax that is natural to general or special relativity, quantum mechanics, etc.
* fast and free implementations such as SBCL
* the language is standardized so your code will not need to be unnecessarily maintained (this is good for university professors that have repeating long-running courses)
i am not sure what type of references you are asking for but i will list few open source projects that might be interesting to you:
* CLASP - common lisp implementation build on top of LLVM. this project is headed by a computational chemist (prof. schafmeister) [0]
* PetaLisp - for HPC [1]
* MAGICL - Matrix Algebra proGrams In Common Lisp by Rigetti Computing [2]
* Quil - quantum instruction language developed on top of common lisp [3]
* CL-CUDA - use NVIDIA CUDA in Common Lisp programs [4]
* MGL - Common Lisp machine learning library [5]
* Maxima - a computer algebra system developed in common lisp [6]
i think these are plenty to show that there exists serious interest in using common lisp for scientific computing. it is possible that some of the people behind these projects are on HN and maybe they can further expand on this
Don't forget Lush: Lisp Universal SHell[1] by none other than Yann LeCun, and this was back in 2004. I played with it in 2012 or so. Lisp, SBCL, is great for science. I am playing with April, a subset of APL in Lisp. The best of both worlds!
Comments
i like in depth optimisation posts like this post. however it starts by expressing disagreement with the statement that idiomatic common lisp is much faster than idiomatic clojure, but in the end doesnt do much to dispell this. all it does is it shows how much in depth knowledge of clojure and jvm you need in order to still be slower than a very simple implementation in common lisp. i myself am quite new to common lisp, and comming from the machine learning and scientific computing background, i am VERY impressed by its speed, interactiveness, and just general neatness of programming. i don't think there exists a language that comes close to this. i wish there were more members from ml and scientific community involved in the common lisp community. in fact there is one person in the clojure community who i would love to try common lisp: https://dragan.rocks/
That's a fair criticism, but indulge this hypothetical, if you will:
- assume the sliding window transducer existed in the standard library (there's an open jira for it)
- assume the programmer is not an expert, but is familiar with stuff like boxed maths in Clojure, which isn't hard to work around, well documented [1], and has a known performance impact
- assume the programmer will avoid using `last`
- assume the programmer is comfortable using transducers
In short, that the transducer exists and the programmer has at least 6 months of experience programming in Clojure full time.
Will you consider the resulting implementation complicated, in depth or non idiomatic? There's always the possibility I'm just used to it so it comes naturally to me, but as the title suggests, I consider the result, before dropping down to arrays, way more idiomatic than the initial implementation.
I don't begrudge CL's speed and implementation, it's the readiness with which Clojure is dismissed as being slow with only surface familiarity with it.
[1] - https://insideclojure.org/2014/12/15/warn-on-boxed/
While I write almost all my code in Nim nowadays, lisps have a special place in my heart despite not having written large amounts of lisp code.
I'm a physicist and when checking out CL in the past, it didn't feel like scientific computing was a huge thing in CL. You intrigue me with your post though. Do you have any resources for me to check out?
my background is also in physics and mathematics. in fact i think common lisp is well suited to a physicist-hacker type mindset. i could probably write a lengthy blog post about why i think this could be, but some of the key appeal factors are:
* unmatched interactive development which could be used for exploration of problems such as dynamical and complex systems
* although it is a very high level language you can perform low level optimizations in common lisp itself
* extremely powerful macro system that allows you to develop in a declarative style to reflect your problem domain. for example you can program in a syntax that is natural to general or special relativity, quantum mechanics, etc.
* fast and free implementations such as SBCL
* the language is standardized so your code will not need to be unnecessarily maintained (this is good for university professors that have repeating long-running courses)
i am not sure what type of references you are asking for but i will list few open source projects that might be interesting to you:
* CLASP - common lisp implementation build on top of LLVM. this project is headed by a computational chemist (prof. schafmeister) [0]
* PetaLisp - for HPC [1]
* MAGICL - Matrix Algebra proGrams In Common Lisp by Rigetti Computing [2]
* Quil - quantum instruction language developed on top of common lisp [3]
* CL-CUDA - use NVIDIA CUDA in Common Lisp programs [4]
* MGL - Common Lisp machine learning library [5]
* Maxima - a computer algebra system developed in common lisp [6]
i think these are plenty to show that there exists serious interest in using common lisp for scientific computing. it is possible that some of the people behind these projects are on HN and maybe they can further expand on this
[0] https://github.com/clasp-developers/clasp
[1] https://github.com/marcoheisig/Petalisp
[2] https://github.com/quil-lang/magicl
[3] https://github.com/quil-lang/quilc
[4] https://github.com/takagi/cl-cuda
[5] https://github.com/melisgl/mgl also https://github.com/melisgl/higgsml
[6] https://maxima.sourceforge.io/
Don't forget Lush: Lisp Universal SHell[1] by none other than Yann LeCun, and this was back in 2004. I played with it in 2012 or so. Lisp, SBCL, is great for science. I am playing with April, a subset of APL in Lisp. The best of both worlds!
[1] http://lush.sourceforge.net/
[2] https://github.com/phantomics/april