esolang

01_

The only data is a list of bits. The only operations are calling a function and putting lists end to end.

Q P Liu, 2009 · Turing complete: yes · ●●● hard · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hi

The idea

Q P Liu designed 01_ with lazy evaluation and pattern matching. A function is a few definitions, each with patterns for its arguments. A pattern names the first bits an argument must start with, then either binds the rest to a name, ignores it, or demands that the list ends there. The body is its expressions written one after another, and the result is their concatenation. Because evaluation is lazy, a function can describe an endless list and only the part that is printed is ever computed.

The machine

CodeMeans
f 0x 1. _ = ...f's first argument starts with 0, rest is x; the second starts with 1; the third is empty
0110_A literal list of bits; the _ may be left off
g x 01Call g with the arguments it takes, then the bits 01
.Ends a definition
==Comment to the end of the line

The first function defined is run, with the input as its first argument, and its bits are printed eight to a byte.

Example

The first program ends with a call of p on the list 1, which matches p's only definition and adds a newline.
Expected: Hello world!

The first program ends with a call of p on the list 1, which matches p's only definition and adds a newline. The specification also has a quine. Its function p turns bits into the characters 0 and 1, so the program can print its own data twice, once as text and once as digits.

Further

Ideas it shows

Also in Functional and concatenative

Write your own in Run Convert a program from 01_

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run 01 -e 'hello=0100100001100101011011000110110001101111001000000
1110111011011110111001001101100011001000010000100001010.'
shib manual 01

Source

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

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

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