Esolangs
Koho to bol nápad?
A Programming Language
1962 - matematický model
Eventuálne boli vytvorené interpretery
A Programming Language
x[⍋x←6?40]
6 náhodných čísel:
(~R∊R∘.×R)/R←1↓ιR
Prvočísla od 1 do R:
life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}
Simulácia Game of Life
INTERCAL
Autori chceli jazyk korý by bol čo najodlišnejší od existujúcich
Programátor musí byť slušný, ale nie príliš. 1/3 - 1/5 príkazov musí byť slušná.
DO variable <- expression
PLEASE variable <- expression
PLEASE DO variable <- expression
GOTO je predsa zlo, nie? Fixnime to! :)
DO COME FROM (label)
INTERCAL
Autori chceli jazyk korý by bol čo najodlišnejší od existujúcich
Programátor musí byť slušný, ale nie príliš. 1/3 - 1/5 príkazov musí byť slušná.
DO variable <- expression
PLEASE variable <- expression
PLEASE DO variable <- expression
GOTO je predsa zlo, nie? Fixnime to! :)
DO COME FROM (label)
INTERCAL
Hello World
DO ,1 <- #13
PLEASE DO ,1 SUB #1 <- #238
DO ,1 SUB #2 <- #108
DO ,1 SUB #3 <- #112
DO ,1 SUB #4 <- #0
DO ,1 SUB #5 <- #64
DO ,1 SUB #6 <- #194
DO ,1 SUB #7 <- #48
PLEASE DO ,1 SUB #8 <- #22
DO ,1 SUB #9 <- #248
DO ,1 SUB #10 <- #168
DO ,1 SUB #11 <- #24
DO ,1 SUB #12 <- #16
DO ,1 SUB #13 <- #162
PLEASE READ OUT ,1
PLEASE GIVE UP
INTERCAL
READ OUT ,1
Bit-reverse ASCII-code of previous printed character (assuming it’s 8-bit) to get rev(i-1). When outputting first element of the array, this is assumed to be 0.
Get the i-th element of the array array(i).
Subtract array(i) from rev(i-1) to get rev(i).
Bit-reverse rev(i) to get ASCII-code of the character to be printed i-th.
Quantum INTERCAL
DO .1 <- #1
DO .1 <- #2 WHILE NOT ASSIGNING IT
DO READ OUT .1
PLEASE GIVE UP
Premenná .1 bude v kvantovej superpozícií
DO READ OUT .1 vypíše jej obe hodnoty
Ruby on Rails
Je zastaralé...
Potrebujeme niečo principíalne nové
Potrebujeme...
INTERCAL on Interstates
NOTE At the start of the program, handle the default route.
DO (15) NEXT
(2) DO COME FROM (16) WITH ROUTE "/blog/post/:id"
PLEASE DO ,1 <- ;4400 SUB #1
PLEASE NOTE ,1 now contains the first argument passed
NOTE to the route.
NOTE This is where you could load up some data based upon ,1.
NOTE For the purposes of this example, assume we loaded
NOTE our data into ,4, ,5, and ,6.
DO STASH ;49221 SUB #1 <- ,4
DO STASH ;49221 SUB #2 <- ,5
DO STASH ;49221 SUB #3 <- ,6
NOTE Render the template.
NOTE Pass #3 because there are three arguments.
PLEASE READ OUT #3 WITH TEMPLATE "blog_post.html"
PLEASE GIVE UP
NOTE This is the default page of the website.
(15) DO COME FROM (16000) WITH ROUTE "/home"
NOTE Render the template. Pass #0 if no parameters are required.
(16) READ OUT #0 WITH TEMPLATE "home.html"
PLEASE GIVE UP
Brainfuck
< > + - [ ] . ,
Brainfuck
Hello World
++++++++
[>++++
[>++>+++>+++>+<<<<-]
>+>+>->>+[<]<-
] >>.>---.+++++++..+++
.>>.<-.<.+++.------.
--------.>>+.>++.
Brainfuck
Dá sa prepisovať do C
char array[47000] = {0};
char *ptr=array;
> ++ptr;
< --ptr;
+ ++*ptr;
- --*ptr;
. putchar(*ptr);
, *ptr=getchar();
[ while (*ptr) {
] }
Malbolge
('&%:9]!~}|z2Vxwv-,POqponl$Hjig%
eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA
@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>
TRANSCRIPT
The Nineteenth Room
In the middle of the room you spot a lone figure.
Martin is here.
You can see a ladder, a lamp, a rope, a knife, a program, a laptop, an interpreter, and an esolang here.
>RESTORE
Which save file would you like to restore?
>PROGRAM.sav
Done.
>SET LAMP TO 1
You turn on the lamp.
>LIFT KNIFE
You pick up the knife, feeling powerful.
>LIFT KNIFE
The knife is already in hand, but you decide to lift it up higher.
You know knives aren't dumbbells, right?
>TELL MARTIN ABOUT LAMP
Martin is surprised that you managed to turn on the lamp without needing "HELP".
>HELP
Too bad, no hints for you.
>SHOW KNIFE TO MARTIN
You pull out the knife.
Martin picks up his phone and starts calling for the police.
You quickly realise your mistake and apologise profusely. Good job.
>ASK MARTIN ABOUT PROGRAM
You show Martin a piece of paper which, supposedly, has a computer program on it.
The program appears to be written in a strange and foreign language.
Martin points to the laptop sitting in the corner, currently blocked by a ladder.
>LIFT LADDER
You move the ladder slightly out of the way.
>SHOW PROGRAM TO MARTIN
Martin doesn't respond. He's too busy trying to golf esolang quines.
>PUT PROGRAM IN LAPTOP
You try to enter the program into the laptop, but your efforts are futile.
The laptop is off.
>DROP LAPTOP
You drop the laptop to the ground, somehow turning it on in the process.
Just kidding, it's still off. The screen has an extra crack now though.
>ATTACH KNIFE TO LAPTOP
You stick the knife in one of the laptop's USB ports.
The laptop turns on.
>SET ROPE TO 0
You grab both ends of the rope and tie a knot, forming a loop.
>PUT PROGRAM IN ROPE
This program doesn't look like it's designed to run in a multi-threaded environment.
>CUT ROPE WITH KNIFE
The knife is powering the laptop.
>HIT ROPE WITH KNIFE
The knife is still (somehow) powering the laptop.
>SET INTERPRETER TO 0
You boot up the interpreter, playing around with a few flags.
>PUT PROGRAM IN INTERPRETER
You enter the program into the interpreter.
>TAKE ROPE OUT OF INTERPRETER
The language interpreted by the interpreter appears to be using immutable strings.
>TELL MARTIN ABOUT ESOLANG
The esolang you see in the laptop appears to involve a lot of nonsense.
>SHOW INTERPRETER TO MARTIN
You show Martin the output of the program. It says: "Hello, World!"
>ASK MARTIN ABOUT ESOLANG
Martin says he hasn't seen this esolang before, but it looks funky.
You get so excited about this new esolang that you knock over the ladder.
>LIFT LADDER
You pick the ladder up and move it a bit further away.
>SHOW ESOLANG TO MARTIN
Martin tries to study the language.
>DETACH KNIFE FROM LAPTOP
You pull the knife out from the laptop.
The laptop turns off.
>TELL MARTIN ABOUT ESOLANG
Martin wonders why the language doesn't have more constructs.
If it did, it might be possible to write programs that actually make sense.
>SHOW LADDER TO MARTIN
Martin argues that it's actually a stepladder.
>ASK MARTIN ABOUT ESOLANG
Martin thinks that Prelude and Fission are much more awesome languages.
>MARTIN, Your number was prime.
Martin raises an eyebrow, wondering what you're on about.
>SHOW ESOLANG TO MARTIN
Martin shows *you* Prelude. It is indeed more awesome.
>TELL MARTIN ABOUT LAMP
Martin already knows about the lamp, remember?
>SHOW LADDER TO MARTIN
It's a stepladder.
>ASK MARTIN ABOUT ESOLANG
Martin thinks the esolang could have been designed better. It's fun to write, though.
>MARTIN, Your number was not prime.
You say this to Martin, but the message isn't intended for Martin.
Martin seems to realise.
>SHOW ESOLANG TO MARTIN
The esolang seems to be called "TRANSCRIPT".
>EXAMINE MARTIN
It's rude to stare at people like that.
>EXIT
Thank goodness this charade is over.
Chef
Hello World Cake with Chocolate sauce.
This prints hello world, while being tastier than Hello World Souffle. The main
chef makes a " world!" cake, which he puts in the baking dish. When he gets the
sous chef to make the "Hello" chocolate sauce, it gets put into the baking dish
and then the whole thing is printed when he refrigerates the sauce. When
actually cooking, I'm interpreting the chocolate sauce baking dish to be
separate from the cake one and Liquify to mean either melt or blend depending on
context.
Ingredients.
33 g chocolate chips
100 g butter
54 ml double cream
2 pinches baking powder
114 g sugar
111 ml beaten eggs
119 g flour
32 g cocoa powder
0 g cake mixture
Cooking time: 25 minutes.
Pre-heat oven to 180 degrees Celsius.
Method.
Put chocolate chips into the mixing bowl.
Put butter into the mixing bowl.
Put sugar into the mixing bowl.
Put beaten eggs into the mixing bowl.
Put flour into the mixing bowl.
Put baking powder into the mixing bowl.
Put cocoa powder into the mixing bowl.
Stir the mixing bowl for 1 minute.
Combine double cream into the mixing bowl.
Stir the mixing bowl for 4 minutes.
Liquify the contents of the mixing bowl.
Pour contents of the mixing bowl into the baking dish.
bake the cake mixture.
Wait until baked.
Serve with chocolate sauce.
chocolate sauce.
Ingredients.
111 g sugar
108 ml hot water
108 ml heated double cream
101 g dark chocolate
72 g milk chocolate
Method.
Clean the mixing bowl.
Put sugar into the mixing bowl.
Put hot water into the mixing bowl.
Put heated double cream into the mixing bowl.
dissolve the sugar.
agitate the sugar until dissolved.
Liquify the dark chocolate.
Put dark chocolate into the mixing bowl.
Liquify the milk chocolate.
Put milk chocolate into the mixing bowl.
Liquify contents of the mixing bowl.
Pour contents of the mixing bowl into the baking dish.
Refrigerate for 1 hour.
MarioLANG
++++: > > +:+:+:+:+:+:+:::::
====+ >^=== """=================
+:-):(:^= = !
========= = #
= ! .+.,:-<
=### ======"
Na záver odbočka
Už nie ezoterické, ale stále WTF?!
Polyglot
#define a /*
#<?php
echo "\010Hello, world!\n";// 2> /dev/null > /dev/null \ ;
// 2> /dev/null; x=a;
$x=5; // 2> /dev/null \ ;
if (($x))
// 2> /dev/null; then
return 0;
// 2> /dev/null; fi
#define e ?>
#define b */
#include <stdio.h>
#define main() int main(void)
#define printf printf(
#define true )
#define function
function main()
{
printf "Hello, world!\n"true/* 2> /dev/null | grep -v true*/;
return 0;
}
#define c /*
main
#*/
#define a /*
#<?php
echo "\010Hello, world!\n";// 2> /dev/null > /dev/null \ ;
// 2> /dev/null; x=a;
$x=5; // 2> /dev/null \ ;
if (($x))
// 2> /dev/null; then
return 0;
// 2> /dev/null; fi
#define e ?>
#define b */
#include <stdio.h>
#define main() int main(void)
#define printf printf(
#define true )
#define function
function main()
{
printf "Hello, world!\n"true/* 2> /dev/null | grep -v true*/;
return 0;
}
#define c /*
main
#*/
#define a /*
#<?php
echo "\010Hello, world!\n";// 2> /dev/null > /dev/null \ ;
// 2> /dev/null; x=a;
$x=5; // 2> /dev/null \ ;
if (($x))
// 2> /dev/null; then
return 0;
// 2> /dev/null; fi
#define e ?>
#define b */
#include <stdio.h>
#define main() int main(void)
#define printf printf(
#define true )
#define function
function main()
{
printf "Hello, world!\n"true/* 2> /dev/null | grep -v true*/;
return 0;
}
#define c /*
main
#*/
Quine
char*s="char*s=%c%s%c;main(){printf(s,34,s,34);}";
main(){printf(s,34,s,34);}
Polyglot quine
char*s="char*s=%c%s%c;main(){printf(s,34,s,34);}";
main(){printf(s,34,s,34);}
Toľko k esolangs.
Ďakujem za pozornozť
Esolangs (SK)
By Adam Dej
Esolangs (SK)
Čo sú ezoterické programovacie jazyky? Ako vznikli? Načo sú dobré?
- 350