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.

PAL

From Esolang
Jump to navigation Jump to search

PAL is an esolang created by islptng.

Programs consist of a single expression containing nested function calls, lambdas and literals (numbers and lists), written using Polish (prefix) notation. Each function has a predefined number of arguments, making the notation unambiguous. This language is tacit.

No description about commands in this esolang should be provided (examples are welcome here).

Data types

There are 3 data types.

  • Number, which stores a fraction.
  • List, which stores a list of objects.
  • Lambda, which is a monadic lambda function

Syntax

In this esolang, a program is a single expression. They're written in Polish(Prefix) notation.

Like @ and XENBLN, expressions are made of trees of function calls. Each character represents a function that takes a predefined amount of arguments, which follow directly after it in the code. For example, if command A takes 1 argument, B takes 2, C takes 3, and D and E both take none, then this code

CBADCDBEDEDAE

would be written in many languages like

C(B(A(D()),C(D(),B(E(),D()),E()))),D(),A(E()))

There are exceptions. To define a list, you use []; To define a lambda, you use {}.

There are some special cases in the console.
A line that begins with ] defines macros.

To separate 2 integers, use a space. Otherwise, you won't need any separators.

True is 1, and False is -1 (unlike most languages, which is 0; In this language, however, 0 is truthy).

Output list structures

It's a bit strange. Let's say you want to evaluate the Loshu:

[[4 9 2][3 5 7][8 1 6]]
> v v v
  4 3 8
  9 5 1
  2 7 6

A > means a list that was displayed horizontally, and a v means a list that was displayed vertically.
Horizontal and vertical takes turn to appear.

Therefore, if you want to display your matrix correctly, you need to either transpose it (recommended):

t[[4 9 2][3 5 7][8 1 6]]
> v v v
  4 9 2
  3 5 7
  8 1 6

Or enclose it:

[[[4 9 2][3 5 7][8 1 6]]]
> v
  > 4 9 2
  > 3 5 7
  > 8 1 6

A more nested example:

[3 7[4 6[2 5 7 4 1]8]5 9 2]
> 3 7 v           5 9 2
      4
      6
      > 2 5 7 4 1
      8

Strings

In this esolang, there are no clear type of strings.
However, strings are representated by a depth-3 array of ASCII values. For example,

[[[72 105 33 10]]]

is actually equivalent to "Hi!\n".

Formatting exist:

[[[72 105 33 10[+1 2]10]]]

Equivalent to python f"Hi!\n{1+2}\n".

Implementation

Try it online!

Examples

Hello World

[[[72 101 108 108 111 44 32 119 111 114 108 100 33 10]]]

XKCD Random Number and Quine

4

Since the whole program is an expression, a single number evaluates to itself, and finally it's printed.

A+B problem

+

Follow it by the 2 numbers you want to input.

Factorial

f{i1\*r1+1x1} 10

Output: 3628800 (10! = 3628800)

FizzBuzz

[~{?=0%x5?=0%x3[[[70 105 122 122 66 117 122 122]]][[[66 117 122 122]]]?=0%x3[[[70 105 122 122]]]x}r1 101 1]

Since this language is not able to print (only evaluation), the result will be a list.