μ
standard library
Standard library
General-purpose functions auto-loaded at startup from stdlib/stdlib.mu.
| name | definition | description |
|---|---|---|
| sum | +/ | Total sum — +/ fold over a list. Returns a scalar. |
| sums | +\ | Running sums — cumulative prefix sum using +\ scan. Returns a list the same length as x. |
| ssum | {x*x}/ | Total sum of squares — maps x*x element-wise then folds with +/. |
| ssums | {x*x}\ | Running sum of squares — maps x*x then scans with +\, returns list. |
| count | # | Count — number of elements in a list. |
| min | {*<x} | Minimum — smallest element of a list (first of ascending sort). |
| max | {*>x} | Maximum — largest element of a list (first of descending sort). |
| prod | */ | Product — */ fold over a list. Returns a scalar. |
| prds | *\ | Running products — cumulative prefix product using *\ scan. Returns a list the same length as x. |
| first | * | First — first element of a list. |
| last | {x@(#x)-1} | Last — last element of a list. |
| fibstep | {(1_ x),+/x} | Fibonacci step — advances a (a b) pair to (b a+b); used with n fibstep/ 0 1. |
| fib | {*(x fibstep/ 0 1)} | Nth Fibonacci number (0-indexed): fib 0 = 0, fib 7 = 13. |
| raze | ,/ | Raze — flatten one level: ,/ fold with join over a list-of-lists. Returns a flat list. |
| deltas | {x - 0,x} | Successive differences — first difference of a list. deltas 1 3 6 10 → 1 2 3 4 |
| ratios | {x % 1,-1 _ x} | Successive ratios — element-wise ratio of consecutive items. ratios 100 102 99 105 → 100.0 1.02 0.970588 1.060606 (same length as input) |