Share your repls and programming experiences

← Back to all posts
##### λ — A delightfully hard to read esoteric language

I present to you a little language I made (with similarities to the λ-calculus) that I named "λ". The interpreter was whipped up in 63 lines of (un-minified) JS, so yes it's tiny. To give a quick feel for the language, here's a sample program that prints "Three times" three times to the console:

``````λ λ                       || ID

λλ λ y λ y λ y λλ          || Church numeral three

λ 3λ "Three times" 1λ     || Main``````

You can probably see why I named it "λ" — rather than all the nice clarifying details of standard lambda calculus, it primarily uses only the character "λ" and "y" (which looks like an upside-down λ). So, without further ado let me explain what the above program does:

1. We define a function that takes one argument (count the number of λ's) and returns it (everything after the first string of λ's is the body of the function). This is the identity function, it's good to define this in a program just to have it as a dummy value. `||` indicates a comment, everything after it on that line is ignored.
2. We define another function, which takes two arguments. It is defined as Church numeral three — namely, it takes a function and another function and applies the first function to the second three times. The `y` is akin to Haskell's `\$`: `λ λ λ λλ` is equivalent to `((λ λ) λ) λλ`, while `λ y λ y λ y λλ` is equivalent to `λ (λ (λ λλ)))`
3. We create the entry point of the program. The entry point takes one argument, which will be the identity function (this has nothing to do with the fact that we defined it first here, the entry point will always get passed the identity function regardless of the rest of the program). The body of the entry point is equivalent to `(λ3 "Three times") λ1`, which calls the function defined on line 3 (Church numeral 3) with the string function "Three times", and then calls the result of that with the function defined on line 1 (the ID function).

I say "string function" for a reason. Strings are merely here for debugging purposes — they are not values, the only value is a function (like the true λ-calculus). A string is just an instance of the identity function, with the side-effect of printing the string value to the console. So, if I call `"Three times"` with some value `x`, then it will print "Three times" to the console and return the value `x`. This means that our entry point will call "Three times" three times, so "Three times" will get printed three times.

Confusing yet? If so, great — this is an esoteric language, it's not supposed to make sense :D
Suggestions welcome! If anyone manages to make something useful with this, I will be surprised!

hotnewtop
firefish (949)
``````salmon apple "how bad is your memory"

salmon trout balloon x20

bananas also:
- salmon apple balloon
- salmon trout pancake balloon
- pancake exchange x20
- if not pancake:
- checkout``````
fuzzyastrocat (1850)

@firefish I've gone to the repl multiple times (each time you've said "le salmon apple"), you haven't been on and there's been no changes to the files. What are you trying to say??

firefish (949)

@fuzzyastrocat Which is better? Lambda or Salmon Apple?

fuzzyastrocat (1850)

@firefish Oh, lambda in my opinion. Way simpler, harder to code in.

firefish (949)

@fuzzyastrocat Yes, trying to write a simple program wears out your Control and V keys.

firefish (949)

@fuzzyastrocat Or shift and insert keys.
wait, dynamic squid's nightlang needed to have a compiled version for mac, but none of us have a mac, could you help?

fuzzyastrocat (1850)

@firefish Squid's making binaries for each platform?!?!? Just use a makefile

firefish (949)

@fuzzyastrocat He is, but what if some newbie just starting to learn night and doesn't know how to use CMake

fuzzyastrocat (1850)

@firefish You just type in "make" and the makefile does it all for you... that's the point of the makefile

firefish (949)

@fuzzyastrocat What if you are so dumb you don't even have cMake, better yet you're on Windows, where the only real support for CMake is Cygwin

fuzzyastrocat (1850)

@firefish Then you probably shouldn't be looking to use a very newly developed programming language.

firefish (949)

@fuzzyastrocat Imagine it's 2030 and Night isn't so new

fuzzyastrocat (1850)

@firefish Then everyone in this field should be smart enough to have some idea as to how to use `make`

firefish (949)

@fuzzyastrocat Er... Do you know why this is happening?

fuzzyastrocat (1850)

@firefish The Rust files are in a different directory right? `./src`? If so, you'll need to do `../main.son`.

FlaminHotValdez (694)

This is unbelievably hard to use but I love how hilarious it is. Here have a cycle

fuzzyastrocat (1850)

@maxyang Thanks, it was designed that way :D (And thanks for the cycle!)

EpicGamer007 (1736)

Makes Tutorial: How to build a programming language in less than a 100 lines with simple js!

fuzzyastrocat (1850)

@EpicGamer007 Ha! I once made a lang in one line of Python, it was a nightmare but in the end it worked :D

EpicGamer007 (1736)

@fuzzyastrocat , send link plezz, that seems really cool

fuzzyastrocat (1850)

@EpicGamer007 No problem.
Repl.it shows it has an error, ignore that since it will run fine. (It uses some metaprogramming with `globals.update`, which repl.it doesn't know how to handle.)

Coder100 (18241)

pog `|| comment`

fuzzyastrocat (1850)

@Coder100

``λ "pog" λ || prints "pog" to the console``
fuzzyastrocat (1850)

@Coder100 Lol I hadn't seen that yet, that's funny

Coder100 (18241)

lol we have the same comments @fuzzyastrocat

fuzzyastrocat (1850)

@Coder100 Splits by spaces, except inside strings. Removes empty sections.

fuzzyastrocat (1850)

@Coder100

was whipped up in 63 lines of (un-minified) JS

I'm bound to use some weird regex with that as a qualification :)

fuzzyastrocat (1850)

@Coder100 If I'm trying to do something small, and it's in nodeJS, there's a high chance that I'm going to use some really weird regex for some random reason.