Library Documentation
Add
Add adds left and right together, returning a sum.
Add : left right (infer sum) => trait (left right -> sum)
instance (Add Number Number Number)
default error instance (Add left right sum)
error instance (Add () right sum)
instance (Add String String String) all?
all? return True if condition is True for every element in collection, or if collection is empty.
all? :: (condition :: (element -> Boolean)) -> collection -> Boolean where (As-Sequence collection element) always
Create a sequence that produces element forever.
Example:
my-sequence : always "Hello, world!"
show (next my-sequence) -- Hello, world!
show (next my-sequence) -- Hello, world!
show (next my-sequence) -- Hello, world!
always :: element -> Sequence element And
And returns True if both sides are True.
And : left (infer right) (infer output) => trait (left {right} -> output)
instance (And Boolean Boolean Boolean) Angle
An angle represented in degrees.
Angle : type {degrees :: Number} any?
any? return True if condition is True for any element in collection, or False if collection is empty.
any? :: (condition :: (element -> Boolean)) -> collection -> Boolean where (As-Sequence collection element) append
append adds a new element to the end of list, producing a new list.
append :: element -> (list :: (List element)) -> List element As-Sequence
Convert container into a sequence of element elements.
As-Sequence : container (infer element) => trait (container -> Sequence element)
instance (As-Sequence (Dictionary key value) (key; value))
instance (As-Sequence (Set element) element)
instance (As-Sequence (Stride Number) Number)
default error instance (As-Sequence container element)
instance (As-Sequence (Sequence element) element)
instance (As-Sequence (Maybe element) element)
instance (As-Sequence (List element) element)
instance (As-Sequence String String) Boolean
Represents either True or False.
Boolean : type {
False
True
} build-sequence
Build a sequence from an initial element and a transform function.
build-sequence :: (Maybe element) (element -> Maybe element) -> Sequence element ceil
ceil rounds up n to the nearest integer.
ceil :: (n :: Number) -> Number collect
collect collects all the elements in input into a single output.
collect :: input -> output where (As-Sequence input element) (From-Sequence element output) (output :: List element) contains?
contains? returns True if collection contains element.
contains? :: element -> collection -> Boolean where (Container collection element) Control-Flow
Used by loop to determine whether to continue running or stop with a value.
Control-Flow : result => type {
Continue
Break result
} cos
cos calculates the cosine of angle.
cos :: (angle :: Angle) -> Number count
count counts the number of items in collection.
count :: collection -> Number where (Count collection) degrees
An angle in degrees.
degrees :: Number -> Angle Describe
Describe produces a String describing value.
Describe : value => trait (value -> String)
default error instance (Describe value)
instance (Describe String)
instance (Describe Number)
instance (Describe Boolean)
instance (Describe (Maybe value)) where (Describe value) Dictionary
A collection of unique keys associated with values.
Dictionary : key value => type {
size :: Number
entries :: List (Maybe (key; value))
} Divide
Divide divides left by right, returning a quotient.
Divide : left right (infer quotient) => trait (left right -> quotient)
instance (Divide Number Number Number)
default error instance (Divide left right quotient)
error instance (Divide () right quotient) divisible-by?
divisible-by? checks if left is divisible by right.
divisible-by? :: (left :: Number) -> (right :: Number) -> Boolean Dropdown
Display a dropdown with the provided options.
Dropdown : type {value :: String} each
each calls action for each element in container.
each :: (action :: (element -> ())) -> container -> () where (As-Sequence container element) entry
entry retrieves the value for a key stored in dictionary.
entry :: key -> (dictionary :: (Dictionary key value)) -> Maybe value where (Equal key) (Hash key) enumerate
enumerate adds a counter alongside each element in collection, starting at 0.
enumerate :: collection -> Sequence (Number; element) where (As-Sequence collection element) Equal
Equal returns True if both value values are equal.
Equal : value => trait (value value -> Boolean)
instance (Equal String)
instance (Equal Number)
instance (Equal ())
instance (Equal Boolean) extend
extend appends the contents of right to left.
extend :: left -> (right :: container) -> container where (As-Sequence left element) (Extend container element) external
external sends a message to the runtime.
external :: String input -> output where (output :: ()) filter
filter keeps the elements in container that satisfy condition.
filter :: (condition :: (element -> Boolean)) -> container -> Sequence element where (As-Sequence container element) filter-by
filter-by transforms the element elements in container into output elements using f, keeping only the items that are Some.
filter-by :: (input -> Maybe output) -> container -> Sequence output where (As-Sequence container input) find
find finds the first element in collection that satisfies condition.
find :: (condition :: (element -> Boolean)) -> collection -> Maybe element where (As-Sequence collection element) find-by
find-by finds the first element in collection for which f returns Some.
find-by :: (f :: (element -> Maybe result)) -> collection -> Maybe result where (As-Sequence collection element) find-position
find-position finds the position of the first element in collection that satisfies condition.
find-position :: (condition :: (element -> Boolean)) -> collection -> Maybe Number where (As-Sequence collection element) first
first retrieves the first element inside list, or None if the list is empty.
first :: (list :: (List element)) -> Maybe element flatten
flatten flattens outer into a sequence of element elements.
flatten :: outer -> Sequence element where (As-Sequence outer inner) (As-Sequence inner element) floor
floor rounds down n to the nearest integer.
floor :: (n :: Number) -> Number forever
forever repeats forever.
forever :: Forever Greater-Than
Greater-Than returns True if the left value is greater than the right value.
Greater-Than : value => trait (value value -> Boolean)
instance (Greater-Than value) where (Order value) Greater-Than-Or-Equal
Greater-Than-Or-Equal returns True if the left value is greater than or equal to the right value.
Greater-Than-Or-Equal : value => trait (value value -> Boolean)
instance (Greater-Than-Or-Equal value) where (Order value) Hash
Convert the components of a value into a number used by Dictionary and
Set to organize their elements.
Hash : value => trait (value -> Number)
instance (Hash Number)
instance (Hash String)
instance (Hash ()) if
if makes a choice based on whether condition is True or False.
if :: (condition :: Boolean) {(then :: value)} {(else :: value)} -> (output :: value) initial
initial retrieves all but the last element inside list, or None if the list is empty.
initial :: (list :: (List element)) -> Maybe (List element) Initial
Initial represents the default or initial value for value.
Initial : value => trait value
instance (Initial (Dictionary key value))
instance (Initial (Set element))
default error instance (Initial value)
instance (Initial Number)
instance (Initial String)
instance (Initial Boolean)
instance (Initial (Maybe value))
instance (Initial (List element)) insert
insert adds a new element to set_, returning a new set.
insert :: element -> (set_ :: (Set element)) -> Set element where (Equal element) (Hash element) insert-at
insert-at inserts a new element at a particular location inside list, shifting the elements from that location on one place to the right, producing a new list.
insert-at :: Number element -> (list :: (List element)) -> Maybe (List element) insert-entry
insert-entry adds a new entry to dictionary, returning a new dictionary.
insert-entry :: key value -> (dictionary :: (Dictionary key value)) -> Dictionary key value where (Equal key) (Hash key) join
join collects a and b into a single c.
join :: a b -> c where (As-Sequence a element) (As-Sequence b element) (From-Sequence element c) (c :: a) last
last retrieves the last element inside list, or None if the list is empty.
last :: (list :: (List element)) -> Maybe element Less-Than
Less-Than returns True if the left value is less than the right value.
Less-Than : value => trait (value value -> Boolean)
instance (Less-Than value) where (Order value) Less-Than-Or-Equal
Less-Than-Or-Equal returns True if the left value is less than or equal to the right value.
Less-Than-Or-Equal : value => trait (value value -> Boolean)
instance (Less-Than-Or-Equal value) where (Order value) max
max returns the larger of the two n values.
max :: n n -> n where (Order n) min
min returns the smaller of the two n values.
min :: n n -> n where (Order n) Mismatched
Resolved by the compiler for all type mismatches, so you can write better error messages for your types.
Mismatched : actual expected => trait () Multiply
Multiply multiplies left and right together, returning a product.
Multiply : left right (infer product) => trait (left right -> product)
instance (Multiply Number Number Number)
default error instance (Multiply left right product)
error instance (Multiply () right product) nan
The number returned from calculations whose result is not a number (eg. dividing by zero).
nan :: Number negate
negate negates the sign of n.
negate :: (n :: Number) -> Number next
next retrieves the next element in sequence.
next :: (sequence :: (Sequence element)) -> Maybe element not
not returns False if provided True, and vice versa.
not :: value -> value where (Not value) (value :: Boolean) Not
Represents the logical inverse of a value.
Not : value => trait (value -> value)
instance (Not Boolean)
instance (Not (a -> b)) where (Not b) (b :: Boolean) Not-Equal
Not-Equal returns True if the value values are not equal.
Not-Equal : value => trait (value value -> Boolean)
instance (Not-Equal value) where (Equal value) nth
nth retrieves the element in list at a particular location, if it exists.
nth :: Number -> (list :: (List element)) -> Maybe element Or
Or returns True if either side is True.
Or : left (infer right) (infer output) => trait (left {right} -> output)
instance (Or Boolean Boolean Boolean)
instance (Or (Maybe value) value value) Order
Implement this trait to enable comparisons between two values of your type.
Order : value => trait (value value -> Ordering)
default error instance (Order value)
instance (Order Number) Ordering
The result of a comparison between two values.
Ordering : type {
Is-Less-Than
Is-Equal-To
Is-Greater-Than
} Power
Power raises left to the power of right, returning a power.
Power : left right (infer power) => trait (left right -> power)
instance (Power Number Number Number)
default error instance (Power left right power)
error instance (Power () right power) prompt
prompt asks the user to enter a value.
prompt :: String -> value where (value :: String) (Read value) random
random produces a random result.
random :: result where (Random () result) random-in
random-in produces a random result within the range range.
random-in :: range -> result where (Random range result) Range
A continuous range between two numbers. Each bound may be nan to
indicate that the range is unbounded in that direction.
Range : index => type {
min :: index
max :: index
} Read
Read converts from a String to a value.
Read : value => trait (String -> Maybe value)
default error instance (Read value)
instance (Read String)
instance (Read Number) reduce
reduce calls f on each element in container, accumulating the result into a single result.
reduce :: result (f :: (result element -> result)) -> container -> result where (As-Sequence container element) Remainder
Remainder divides left by right, returning the remainder as a remainder.
Remainder : left right (infer remainder) => trait (left right -> remainder)
instance (Remainder Number Number Number)
default error instance (Remainder left right remainder)
error instance (Remainder () right remainder) remove
remove removes a element from set_, returning a new set.
remove :: element -> (set_ :: (Set element)) -> Set element where (Equal element) (Hash element) remove-at
remove-at removes the element at a particular location inside list, producing a new list.
remove-at :: Number -> (list :: (List element)) -> Maybe (List element) remove-entry
remove-entry removes an entry from dictionary by its key, returning a new dictionary.
remove-entry :: key -> (dictionary :: (Dictionary key value)) -> Dictionary key value where (Equal key) (Hash key) repeat
repeat runs body repeatedly.
repeat :: condition {body} -> () where (Repeat-Condition condition) (body :: ()) Repeat-Condition
Determines whether to evaluate a repeat body again.
Repeat-Condition : condition => trait (condition -> Sequence ())
instance (Repeat-Condition While)
instance (Repeat-Condition Forever)
error instance (Repeat-Condition (n :: Number))
instance (Repeat-Condition Times) replicate
Create a sequence that produces element n times.
replicate :: (n :: Number) -> element -> Sequence element sequence
Create a sequence of element values.
sequence :: {Maybe element} -> Sequence element Sequence
A container for a sequence that produces the next value on demand.
Sequence : element => type {next :: {Maybe element}} Set
An unordered collection of unique elements.
Set : element => type {dictionary :: Dictionary element ()} show
show displays value on the screen.
show :: value -> () where (Describe value) sin
sin calculates the sine of angle.
sin :: (angle :: Angle) -> Number split
split splits collection into groups of consecutive element elements separated by element.
split :: element -> collection -> Sequence (List element) where (As-Sequence collection element) (Equal element) split-by
split-by splits collection into groups of consecutive element elements separated by separator.
split-by :: (separator :: (element -> Boolean)) -> collection -> Sequence (List element) where (As-Sequence collection element) sqrt
sqrt calculates the square root of n.
sqrt :: (n :: Number) -> Number Stride
A range between two numbers that counts up in discrete steps.
Stride : index => type {
min :: index
max :: index
step :: index
} Subtract
Subtract subtracts right from left, returning a difference.
Subtract : left right (infer difference) => trait (left right -> difference)
instance (Subtract Number Number Number)
default error instance (Subtract left right difference)
error instance (Subtract () right difference) sum
sum calculates the sum of all the n elements in container.
sum :: container -> n where (As-Sequence container n) (Initial n) (Add n n n) tail
tail retrieves all but the first element inside list, or None if the list is empty.
tail :: (list :: (List element)) -> Maybe (List element) take
take takes up to count items from collection.
take :: (count :: Number) -> collection -> Sequence element where (As-Sequence collection element) tan
tan calculates the tangent of angle.
tan :: (angle :: Angle) -> Number times
times repeats n times.
times :: (n :: Number) -> Times transform
transform transforms the input elements in container into output elements using f.
transform :: (input -> output) -> container -> Sequence output where (As-Sequence container input) unzip
unzip splits the left-element-right-element pairs in collection into two separate sequences.
unzip :: collection -> (left; right) where (Initial left) (Initial right) (As-Sequence collection (left-element; right-element)) (Extend left left-element) (Extend right right-element) while
while repeats so long as condition is True.
while :: (condition :: {Boolean}) -> While zip
zip creates a sequence that produces left-element-right-element pairs from left and right, stopping once either runs out of elements.
zip :: left right -> Sequence (left-element; right-element) where (As-Sequence left left-element) (As-Sequence right right-element)