esolang

Wiwa

A stack of arrays that hold nothing but arrays. The number 72 is an array of 72 empty arrays.

Turing complete: unknown · ●●● hard · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello World

The idea

Wiwa is a stack based, array oriented language after Uiua and BQN. There are no values in it, only arrays that hold other arrays. A number is the length of an array, so ₈₉× makes 72 by repeating each of 8 empty arrays 9 times, and printing reads the lengths as character codes. A program can step inside the array on top of the stack with ↶, work on it as if it were the stack, and step back out with ↷.

Read the story

This implementation leaves out four of the operations. The specification gives ↥ and ⊃ two meanings each. Its programs need ↥ as over and ⊃ as execute, so maximum and shrink are missing. Flatten is missing because the specification's own equal for it, □↶∪↷, gives back the array it started with. Dump is missing because the specification does not show what it prints.

The machine

SymbolDoes
Ø ₁ ... ₉ ⏨Push an array of 0 to 10 empty arrays
∥ • ↥ \ ⊥ ⇅Swap, clone, over, drop, copy the bottom, reverse the stack
↶ ↷ ⋯Step into the top array, step out, step into a fresh empty one
∩ × ⊠Join two arrays, repeat each subarray by a length, repeat by its own length
¤ ⌑Add or remove one subarray, which counts up or down
∪ ∈ ∋ □Unpack, move into, take out, nest
λ ... .Define the one lambda
⊃ ≍ ∅Run it; run it if two lengths match; run it until the top is empty
∶ ∷ ∵Run it inside the top two arrays, inside every array, inside each subarray
↪ ⍤Print an array as a line of characters, or one character
↩ ⍣Read a line or one character

Further operations sort, split, interleave and filter subarrays by their lengths. An operation pops what it works on and pushes its result, except ⍤, which leaves the array it prints. A lambda defined while another one runs belongs to that run only.

Example

The Hello, World! builds the codes inside an empty array, steps out and prints the array as a line.

The Hello, World! builds the codes inside an empty array, steps out and prints the array as a line. It prints Hello World, without the comma and the !.

The truth machine reads a character as an array of its code, 48 or 49, and builds a 49 to compare with ≍. On 0 the lengths differ, so it drops the 49, nests the 48 and prints it. On 1 the lambda prints 1 forever.

Expected: 0

A counter of three empty arrays counts down with ⌑. Each round prints it plus 48 as a digit and drops that digit with \.

Expected: 321

The cat ₁λ⍣⍤.∅ prints each character it reads and leaves its array on top. At the end of the input ⍣ pushes an empty array, which prints as a 0 byte and ends the loop.

Further

Ideas it shows

Stack-based

Write your own in Run Convert a program from Wiwa

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: wiwa.

Command line

shib run wiwa -e '⍣₈₆פλλ•□↪.∅.≍\□↪' --input '0'
shib manual wiwa

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/wiwa.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org