Draws a chart. Type can be either 'bar' or 'scatter'.
Adds two values. Can be two numbers, with or without units. Can also be two lists. Or a number and a list. Follows the rules of all binary operations.
// use the operator form 4 + 2 = 6
// use the function form add(4,2) = 6
// number + list 4 + [2,3,4] = [6,7,8]
// list + list adds pairwise [1,2,3] + [4,5,6] = [5,7,9]
subtracts two values. Can be two numbers, with or without units. Can also be two lists. Or a number and a list. Follows the rules of all binary operations.
//list - list [1,2,3] - [4,5,6] = [-3,-3,-3]
Multiplies two values. Can be two numbers, with or without units. Can also be two lists. Or a number and a list. Follows the rules of all binary operations.
// use the operator form 4 * 2 = 8
// use the function form multiply(4,2) = 8
// number + list 4 * [2,3,4] = [8,12,16]
// list + list adds pairwise [1,2,3] * [4,5,6] = [4,10,18]
Divides two values. Can be two numbers, with or without units. Can also be two lists. Or a number and a list. Follows the rules of all binary operations.
// use the operator form 4 / 2 = 2
// use the function form divide(4,2) = 2
// number + list 4 / [2,3,4] = [2,1.333,1]
// list + list adds pairwise [1,2,3] / [4,5,6] = [0.25,0.2,0.5]
raises a value to a power. Can be two numbers, with or without units. Can also be two lists. Or a number and a list. Follows the rules of all binary operations.
// use the operator form 4 ** 2 = 16
// use the function form power(4,2) = 16
// number + list 4 ** [2,3,4] = [16,64,256]
// list + list adds pairwise [1,2,3] ** [4,5,6] = [1, 32, 729]
returns the square root of a scalar value. If the value has a unit, the return will be in the same unit. Can also work on lists by applying the square root to each value in the list. Follows the rules of all unary operations.
returns the negation of the value
returns the factorial of the number
returns the sine of the angle specified in radians
returns the cosine of the angle specified in radians
returns the tangent of the angle specified in radians
returns the absolute value of the value
performs remainder division
8 mod 5 = 3
returns true of the first value is less than the other
//operator form
Returns true if the number is prime, false otherwise.
creates a new list of numbers, from min to max, counting by step. If min is left out it defaults to 0. If step is left out it defaults to 1. *note* the count will always go up to max, but not include it. Thus `range 5` returns `[0,1,2,3,4]`
// List from 0 to 13: range(5) = [0,1,2,3,4]
// same with max: range(max:5) = [0,1,2,3,4]
// 103 to 108 range(min:103, max:108) = [103,104,105,106,107]
// multiples of 5 up to 100: range(100, step:5) = [0,4,9]
returns length of list
length ([1,8,2]) = 2
returns part of the list. positive count takes from the beginning. negative count takes from the end
data << range(0,10) take(data, 2) = [0, 1]
data << range(0,10) take(data, -2) = [8,9]
removes part of the list and returns the rest. positive count drops from the start. negative count drops from the end.
data << range(0,10) drop(data,2) = [2,3,4,5,6,7,8,9]
data << range(0,10) drop(data,-2) = [0,1,2,3,4,5,6,7]
Joins two lists. returns the new combined list.
join([1,2], [99,100]) = [1,2,99,100]
applies the function 'with' to every element of the list, creating a new list
data << range(3) map(data, with: x => x*2) // returns [2,4,6],
double << (x) => { x * 2 } range(10) >> map(with:double) // returns [1,2,3,5,7]
return a subset of a list based on if the 'where' function returns true or false
//is_prime is a built in function that returns true or false if the number is prime select(range(10), where:is_prime) // returns [1,2,3,5,7]
returns a copy of the list with a reverse order
reverse([42,2,4]) //returns [4,2,42]
adds a list of numbers together
sum([42,2,4]) // returns 48
returns the biggest element in the list
max([4,2,42]) //returns 42
returns the smallest element in the list
min([4,2,42]) //returns 2