esolang

Betterave

Prefix notation with the parentheses taken out. Every function knows how many arguments follow it.

Boily, 2007 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello, World!

The idea

Boily made Betterave in 2007. Like brainfuck, False and Befunge it gives every command one character, but it has no tape and no stack. A program is a row of expressions, written as in Scheme with the function first, only without parentheses. + reads the next two expressions, . the next one, a digit none.

Read the story

A digit is the only literal number, so 42 has to be worked out. The specification writes it as *67, or as -**2558.

The machine

CommandDoes
0 to 9The digit's value
+ - * / %Arithmetic on the next two values
= < >Compare the next two values, giving 1 or 0
A to Z, a to zSet a variable, read it
. ,Print a value as a number or as a character
"text" ;Add a string to the list, from the source or a line of input; give its index
$ & #Print a string; append a character or a number to it
\ _ :Take the first character off a string; delete a string; read an integer
[ ... | ... ]| goes back to [ while the expression after it is not 0
? ... !Skip to ! when the expression after ? is 0
~ ... ~A comment

A set gives back the value it sets. The 99 bottles of beer program counts down with .B-b1, which prints the new value of b, so it needs that.

Example

The Fibonacci program keeps two numbers in a and b.
Expected: 42

The Fibonacci program keeps two numbers in a and b. Each turn prints b and a space, made as ,*48, moves on with T as a spare, and goes back while b is below **455, which is 100. It prints b before it moves on, so the first 1 shows once.

Expected: 1 2 3 5 8 13 21 34 55 89

Further

Also in Functional and concatenative

Write your own in Run Convert a program from Betterave

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run betterave -e '$"Hello, World!"'
shib manual betterave

Source

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

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

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