Semicolon (;) - Statement separator. E.g.,
statement1 ; statement2
At sign (@) - Statement separator. Reverses statements. E.g.,
statement1 @ statement2
is the same as
statement2 ; statement1
[element0, element1, ..., elementN-1]
is an N-element array. Array indices are 0-based.
[start:end:step]
is the array of integers from 'start' to 'end' in steps of 'step'
[start..end]
is the array of integers from 'start' to 'end'
start--end
is also the array of integers from 'start' to 'end'
In the following descriptions, capital letters A,B are primary expressions that evaluate to arrays. M,N,S evaluate to integers. C and D are conditional expressions that evaluate to true/false. P and Q are floating point numbers from 0 to 1. R is a floating point number. V is the value of any primary expression. G, H are expressions used as functions. U is a variable id.
Built-ins may be entered as all caps, all lowercase or Capitalized: PROB, prob and Prob should all work.
-R
: unary minus~C
: logical negation. ~P
is the complement of the probability P
. ~CDF(V)
finds the survival function of the probability distribution V
.N!
: factorialCOMB N, K
: Combinations, binomial coeficient, or N choose K.PERM N, K
: Permutations. Ordered arrangements of K distinct elements selected from a set of size N.FLOOR R
: Integer part of R.LN R
: The natural logarithm of R.PROB V
: JSON object with pmf of the dice expression V. See the section in the EXAMPLES file. This feature is new and currently limited.PROB C
: The exact probability of C. See the section in the EXAMPLES file for more info, including limitations.WHILE (C) { statements }
: Execute statements while condition C is true.d%
or Nd%
: percentile die or diceSUM A
: sum the elements in array A; or sum the values in the JSON object A.COUNT A
: count the elements in AMEAN A
: arithmetic mean of AMEDIAN A
: middle element of A is count is odd or arithmetic mean of middle-most elements is count is evenMODE A
: mode of ASD A
: standard deviation of AVAR A
: variance of ASKEW A
: Skewness of AKURT A
: Kurtosis "excess" of AMIN A
: minimum value of AMAX A
: maximum of ACHOOSE A
: select element of A at randomSTATS A
: JSON object with descriptive statistics for ATALLY A
: JSON object with unique elements of A and their countsFREQ A
: JSON object with unique elements of A and their counts divided by the totalUNIQ A
: array of unique elements of AA HIGH N
: highest N elements of AA LOW N
: lowest N elements of AA TAKE N
: first N elements of AA DROP N
: first (COUNT(A) - N) elements of APICK [V1, P1, V2, P2, ...]
: select V1, V2, ... with corresponding probabilities P1, P2, ...n # PICK [V1, P1, V2, P2, ...]
: select V1, V2, ... with corresponding probabilities P1, P2, ... with replacementn WITHOUT [V1, P1, V2, P2, ...]
select n values V1, V2, ... with corresponding probabilities P1, P2, ... without replacementLOOKUP [C1, V1, C2, V2, ...]
: returns V1 if C1 is true, V2 is C2 is true, ... which ever is true first. Only 1 value is returned.MAP G, U, A
: returns array built by taking each A, subsituting it into U and executing GFILTER G, U, A
: returns array of each A that makes G true when subsituted into U.[A1,A2,...] zip [B1,B2,...]
or A⇈B
: returns array [A1,B1,A2,B2,...]
unzip [A1,B1,A2,B2,...]
or ⇊A
: returns array of arrays [[A1,A2,...], [B1,B2,...]]
flatten [A1,[A2],[A3,[A4,A5]],...]
: returns array [A1,A2,A3,A4,A5,...]
[A1,A2,...] union [B1,B2,...]
or A∪B
: Union of arrays [A1,A2,..., B1,B2,...]
V in A
or V∈A
: returns 0-based index of V in A or -1 if not presentA of V
or A∘V
: returns element of A at index V. in this case, A may be an array or JSON object. Use parens to nest: (A∘V1)∘V2
. V may be an array, e.g., [A0,A1,A2,A3]∘[2,0]
yield[A2,A0]
.A dot B
or A.B
: Inner product of arraysCDF V
: cumulative distribution function of V~CDF V
: survival function of VORDERSTAT V, N, K
: The Kth order statistic of a sample of N values VCOMP N, K, L, U
: the composition of the natural number N into K parts no part less than L or greater than UDOMAIN O
: Array with numeric keys of O, assuming O in format returned by PROB
RANGE O
: Array with numeric values of O, assuming O in format returned by PROB
GEOM P, 0|1
: Geometric distribution with probability P. Specifying a second parameter produces a shifted distribution. Do geom 0.5
to get one random variate. Do prob(geom 0.5)
to get an object with the pmf of the distribution up to values with probabilities of about 1 in a billion. Do stats(geom 0.5)
to see summary statistics.BINOM N, P
: Binomial distribution with N trials and probability P. Do binom 10, 0.5
to get one random variate. Do prob(binom 10, 0.5)
to get an object with the pmf of the distribution up to values with probabilities of about 1 in a billion. Do stats(binom 10, 0.5)
to see summary statistics.CENSOR V, L, U
: If V is the pmf of a probability distribution, this yields a censored distribution, lumping all probability mass below L with L, and all above U with U.quote U
or 'U
: does NOT evaluate U. Returns its definition instead.eval V
or `(V) : immediately evaluate V in parser. not recommended. see Odds & ends section of EXAMPLES for details.R1^R2
(or A^R or R^A or A^B) : exponentiation. groups to the left. arguments may be reals or arrays of reals.√(R)
(or ROOT R) : square root of RR2√R1
(or R2 ROOT R1) : R2-th roor of R1R1 * R2
(or R * A or R * A or A * B) : multiplication. arguments may be reals or arrays of reals.R1 / R2
(or R / A or R / A or A / B) : divisionR1 mod R2
(or R mod A or R mod A or A mod B) : remainder after division by left modulo rightR1 + R2
(or R + A or R + A or A + B) : additionV1 > V2
: greater than. V1 and V2 may be reals or arrays of reals. Ditto for <, =, !=, >=, ≥, <=, ≤.C && D
: logical and. you can spell out the word "and" instead.C || D
: logical orC ? V1 : V2
is the ternary condition. If C is true return V1 other V2N # V
returns N samples of expression V, e.g., 6#3d6 gives an arry of 6 rolls of 3d6.U <- V or U ← V
: "lazy" assignment of V
to U
, e.g. if you assign A<-2d6+6
, then every time you execute A
you'll roll a new value.U <: V or U ↤ V
: evaluates V
then assigns to U, e.g. if you assign A<:2d6+6
, then A has stores the result of one roll.V
may be a block of statemens, e.g., U <- { statements }
in which case the value of the last statement is assignedlast
: contains the last result to be evaluated. May be used in expressions, e.g. max(last+[2d8,d12])
PRINT V
: print the given expressionVARS
: show all the variables that have been definedSAVE "file"
: save variables to fileSAVE
: save variables to "dice.sav"LOAD "file"
: load variables from fileLOAD
: load variables from "dice.sav"TRANSCRIPT "file"
: transcribe output to fileTRANSCRIPT
: transcribe output to "dice.out"TRANSCRIPT OFF
: stop transcribing outputHELP
: show screen full of sample usageVERSION
: display current Major/minor version, stage, build number, and dateLICENSE
: show copyright and GPL licenseEXIT
or QUIT or CLOSE or BYE or Ctrl+D : close the programLast update: Fri Sep 23 2016