Learn to Code via Tutorials on Repl.it!

← Back to all posts
LAMBDA Tutorial! [April Fools]
Th3Coder (136)


The most famous programming language ever is probably Python.

But do you know about Lambda programming?

If you said no, don't worry. That's because Lambda just got released this March (or February, I'll check it later) and you can barely find anything about Lambda in the internet. It's still very new.

Soo, let me make you one of the earliest Lambda programmers!

Anonymous Function

In Python, lambda is known as an anonymous function. Basically, you assign a variable to the keyword lambda, then type the values, a colon :, and its return variable!

For example:

square = lambda num : num * num
print(square(int(input("Number?")))) #Yes this is squished lol

Well, you would be surprised there is an entire programming language based on that!

That is Lambda.


As lambda is function-based, EVERYTHING must be inside a function (which is normally called main). Lambda programs are stored in .lmda formats.

Since our program has several lines, we need to use curly brackets {} and put code between them.

(Also, please note there is no Lambda annotation in Markdown, probably because it's still a new language)

main = lambda{
  ::Code here::

:: Then execute the main function::

Oh yeah, note that comments start and end with double colons ::.


We output using the keyword log (think about it as echo in PHP or Bash). However, log doesn't insert a new line after printing. For that, we use logn.

main = lambda{
  log "Hello"
  logn "World"
  log "!"
  : true
  ::We use true to return the result of the function as true. It means the code executed properly!::

The output will be:

Hello World


I'm sure you've heard of variables, so let's just continue.

You store variables just like in Python - no variable type declaration and no semicolon. Simply type the variable name, the equal sign =, and of course, the value!

Also, you can transform a variable type to another as you like!

Unfortunately, because of that, Lambda is quite slow.


main = lambda{
  variable = "value"
  number = -28
  log variable, number ::And yes, you can print multiple variable types in just 1 go. Wow!::
  : true


Getting User Input

For getting user input, we need to use the keyword fetch. We can assign variables to it, but it uses a slightly different syntax.

main = lambda{
  log "What's your favorite number?"
  fetch num ::And yes, you don't need to declare the num variable prior to inputting it!::
  log"Your favorite number:", num ::Of course, this outputs num::
  : true


If... Else

The if... else conditions in Lambda are just like in most languages. We put conditions inside normal brackets, then use curly brackets for the code to execute. The else if or elif or elseif (different in many languages) is called iff in Lambda.

main = lambda{
  log "Do you like coding?"
  fetch answer
  if (answer == "yes"){
    log "Great! Me too!"
  iff (answer == "no"){
    log "That's okay!"
    log "Please answer yes or no"
  : true



Just like the main function, you can make other functions as well!

For instance:

square = lambda num : num * num

main = lambda{
  num = 3
  sq = square(num) :: We have declared the function square which returns num squared. We can assign it to a variable like this!::
  log sq
  :: ...or immediately output it::
  log square(42)
  : true


Here, we declare a function square. Keep in mind since the function only has 1 line, we use the normal Python lambda syntax.


Changing Data Types

When we use the keyword fetch, Lambda automatically thinks that is a string (even though it could be an integer, float, or a boolean!)

We use the period . symbol, followed by the short names of the desired data types. I'll explain in the table below.

Data typesShorter names

Also, the char data type does not exist in Lambda. They are converted to strings automatically.


main = lambda{
  log "Give me a number: "
  fetch num1
  log "Give me another number: "
  fetch num2
  num1 = num1.int :: If we only use num1.int, it won't do anything. You can also type num1 = int!::
  num2 = int ::Shorter way::
  sum = num1 + num2
  log "The sum of your numbers is", sum
  : true


Special characters

If you want to insert quotations to your string, you can simply use the backward slash \ followed by the character like in other languages.

\nInserts new line
\tInserts new tab
\dDeletes previous character (only in Lambda)
\"Inserts double quotes
\'Inserts single quote
\\Inserts backward slash

Ending (I guess)

Well, that's it. Hope it helps, happy programming! :)

Be proud of yourself. You are now one of the first Lambda programmers...

...and happy APRIL FOOLS!

Edit: The Lambda programming language is purely fictional and was intended for April Fools'. You can use the idea if you're inspired to make your own language/prank though!

Happy late APRIL FOOLS.

Th3Coder (136)

Hello, I would like to clear things up, so there is no confusion.

Everything I typed above (except for the Python lambda function and the backward slash \ keywords) is purely fictional and was intended for April Fools, the day I typed this post.

If you've been fooled, I'm sorry. Feel free to unvote (or un-upvote) since this is just a prank. I honestly didn't even expect anyone to be fooled!

So, for @DynamicSquid and @IntellectualGuy , you can un-upvote this since this is a prank! Sorry both of you XD

Lastly, I will clarify if something is just a prank in future posts. I thought it was already clear as I typed

...and happy APRIL FOOLS!

at the end of the post.

Thanks for reading and I will clarify things in future pranks!

IntellectualGuy (852)

@Th3Coder Dang that was a good prank, you got me good! Maybe you could actually make this a programming language

DynamicSquid (5022)

@IntellectualGuy Wow that got me too! And yeah I agree, this could be a language lol!

Th3Coder (136)

@IntellectualGuy @DynamicSquid haha thanks! I would have to learn how to make a new language compiler though

DynamicSquid (5022)

Ooh, nice! Lambda isn't really a popular language, so it's cool seeing a tutorial on it!

IntellectualGuy (852)

very interesting, but I suggest adding more detail.

Th3Coder (136)

@IntellectualGuy okay! I just checked the date, it was February 27th.

Also, I will add more detail later. Stay tuned!

Btw I need tons of research to actually find a complete tutorial, so it might take a while...