Samau Is Coming Back...
Samau is a stack-based golfing language inspired by Burlesque, Joy and other languages.
There are five types in Samau: integers, floats, characters, operators and lists. In integers and floats, the negative sign is _
instead of -
. Characters are written with a single quote, e.g. 'A
, '0
. Operators are built-in functions. Lists are written inside square brackets. There is no string. Use lists of characters instead.
Samau is a purly functional language. There is no input or output. After evaluation, the top of the stack will be printed.
0, the space character (' ') and the empty list are falsy. Everything else are truthy.
Samau uses CP737 encoding for counting bytes, and UTF-8 in other cases (e.g., when you are actually writing a Samau program).
Char | CP737 | Description |
---|---|---|
! |
0x21 |
Discard the top of the stack |
# |
0x24 |
Length |
$ |
0x24 |
Swap the top two items of the stack |
& |
0x24 |
And |
% |
0x25 |
Mod |
( |
0x28 |
-1 |
) |
0x29 |
+1 |
* |
0x2a |
Times |
+ |
0x2b |
Plus |
- |
0x2d |
Minus |
. |
0x2e |
Concat |
/ |
0x2f |
Divide, always returns a float |
: |
0x3a |
Cons |
; |
0x3b |
Duplicate the top of the stack |
< |
0x3c |
Less than |
= |
0x3d |
Test if two items are the same |
> |
0x3e |
Greater than |
? |
0x3f |
Pop a , pop b , pop c , if c is truthy, then push b , else push a |
@ |
0x40 |
Pop a , pop b , pop c , push b , push a , push c |
N |
0x4e |
Push the list of all natural numbers |
P |
0x50 |
Push the list of all primes |
^ |
0x5e |
Power |
_ |
0x5f |
Take the oposite number |
d |
0x64 |
Pop a list a and an item b , execute a as a function, push b back |
i |
0x69 |
Pop a list a , execute a as a function |
m |
0x6d |
Map |
z |
0x7a |
ZipWith |
` | ` | 0x7c |
~ |
0x7c |
Not |
Α |
0x80 |
Absolute value |
π |
0xa7 |
Prime-counting function |
σ |
0xa9 |
Divisor function |
ν |
0xac |
N-th prime |
φ |
0xad |
Totient function |
÷ |
0xf6 |
Divide, always returns an integer |
Compile Samau:
git clone https://github.com/AlephAlpha/Samau.git
cd Samau
stack setup
stack build
Run the REPL:
stack exec samau
Run the code from a file:
stack exec samau filename