A handy set of utility functions.
Gets the Height of the canvas. `n` is an optional float value to multiply to the canvas height.
Checks if a Point is inside the canvas or not. Returns a boolean.
(margin-range A B N MARGIN)
Returns a sequence of `N` element going from `A` to `B`. `MARGIN` defines a certain margin from A and B.
(n-times n f)
Call a certain function N times on its output.
Shortcut for (not (nil? x)) Returns a boolean.
Returns true if the random is inside the value range (0-1)
Prints to the original System/out stream. Useful when working with multiple tools and you want to output always on the repl console.
Process a drawing options dictionary.
(r-float low high)
Get a random float number between two values.
(r-gaussian center ampl)
Returns a random number from a gaussian distribution. `center` can be changed to define a custom mean. `ampl` can be changed to define the amplitude of the distribution.
(r-gaussian-abs center ampl)
Returns a random number from a positive half gaussian. See r-gaussian for more info.
(r-int low high)
Gets a random int number between two values (Exclusive).
(r-normal from to)
Returns a random number from a normal distribution. defaults return a float from 0 to 1. `to` can be defined to get a random float from 0 to `to` (Exclusive). `from` can be defined to get a random float from `from` (inclusive) to `to` (exclusive).
(r-normal-int from to)
Returns a random INTEGER number from a normal distribution. See r-normal for more info.
Sets the seed for the random functions.
(replace-first SEQ NEW)
Returns a new sequence from `SEQ` with the first element replaced with `NEW`.
(replace-first-and-last SEQ NEWF NEWL)
Returns a new sequence from `SEQ` with the first and last element replaced with `NEWF` and `NEWL`.
(replace-last SEQ NEW)
Returns a new sequence from `SEQ` with the last element replaced with `NEW`.
(replace-nth-seq s ele ind)
IMPROVE/CONTROL Replace the nth element from a sequence.
(replace-pos-seq s ele position)
IMPROVE/CONTROL Replace an element inside a sequence.
position is a 0-1 float that indicates the relative position of the element to replace.
Resets the blend mode to default.
Resets the drawing options to default values.
IMPROVE/CONTROL Converts a Sequence to a Vector.
IMPROVE/CONTROL Converts a Vector to a Sequence.
Gets the Width of the canvas. `n` is an optional float value to multiply to the canvas width.