AEL

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

AEL (An Esoteric Language) is a WIP esolang by User:Pro465.

AEL
Paradigm(s) imperative
Designed by User:Pro465
Appeared in 2024
Memory system Stack-based
Dimensions one-dimensional
Computational class Turing complete
Major implementations Reference implementation
Influenced by Forth, APL
File extension(s) .ael
Instructions
Instructions stack effect Meaning
'<char> -- char push the character following '
: x -- x x duplicate top item
$ x y -- x pop
~ x y -- y x swap
; x y -- x y x duplicate the second-to-top item
! x y -- y x y put a copy of the top item below the second item
d x ...y n -- ...y x dig up the item at n depth
b ...y x n -- x ...y bury the top item into depth n
r x ...y n -- x ...y x retrieve a copy of the item at depth n
` x -- -x negate
+ x y -- x+y add
- x y -- x-y subtract
* x y -- x*y multiply
/ x y -- x//y integer division
% x y -- x%y modulo
, -- byte get next byte input
_ -- number get next numeric input
. byte(s) -- output byte(s) modulo 256
# object -- pretty print
@ list idx -- list[idx] index into a list
& list idx x -- list[:idx] ++ [x] ++ list[idx+1:] set item at index of list
[c] -- [c] push a list formed by converting the part inside [] to a list of numbers (for the characters) and lists (for the blocks)
? n -- [0]*n push the list {0, 0, ..., 0} of length n
\ list -- prefixes(list) push the list consisting of the prefixes of the given list
| x n -- x[..n] x[n..] slice the list at the given position into two
c list1 list2 -- list1 ++ list2 concatenate two lists
w x -- [x] "wrap" the object to form a list
p list x -- list ++ [x] push the top item to the list
m list c -- <arbitrary> list.map(c) push the list formed by mapping the code to the list
e list c -- <arbitrary> for each element in the list, pushes it to the stack and then executes the code. similar to each in Factor
l condblock c -- <arbitrary> executes c while executing condblock returns neither empty nor 0.
i cond c -- <arbitrary> executes c iff cond is neither empty nor 0.

notes:

  1. n defaults to 2 for d and b, and to 0 for @ if the top item of the stack isn't an integer, in which case the top item isn't popped before the operation.

Some Examples

Fibonacci

[edit number in next line to provide input]$
40?
1`1 2d[$!+:]m#

Triangular numbers

40?0 0 2d[$1+!+!]m#