Clasp: Common Lisp using LLVM and C++ for Molecular Metaprogramming
Google TechTalks8 HN recommenders · recommended in 8 months, 2015–2024
talk · intermediate · evergreen · 2015–2024 on HN
Christian Schafmeister's Google Tech Talk on designing spiroligomer molecules and building Clasp, a Common Lisp on LLVM that interoperates with C++, to program molecular design. It covers the chemistry, automatic differentiation for force fields, and how the…
HN repeatedly cites it as a striking example of Common Lisp used to push the frontier of science, and as one of the most inspiring tech talks.
Up next
2 mo on HNMonads and Gonads
Google TechTalks
2 HN recommender · 2013–2022
2 mo on HNWhy is this number everywhere?
Veritasium
2 HN recommender · 2024–2026
1 mo on HNMargin Call Best Quote by Will Emerson
chrislaucn
1 HN recommend · 2020–2024
2 mo on HNDavid Mitchell on Tax Avoidance from The Last Leg
Political News
2 HN recommender · 2017–2025
2 mo on HNClasp: Common Lisp using LLVM and C++ for Designing Molecules
Google TechTalks
2 HN recommender · 2016–2022
3 mo on HNThe Hyperbolic Geometry of DMT Experiences (@Harvard Science of Psychedelics Club)
Qualia Research Institute
3 HN recommender · 2021–2023
1 mo on HNEscape from the Heap: Low-Level Programming in Common Lisp
Arthur Gleckler
1 HN recommend · 2016–2020
2 mo on HNRuby on Rails demo
tenthconcept
2 HN recommender · 2013–2025
18 mo on HNRuby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich
Confreaks
17 HN recommender · 2013–2026
14 mo on HNThe Soul of Erlang and Elixir • Sasa Juric • GOTO 2019
GOTO Conferences
16 HN recommender · 2019–2024
14 mo on HN"Simple Made Easy" - Rich Hickey (2011)
Strange Loop Conference
14 HN recommender · 2022–2026
13 mo on HN"Making Impossible States Impossible" by Richard Feldman
elm-conf
9 HN recommender · 2017–2026
12 comments from Hacker News
The most inspiring talk a I have ever seen: Clasp: Common Lisp using LLVM and C++ for Molecular Metaprogramming. ABSTRACT This talk describes our unique approach to constructing large, atomically precise molecules (called "Molecular Lego" or "spiroligomers") that could act as new therapeutics, new catalysts (molecules that make new chemical reactions happen faster) and ultimately to construct atomically precise molecular devices. Then I describe Clasp and CANDO, a new implementation of the powerful language Common Lisp. Clasp is a Common Lisp compiler that uses LLVM to generate fast machine code and it interoperates with C++. CANDO is a molecular design tool that uses Clasp as its programming language. Together I believe that these are the hardware (molecules) and the software (the CANDO/Clasp compiler) that will enable the development of sophisticated molecular nanotechnology. ▶ this video
▶ this video This talk is even better. "C++ templates are to Commmon Lisp macros what IRS tax return forms are to poetry". I don't know both well enough to tell if it's true, but damn it's a good metaphor.
Lisp is programmable programming language, especially Common Lisp. It works as programmer amplifier. Better you are, more you benefit from it. I challenge anyone to watch this lecture from Christian Schafmeister and say they are not impressed: ▶ this video and link
Unrelated to VR but still: if anyone here hasn't yet watched drmeister's talk about Clasp and his "molecular metaprogramming" project, please do. Absolutely fascinating stuff. ▶ this video Also recently discussed on HN: link
So no one will mention the Clasp (Lisp on LLVM developer)? He built a language to build better, albeit not visualize, better molecules. If you are on this article, you probably will love to watch this guy. I am computer nerd and this guy makes me want to go back and study chemistry. ▶ this video
CLASP is a really interesting project. For one, it's created and written by a Chemistry PhD researcher (Christian Schafmeister), not someone with a traditional CS background. For another, it's one of the few languages that has ever attempted to interface with C++ at the template level - you can instantiate C++ template classes from CL, and catch C++ exceptions etc. For yet another, he does compacting garbage collection for the C++ objects used in the CL implementation, with pointer patching and everything else. There's a nice Google Tech Talk about it [0], that goes into both why he did this, and how he implemented this. [0] ▶ this video
That was my interest when I started my career, but didn’t do much on it. Bio-informatics deals with the stuff you mentioned in-silico. There’re a whole bunch of libraries for many different languages, but I’ve not come across any specific language for bio-informatics. You might find ▶ this video interesting, they developed a DSL in common lisp to generate C++ code using LLVM.
If you're asking yourself what kinds of problems is a Lisp good for you should probably watch this: ▶ this video (A computational chemist built himself his own Common Lisp implementation because no other language available was powerful enough for his needs...) It basically boils to: if you're solving a truly new and interesting problems for which the current libraries and ecosystems don't matter that much to you anyhow (because what you do is too bleeding-edge / ahead of everyone else, so you'll write your own better stuff anyhow), than you might want to choose a Lisp. And if your problem is so bleeding-edge and exotic that you also need to build your own programming-language for it, than you might just as well build yourself a Lisp (like the guy in the video did) and add your needed features to it, because this would be easier than any other approaches and allow you to spend more time on your problem and not on the language... EDIT+: another example is DWave using SBCL: link - if quantum (or analog... anyway...) computing is not "truly new and cutting edge", than I don't know what is
Fun fact: LEaP’s original author, Christian Schafmeister, went on to create a Common Lisp implementation that uses C++ and LLVM for applications in molecular nanotechnology: ▶ this video
Ah, related to #clasp: ▶ this video Clasp: Common Lisp using LLVM and C++ for Molecular Metaprogramming link 2018 LLVM Developers Meeting: C. Schafmeister lessons Learned Implementing Common Lisp with LLVM link Clasp: Common Lisp using LLVM and C++ for Designing Molecules link Modular Polymer Catalysts - Chris Schafmeister link 10S6P4 Christian Schafmeister 2010 UNTT 3rd Annual Conference Session 6 Presentation 4
Common Lisp traditionally favors other forms of interoperability: with Assembler, C, C++, Objective-C, UNIX/POSIX, etc... For example one prefers to directly call old-fashioned GTK+, Cocoa or Windows - instead of calling via a Java UI layer or a Javascript library. Common Lisp has interoperability with the JVM in various forms (from FFIs to ABCL, a Common Lisp on JVM implementation), but it's not a popular choice. There are several CL implementations with deep C integration, for example by compilation to C. CLASP has deep C++ and LLVM integration. Some implementation can create shared libraries which are being loaded from other programs. CLASP: ▶ this video It's possible to bring Common Lisp on top of runtimes like the JVM or Javascript - but there is some larger mismatch, because Common Lisp (different from Clojure) a platform independent full programming language. For example Common Lisp specifies a numeric tower with bignums, some float types, complex numbers and rational numbers. JavaScript internally does only offer floats. Common Lisp also specifies its own object system, which does not map well on top of the JVM (single inheritance, non-dynamic) or JavaScript.
I was thinking about this the other day. How can I expose my Common Lisp code to Julia. 1. You could take the Clasp path by exposing CL to C++. ▶ this video This means taking / writing a CL in Julia. 2. Julia has an AST representation written in femtolisp. So it would be in interesting target for CL or some glue middle language like Shen. link link