
Femtolisp: A lightweight, robust, scheme-like Lisp implementation - lelf
https://github.com/JeffBezanson/femtolisp
======
cultus
The parser of the Julia compiler is written in this dialect. It just goes to
show how much power you have in a small package with lisps.

~~~
marmaduke
You mean, how much you can develop during a PhD on scientific computing with a
known technical computing syntax and paradigm on top of a modular compiler
infrastructure with an enthusiastic community?

(Not to detract from Julia devs but there were plenty of Lisp based contenders
ready for scientific computing before so its useful to ask why Julia why now
etc )

*edit: this was kinda snarky but I actually meant a compliment on the excellent strategic choices Julia devs made as compared to other scientific computing attempts

~~~
ddragon
I'll go and say that, outside of the great work from the creators in the
development and marketing of the language, the main difference between those
Lisp based languages and Julia in terms of attracting people is the syntax.
Julia focuses on being approachable to Python, R, Fortran and Matlab
programmers (since those already "won" by the time Julia was created), and it
wouldn't be able to convince any significant number of those to even check the
language without looking like Python, R, Fortran and Matlab (even when S-expr
is indeed more elegant and powerful). Julia base syntax is closer to how
people write math, so it's more familiar even to people who are not dedicated
programmers which were part of Julia's target audience.

And when people discover the lispiness in Julia which is a thin layer below
the surface syntax (such as the metaprogramming system and multiple dispatch)
they at least already gave the language a fairer chance. Other languages that
borrowed from Lisp but didn't go, to different degrees, with s-expr like Scala
and Clojure (plus R) also had success in the data science/ML area. Hopefully
Nim also gets a foothold, and possibly Racket with optional infix syntax.

~~~
flavio81
>the main difference between those Lisp based languages and Julia in terms of
attracting people is the syntax

Yes, and this is practically the only thing that I find wrong with Julia,
besides the lack of the interactivity of CL.

It's like populism -- an inferior syntax choice taken just to attract the
Pythonistas.

~~~
chrispeel
I guess you mean you prefer prefix rather than infix notation. Do you have any
specific technical reasons for this?

~~~
jacobwilliamroy
I dislike operator precedence, and I also think that putting all the plus
signs in between the addends is a waste time.

I like being able to do this:

    
    
      (+ 1 2 3 4 5)

~~~
eigenspace
Great news: you never need to use an infix operator in julia. All infix
operators are also regular functions, so

    
    
        1 + 2 + 3 + 4 + 5 
    

is actually the same as

    
    
        +(1, 2, 3, 4, 5)
    

though there's still commas between the arguments.

~~~
jacobwilliamroy
Yeah, those commas are going to drive me crazy. LISP has ruined me.

~~~
eigenspace
I mostly got used to them, but I do enjoy playing around with
[https://github.com/swadey/LispSyntax.jl](https://github.com/swadey/LispSyntax.jl)
for more directly lispy sytanx in Julia.

~~~
jacobwilliamroy
>REPL mode Lisp Mode initialized.

>Lisp Mode

I wish every language had Lisp Mode, haha

~~~
eigenspace
Agreed. Not all languages are powerful enough to offer a lisp mode that'd be
sufficiently lispy though. The whole point of LispSyntax.jl is that it's lisp
_syntax_ while still respecting julia semantics, which are basically just lisp
semantics.

Of course, LispSyntax.jl still has some glaring omissions that someone should
really get around to implementing.

------
rcarmo
Oh, goody, another tiny LISP (I've been keeping track of them at
[http://taoofmac.com/space/LISP](http://taoofmac.com/space/LISP), will add
this one ASAP).

~~~
fovc
You should quote the README from this one:

"""

Almost everybody has their own lisp implementation. Some programmers' dogs and
cats probably have their own lisp implementations as well. This is great, but
too often I see people omit some of the obscure but critical features that
make lisp uniquely wonderful. These include read macros like #. and
backreferences, gensyms, and properly escaped symbol names. If you're going to
waste everybody's time with yet another lisp, at least do it right damnit.

"""

~~~
rcarmo
Great idea, done!

------
papaf
I like the "tiny" version that has a minimal lisp written in C and then builds
upon that with this bit of magic:

[https://github.com/JeffBezanson/femtolisp/blob/master/tiny/s...](https://github.com/JeffBezanson/femtolisp/blob/master/tiny/system.lsp)

~~~
phyrex
You may also enjoy Clojure's core.clj:
[https://github.com/clojure/clojure/blob/master/src/clj/cloju...](https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj)

------
akkartik
_" Bytecode is first-class, can be printed and read, and is human readable
(the representation is a string of normal low-ASCII characters)."_

Anyone know where I can read more about the VM and its human-readable syntax?
I'm not immediately spotting it in the repo.

~~~
KenoFischer
It's not really documented, but human readable, may also not really mean what
you think it means. For example, here's a snippet from the printed bytecode of
the default system image:

    
    
          #fn("8000r1e0~|[316>0\x7fM~|[i2i343;];" [closure?])] find-in-f)
          #fn(";000r2c0~|}q3c1tg66I0c2e3c4c5e6g63132c73241;c8;" 
        [#fn("8000r0c0c1~\x7fq2i2322^;" [#fn(for-each)
          #fn("8000r1~M|\x7f_43;" [])]) 
        #fn("6000r1|F16B02|Mc0<16802|\x84c1<680e2|41;c3|41;" [thrown-value
    

It's human readable in the sense that all the operations have single character
ascii opcodes and strings are embedded as is and there's no raw pointers, etc,
so you won't get mojibake, but it's not human readable in the sense of say a
pretty-printed IR.

------
Skunkleton
The Readme for this repo is very well written. It makes me think that the rest
of the project is worth checking out.

~~~
dnautics
the "rest of the project", at this juncture in programming history anyways,
turned out to be "the Julia programming Language".

~~~
Skunkleton
Google seems to indicate that femtolisp is used for some portion of Julia's
implementation, and didn't evolve into Julia itself?

~~~
StefanKarpinski
Yes, but the author of femtolisp is one of the co-creators of and single most
prolific contributor to Julia. Spiritually, that is the successor project.

------
arexxbifs
I came to read about the lisp implementation, but I stayed for the "cutef8"
pun among his other repos.

