sitelen ilo
Paradigm(s) | imperative, functional |
---|---|
Designed by | User:jan Gamecuber |
Appeared in | 2022 |
Memory system | variable-based |
Computational class | Turing complete |
Reference implementation | Unimplemented |
Influenced by | toki pona, toki pi ilo nanpa, sona |
File extension(s) |
sitelen ilo is a programming language based on toki pona (made with the knowledge of toki pi ilo nanpa and sona). It was made by jan Gamecuber.
Formatting
Newlines mark the next command (no semicolons) and blocks are indented. Comments start with namako.
Commands
Variable assign
This is done with
VarName li VarType VarValue
Data Types
There are four types. These are nanpa (double), nimi (string), kulupu (list) and lupa (null).
Control Flow Statements
If-Then statements are made using
Condition la ni
and a block on the next line that is only executed if the condition is true. Labels are made with
ma ni li LabelName
and gone to with
tawa LabelName
I/O and libraries
To get input, use
sina Prompt
and to print use
toki Value
. To import a library, use
lukin LibraryName
Functions
Defining a function is done with
sin Name pi Param1, Param2 ...
and a block storing the code. Calling is done with
pali Name pi Param1, Param2 ...
. Return statements are
sitelen ReturnValue
.
Structs
A struct is started with
poki StructName li ni:
and properties are written to within the definition as a regular variable assignment. To access a property, name the property and then name the struct it is a part of.
Extra details
Math and conditions are handled by jan Emalan's numbering system, but with taso as bitwise nand. Lists work with indices like in python, but to append or insert to a list, you just use the index where you want it to go.
Prebuilt functions
suli
With 1 arg, suli takes the length of that arg in bits (or for lists, list entries) (null is 1). With 2 args, suli returns the larger/longer.
nasa
With no args, nasa returns a random float from 0-1. With 1 arg, nasa returns a random element or byte of the arg. With 2 args, nasa is random.randrange() from python.