To import modules use the import
function.
import("mymodule.cor")
# If a module is in a different folder use:
import("myfolder/mymodule.cor")
* is used as a wildcard.
File Name | Use |
---|---|
std.* | Standard Library |
lib.* | Reserved for future |
Joins list items (must be a list of strings), separated by the separator string.
list_join(["Eggs", "Bread", "Milk"], ", ") # Outputs: "Eggs, Bread, Milk"
Returns a new list populated with the results of calling the supplied function on each element in the supplied list. The function should take in the element and the index.
func square(elem, idx)
return elem ^ 2
end
list_map([1, 2, 3, 4], square) # Outputs: [1, 2, 9, 16]
Finds the supplied value in the list. If the item is found, the index of the item is returned. Otherwise, -1 is returned.
list_indexof([1, 2, 3, 4], 3) # Outputs: 2
list_indexof([1, 2, 3, 4], 5) # Outputs: -1