Here's Some Predefined Stuff. Now Go Invent Everything Else
Jump to navigation
Jump to search
Here's Some Predefined Stuff. Now Go Invent Everything Else, which will be called HSPSNGIEE from this point on, is an esolang where all you are given is the bare minumum of a programming language, which is types for numbers, booleans, strings, arrays, and functions, as well as premade functions and variables.
Predefined Functions
| Function | Type Attached To | Meaning | Example | Notes |
|---|---|---|---|---|
| numberLength() | Number | Get the length of a number | print((2763).numberLength()) //returns 4 | If you put a number in the input, it will get the length of the attached number in the base of the number in the input |
| stringLength() | String | Get the length of a string | run print("hello".stringLength()) //returns 5 | |
| toArray() | String | Returns an array of the characters in the string | run print("hi".toArray()) //returns ["h","i"] | |
| arrayLength() | Array | Get the length of an array | run print([1,2,3].arrayLength) //returns 3 | |
| typesInArray() | Array | Get the types as their default values in the array | run print([1,"foo","bar"].typesInArray()) //returns [0,""] | |
| print() | Prints anything | run print("Hello, World!") //returns "Hello, World!" | ||
| input() | Asks for any type as input | run print(run input()) //cat |
Syntax
(Stuff inbetween parenthesis is optional)
| T name = value | Creates a variable of type T named name that has a value of value. Is always mutable. |
| run function() | Runs a function called function. Will return an error if function() isn't defined yet. |
| value.function | Runs a function on value. Will return an error if function() isn't defined yet or function() is not a subfunction of the type of value. |
| array[n] | Gets the nth item of an array. Arrays are zero indexed. |
| attach function() to T | Makes function() a subfunction of T |
| type T(<optional is T, optional2 is T2, ...>) | Makes a type called T |
Examples
- This section is still a work in progress. It may be changed in the future.
TODO: Make examples tomorrow