LispY C
github.com
github.com
It was created to facilitate using all of the scientific libs in C++ by a chemistry professor for the creation of molecules [2]. It's a big codebase. I'll have to look at LispY C, since on first impression it seems smaller, and I like C!
[1] https://github.com/drmeister/clasp [2] https://github.com/drmeister/clasp
I'm not sure how well known it is, but some Lisps can be statically compiled to machine code.
But one thing I've wondered about is how good can it get? Are there any benchmarks for Lisp vs. C?
That's a full Scheme that compiles to C. It's quite nice, too!
C was a third language for me in the day, and I like Lisps, so this Lispy-C thing is going to eat my afternoon up!
An interesting way to cite K&R.
Tests are specified as part of the definition, run at compile time, and if they fail no executable is produced.
{define
"list#"
permutations
[|l|
(if (null? l)
['()]
[{let permutations ((l l))
(if (null? l)
[(list '())]
[(flatmap [|x| (map [|y| (cons x y)]
(permutations (remove x l)))]
l)])}])]
;;; tests
(satisfies?
permutations
'(
(() ())
((1) ((1)))
((1 2) ((1 2)
(2 1)))
((1 2 3) ((1 2 3)
(1 3 2)
(2 1 3)
(2 3 1)
(3 1 2)
(3 2 1)))
))}
https://github.com/billsix/bug> The way that LISP/c works is sort of tricky. It utilizes a lot of string manipulation and interpretation. It doesn't need to be insanely fast, though, because it's just dealing with code; the compiled result will not suffer from any slowness.
In other words, it seems that this project just allows you to generate C code from a LISP-like syntax, but doesn't allow you to `eval` during the execution of the resulting C program. There is no runtime representation of code as data as with other lisps.
That said, the only difference between a struct and a class is that struct member defaults to public, and class members default to private.
In C++ land, this would be true.
C doesn't let you write methods within structs. C structs don't even have inheritance. No virtual table is generated. There is no single-dispatch mechanism.
And, for people who refuse to let go of curly braces, there's this shameless plug: https://github.com/eudoxia0/cmacro
I found it so pleasant writing C in S-expr that I gradually rewriting my C code with it.
For me, using Pre-Scheme to write graphics kernels was great fun, and produced decently fast code :)
I think VLISP is, as well. VLISP (not the French one from the 80s, the other one, though the French one was interesting in its own right [1]), was a verified Scheme implementation written in a verified version of Pre-Scheme. Sweet research project, but I haven't seen any public releases of it :/
There are some papers about both here: http://library.readscheme.org/page8.html
[1]: http://www.artinfo-musinfo.org/en/issues/vlisp/index.html
VLISP was a precursor to Le-Lisp [2], which was massively popular and influential in Europe, and could run faster on commodity hardware than Lisp Machine Lisp on the Symbolics 3600.
[2]: http://lelisp.org/ (under construction, but with some useful links for the time being).
France was actually a hotbed of Lisp across the pond and, along with the UK, pretty invested in a European standard for Lisp, first EuLisp (which was an excellent language but somehow flopped unfortunately) and ISLISP (an ISO standard that's not so excellent -- basically a crippled version of Common Lisp -- and also pretty much flopped). I've been in talks with some of the Le-Lisp guys about the possibility of open-sourcing Le-Lisp now that it's no longer commercially viable -- fingers crossed! :)
P.S., if anyone from INRIA happens to be reading this: pretty please?? Jérôme agrees! :)