We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Polynomix

From Esolang
Jump to navigation Jump to search
Author's note: I don't think Polynomix is esoteric, although its syntax looks weird. I admit, though, reading the code can be very difficult for beginners.
Polynomix was never meant to be a golfing language!
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
Polynomix
Designed by User:I am islptng
Appeared in 2026
Computational class Turing-complete
Reference implementation Python
Influenced by APL
SletScript
Python
File extension(s) .plx

Polynomix is a computer language designed by User:I am islptng.
It combines APL's array-oriented programming paradigm with Python's dynamic typing, along with a new design of syntax. There's also inspiration from C++ and Haskell.

Home Page (Requires Pyodide, be patient the first time loading)

Syntax

For the symbol reference dictionary, see Polynomix/Symbols.

Examples

Hello World

`Hello, world!'+["\n]>.

Truth-machine

\;<.>.#\a
a="1@{a>.}

Factorial

(x>x<2?(1x-1\.*x)) # \fact
10 fact! $$ 3628800

Quine

`{&.+;.}>.'{&.+;.}>.

FizzBuzz

1#\x x<101@{x%\[15 5 3 1]%0/0/!![`FizzBuzz'`Buzz'`Fizz'x]>.;"\n>.;x#+1}\;

99 bottles of beer

(a>a>.;` bottle'>.;a=1?(\;"s>.))#\b
99^/\(a>a b!;` of beer on the wall,
'>.;a b!;` of beer.
Take one down, pass it around,
'>.;a-1 b!;` of beer on the wall.

'>.;)!

Kolakoski_sequence

[1 2 2]#\k 2#\i 1|@{k/(i-2)>.;k+([3-(k/(k<-1))]*(k/i))#k i+1#i}

brainfuck interpreter

$$ brainfuck.plx - Brainfuck Interpreter in Polynomix
$$ islptng, 30 June 2026

300 # \TAPEWRAP
(src>
    [] # \brackets
    src # \tmp
    src ^ \(i>
        i#(\index, \char)
        char="[?(
            brackets #+ [index]
        char="]{
            brackets / \1 #\matching
            brackets #/(\;,\1)
            tmp #/(matching index-matching)
            tmp #/(index matching-index)
        })
    )!;

    [0] * TAPEWRAP # \tape
    0 # \ptr
    0 # \ip
    tmp < # \len
    ip < len @ {
        tmp / ip # \cmd
        ip #+ 1
        cmd & $+$ ?(
            cmd < 0 ?(
                tape / ptr = 0 -?(ip #+ cmd)
                tape / ptr = 0  ?(ip #+ cmd)
            )
        cmd = "+   tape #/((+1%256) ptr)
        cmd = "-   tape #/((-1%256) ptr)
        cmd = "<   ptr #(- 1 % TAPEWRAP)! ;
        cmd = ">   ptr #(+ 1 % TAPEWRAP)! ;
        cmd = ",   tape /(ptr \;<.<)
        cmd = ".   tape / ptr ~ >. ;
        )
    }
\;) # \brainfuck

`+[-->-[>>+>-----<<]<--<---]>-.>>>+.>>..+++[.>]<<<<.+++.------.<<-.>>>>+.' brainfuck!

Conway's Game of Life

Supports any Life-like rules. Simulation on a torus whose size is specified in the RLE header.

(g r>g&\[\1 0 1]~.(x y>x\\+\\y)\(w>w&\[\1 0 1]~.(x y>x\+\y))!\\+\\(g\\*8)\\(%!!r|/!!(0,1))!)#\Step(\%!!`012345678'&([[]]\;)\=#[\;\b\;\s]s\+9+b)#\Pr(\\(|/!!(".,"#))!\|.!!" |.!!"\n=>.;"\n,*2>.;\;)#\PrintGrid(s>s\(%!!`0123456789'|<)!+.%\(i>i-=0?(1,0,*(i<)i,))!=%#([\cl \;!!],\ch)cl?([][`1'])+(s*.ch)|2\*(n pt>pt#\[H T!!]H,*(n\^.^.)+T)=)#\Ep(s wd ht>s/(\;,\1)&(`$'\;)\\(="o<)!\^(wd 0)^(ht[0]*wd))#\Fg(s>s&(["\n]1)#\[hr bd]hr&(`, '\;)\&(` = '1)\/1#\[xs ys r][xs\^.^.;ys\^.^.;r bd*(["\n][])])#\Ph(s>Ph#;Ep#;Fg#;Pr#;s Ph!#\[x y r bd]bd Ep!Fg!(x y),(r Pr!))#\ParseRLE(lr>[]#\b[]#\s lr\(i>i<9?(b#+[i] s#+[i-9]))!;["B b\*.;"/"S s\*.]==)#\Rr(g>g\(/|.(=0)/\/!!`bo')!&.|!|.!!"$=+./%\~=|84\(&.(=1-)\*.=)!|.!!"\n=+`!')#\Cb(g r>Rr#;Cb#;`x = '+(g/0<*.)+`, y = '+(g<*.)+`, rule = '+(r Rr!)+["\n]+(g Cb!))#\GenerateRLE

Usage:

$$ Load RLE
`x = 5, y = 5, rule = B3/S23
$3bo$bobo$2b2o!' ParseRLE! #\(grid, rule)

$$ Evolve
grid Step! rule #\grid2

$$ See the new grid
grid2 PrintGrid!;

$$ Save as RLE
grid2 GenerateRLE! rule >.;\;


Number theory tools

$$ Prime
$$ http://mathworld.wolfram.com/PrimeNumber.html
$$ http://www.numbersaplenty.com/set/prime_number/
(~.-=[1])#\PrimeQ

$$ List of positive divisors
$$ http://mathworld.wolfram.com/Divisor.html
(x>x+1=\|x%x)#\Divisors

$$ Totient Function
$$ http://mathworld.wolfram.com/TotientFunction.html
(a>a^\&a%1<)#\EulerPhi

$$ Repdigit
$$ http://mathworld.wolfram.com/Repdigit.html
$$ http://www.numbersaplenty.com/set/repdigit/
(a b>a+.b+.-<=1)#\RepdigitQ

$$ Palindromic
$$ http://mathworld.wolfram.com/PalindromicNumber.html
$$ http://www.numbersaplenty.com/set/palindromic_number/
(a b>a+.b{/=;.})#\PalindromeQ

$$ Little Omega
$$ http://mathworld.wolfram.com/PrimeFactor.html
(~.-<)#\PrimeNu

$$ Big Omega
$$ http://mathworld.wolfram.com/PrimeFactor.html
(~.-|.)#\PrimeOmega

$$ Semiprime
$$ http://mathworld.wolfram.com/Semiprime.html
$$ http://www.numbersaplenty.com/set/semiprime/
(~.-|.=2)#\SemiprimeQ

$$ Harshad
$$ http://mathworld.wolfram.com/HarshadNumber.html
$$ http://www.numbersaplenty.com/set/Harshad_number/
(a b>a%(a+.b|.)=0)#\HarshadQ

$$ Input n, print (n-1) th cake number
$$ http://www.numbersaplenty.com/set/cake_number/
(+.!![6/;2/-;4/3 0])#\Cake

$$ Hoax
$$ http://mathworld.wolfram.com/HoaxNumber.html
$$ http://www.numbersaplenty.com/set/hoax_number/
(a b>(a+.b|.)=(a~.<\+.b=|.))#\HoaxQ

$$ Esthetic
$$ http://www.numbersaplenty.com/set/esthetic_number/
(a b>a+.b|(2{-*}!)\=1~.)#\EstheticQ