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.

Bagadau

From Esolang
Jump to navigation Jump to search

Bagadau is an esolang by User:Ϫ based around mathematical groups.

Literals

There are four literals in Bagadau:

-Strings: "abc"
-Integers: #123
-Groups: ["abc", #123, [#777, "nesting"]]
-Variables: $A = ["recursion allowed", $A]

Variable names must be made of capital letters, except for $_IN which stores the input.

Operators/Commands

Operators
Syntax Result
{S}>{#} Nth item of set
/{#}/{item} Replace nth item
+ Sum of integers
- Difference of integers
- String concatenator
: Reorder. See syntax below.
^ Reverse. Same syntax as Reorder except with no argument
Commands
Syntax Function
= Set variable
:= Reorder and set to self
! Output

The most important command in Bagadau is "reorder".
To reorder, you must type the new order as numbers. For example, this yields ["first", "last", "second"]

$EXA = ["first", "second", "last"] 
$NEW = $EXA:1,3,2
$NEW!

If you reference an index that doesn't exist, or if you try to reorder an integer, the console throws an error. You can reorder a string, though:

$SCR = "the crab"
$SCR:5,2,

You can reference the same index multiple times or not at all; this is perfectly valid:

$EXA = [#1, #2, #3, #4, #5] 
$NEW = $EXA:1,4,4,5,1,3,2
$NEW!

There's also a shorthand to set the old variable to the reordered form of itself:

$EXA = ["redherring", "by", "is", "this", "javascript's", "inspired", "+="] 
$EXA:= 4,3,6,2,5,7
$EXA!

Examples

Cat

$_IN!