PMPL
Jump to navigation
Jump to search
Polish Math Programming Language is called that because it uses Polish notation (also PNPL was taken) User: A() brought this into existence.
Commands
Here is a list of commands Polish Math Programming Language uses:
| Command | Effect |
|---|---|
j x y |
if x is odd jump to y |
p x |
print x |
a |
accumulator |
i |
input |
s |
second variable |
+ x y |
set a to x + y |
- x y |
set a to x - y |
/ x y |
set a to x / y |
* x y |
set a to x * y |
% x y |
set a to x % y |
= x y |
if x = y set a to 1 else set a to 0 |
< x y |
if x < y set a to 1 else set a to 0 |
@ x |
set s to x |
Programs
Cat program
p i j 1 1
Truth-machine
+ i 0 p a j a 1
Inc
+ a 1 p a j 1 1
A+B
+ i 0 p a + a i p a
Loop
+ s 1 @ a (code) < s x # x is a placeholder; 'is s less than x?' j a 1
FizzBuzz
+ s 1 @ a # mod 15 % s 15 = s 0 j a 15 # mod 5 % s 5 = s 0 j a 18 # mod 3 % s 3 = s 0 j a 21 # FizzBuzz station p 'FizzBuzz' j a 25 # Fizz station p 'Fizz' j a 25 # Buzz station p 'Buzz' j a 25 p s j 1 1