Closed towerofnix closed 8 years ago
You guys "like" descriptions of library stuff so I guess I'll go over these commits and basically what's been added.
lforeach
Runs a function on each of the items in a list.
Syntax: <list> <code> lforeach
Example:
[] 'hello' lappend 'world' lappend { print } lforeach -> hello[newline]world
lmap
Creates a new list based off of a previous one in which each item in the new list is the result of calling a function on the item in the same position in the old list.
Syntax: <list> <code> lmap
Example:
5 range { 5 * } lmap -> [5, 10, 15, 20, 25]
range
Generates a range of numbers from 1 to (arg).
Syntax: <num> range
Examples:
3 range -> [1.0, 2.0, 3.0]
range0
Generates a range of numbers from 0 to (arg) - 1.
Syntax: <num> range0
Examples:
3 range0 -> [0.0, 1.0, 2.0]
ljoin
Joins each of the items in a list by a given string.
Syntax: <list> <str> ljoin
Examples:
3 range ', ' ljoin -> 1.0, 2.0, 3.0
repeattimes
Repeat a function a specific number of times.
Syntax: <num> <code> repeattimes
Examples:
5 { 'Spam!' print } repeattimes
while
While calling a function returns true, run another function.
Syntax: <code> <code> while
Example:
/* requires too much code to make something worth showing off :P */
random
Generates a random number from 0 to 1 with 6 decimal digits.
Syntax: random
Example:
random print
Because I feel like code is going to be more useful than documentation here:
`oop_base import
newobj `obj set
obj `hi 30 <-
obj print
-> {'hi': 30.0}
obj `hi -> print
-> 30.0
In theory this works with modules (modules and objects are the same type of token, py-obj
) but I haven't tested it yet.
Also more stuff that I haven't posted here because I can't remember what. Just read the code? :grin:
Use #23 instead.
I really need to switch to the master branch because I hate the stdlib branch and stuff and things.