
Show HN: L2: An elegant untyped, unsafe, unhygienic programming language - murisitarusenga
https://github.com/murisi/L2
======
murisitarusenga
L2 is an experimental programming language that maps efficiently to machine
code (like C). I think it is interesting because I have not seen 1) control
flow primitives that are like Scheme's continuations but that are also
efficient 2) L2's variant of s-expressions that do not need a symbol or string
data type 3) a macro system that is equivalent to but operates differently
from Common Lisp's

~~~
fao_
As far as I know, scheme's continuations _are_ efficient. That's kind of the
basis of RABBIT, Orbit, and a chunk of Appel's work, isn't it?

(See also: [http://lambda-the-
ultimate.org/node/2406#comment-36369](http://lambda-the-
ultimate.org/node/2406#comment-36369))

~~~
shakna
As far as I can tell, L2's continuations look very similar to the Cheney on
the M.T.A. [0] approach to continuations.

[0]
[http://home.pipeline.com/~hbaker1/CheneyMTA.html](http://home.pipeline.com/~hbaker1/CheneyMTA.html)

~~~
murisitarusenga
Thanks for the link. I am not sure if I see the similarity. L2 neither uses
the heap nor garbage collection nor are its programs converted into
continuation-passing-style. Am I missing something?

------
pavlov
Is there a runtime at all? It seems to me there isn't.

Would it be unfair to say this is a Lispy evolution of the oldschool macro
assembler?

~~~
murisitarusenga
I'm not sure of the exact definition of a runtime... The best I can say is
that the instructions emitted by the compiler correspond directly to the
commands in the source file.

You are certainly correct about the Lispyness. I've not yet had the
opportunity to use a macro assembler, so I cannot say how similar L2 is to it.
To aid your comparison, I think L2 is also quite similar to B language.

------
andrewflnr
This is why I read HN.

------
pmarreck
So... Forth, basically. ;)

~~~
murisitarusenga
Though you jest, Forth did influence certain decisions in L2's design. In
particular, by using continuations you can make an L2 function temporarily
leave a variable amount of data at the top of the stack in order for the
caller or some other function to use.

------
_qc3o
I get all the other adjectives but where is the elegance?

~~~
dTal

      (function frst (l) [fst [rst [' l]]])
      (function frfst (l) [fst [rst [fst [' l]]]])
      (function frrst (l) [fst [rst [rst [' l]]]])
      (function frrrst (l) [fst [rst [rst [rst [' l]]]]])
      (function rfst (l) [rst [fst [' l]]])
      (function ffst (l) [fst [fst [' l]]])
      (function llst (a b c) [lst [' a] [lst [' b] [' c]]])
      (function lllst (a b c d) [lst [' a] [lst [' b] [lst [' c] [' d]]]])
      (function llllst (a b c d e) [lst [' a] [lst [' b] [lst [' c] [lst [' d] [' e]]]]])
      (function llllllst (a b c d e f g) [lst [' a] [lst [' b] [lst [' c] [lst [' d] [lst [' e] [lst [' f] [' g]]]]]]])
    

Don't you see? Elegant!

~~~
dkarapetyan
Indeed.

------
metaobject
Is there an abbreviation for "function"?

