Type builtin
Representation: built-in-function
Representation: built-in-function
Unique type representing a built-in function included within the language.
The bark built-in is used for printing values to the terminal.
obj x = 10;
bark(x); # output: 10
The chew built-in is used for getting standard input (stdin) from the terminal.
obj input = chew("Enter some text: ");
bark("You typed: " + tostring(x));
The type built-in is used for checking an objects type.
obj my_object = 10;
bark(type(my_object)); # output: number
The isnumber built-in is used for checking if an object is a number (returns true if number otherwise returns false).
obj x = 10;
bark(isnumber(x)); # true
The isdecimal built-in is used for checking if a number object has a decimal place value like 1.1.
bark(isdecimal(1.1)); # true
The isstring built-in is used for checking if an object is a string (returns true if string otherwise returns false).
obj x = "a string";
bark(isstring(x)); # true
The islist built-in is used for checking if an object is a list (returns true if list otherwise returns false).
obj x = [1, 2, 3, 4];
bark(islist(x)); # true
The isfunction built-in is used for checking if an object is a function (returns true if function otherwise returns false).
bark(isfunction(type)); # true
The isbuiltin built-in is used for checking if an object is a built-in function (returns true if built-in otherwise returns false).
bark(isbuiltin(type)); # true
The tostring built-in is used for converting any object to it's string representation.
obj x = 10;
bark("x is equal to: " + tostring(x)); # output: x is equal to: 10
The tonumber built-in is used for converting a string to a number.
obj x = "2.14";
obj x = tonumber(x);
bark(x + 1); # output: 3.14
The push built-in is used for adding a value to a list and returning the new copy.
obj x = [1, 2, 3];
obj x = push(x, 4);
bark(x); # output: [1, 2, 3, 4]
The append built-in is used for combining a list with another list and returning the new copy.
obj x = [1, 2, 3];
obj y = [4, 5, 6];
obj new_list = append(x, y);
bark(x); # output: [1, 2, 3, 4, 5, 6]
The remove built-in is used for removing a value at the specified index from a list and returning the new copy.
obj x = [1, 2, 3];
obj x = remove(x, 0);
bark(x); # output: [2, 3]
The retrieve built-in is used for getting a value at the specified index from a list and returning that value.
obj x = [1, 2, 3];
obj value_in_list = retrieve(x, 0);
bark(value_in_list); # output: 1
The join built-in is used for combining two strings together and returning the new copy.
obj x = "Hello, ";
obj y = "world!";
bark(join(x, y)); # output: Hello, world!
The startswith built-in is used for checking if a string starts with chars.
obj x = "12345";
bark(startswith(x, "1")); # true!
The endswith built-in is used for checking if a string ends with chars.
obj x = "12345";
bark(endswith(x, "5")); # true!
The charat built-in is used for indexing a string at index.
obj x = "12345";
bark(charat(x, 0)); # output: 1
The clear built-in is used for clearing a list or string and returning the new copy.
# list
obj x = [1, 2, 3, 4];
obj x = clear(x);
bark(x); # output: []
# string
obj x = "This is a string";
obj x = clear(x);
bark(x); # output:
The reverse built-in is used for reversing a list or string and returning the new copy.
# list
obj x = [1, 2, 3, 4];
obj x = reverse(x);
bark(x); # output: [4, 3, 2, 1]
# string
obj x = "This is a string";
obj x = reverse(x);
bark(x); # output: gnirts a si sihT
The length built-in is used for returning the length of all the values in either a string or list.
obj x = "this string is long";
obj y = [1, 2, 3];
bark(length(x)); # output: 19
bark(length(y)); # output: 3
The dig built-in is used for retrieving the contents of the specified file name.
obj contents = dig("example.txt");
bark(contents); # output: <contents of example.txt>
The bury built-in is used for writing a string of file contents to the specified file name.
bury("example.txt", "These are some contents in a file");
bark(dig("example.txt")) # output: These are some contents in a file
The uhoh built-in is used for throwing an error to the interpreter with the specified details.
if 1 == 1 {
skip;
} otherwise {
uhoh("math is broken!!");
}