كل عامل يستطيع برنامج .lolo استدعاءه، من السجل المعتمد الذي يضمّنه المترجم.
نطاقات الأسماء في هذه الصفحة: anim/, ease/, noise/, prob/.
anim/direction-from-deltaFacing direction string from (dx,dy); 4-way (default) or 8-way
(anim/direction-from-delta dx dy)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
dx | number | X delta |
dy | number | Y delta (variadic) |
القيمة المعادة: string
مثال
(anim/direction-from-delta 1 0) // => "right"anim/frame-atFrame index for elapsed time; loops by default, else clamps to last
(anim/frame-at elapsed frameCount frameDuration)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
elapsed | number | Elapsed time |
frameCount | number | Total frame count |
frameDuration | number | Duration per frame (variadic) |
القيمة المعادة: number
مثال
(anim/frame-at 1000 8 100) // => 2anim/sheet-rectSource rect {sx,sy,sw,sh} for a frame index on a sprite sheet
(anim/sheet-rect frameIdx frameW frameH sheetW)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
frameIdx | number | Frame index |
frameW | number | Frame width |
frameH | number | Frame height |
sheetW | number | Sheet width |
القيمة المعادة: object
مثال
(anim/sheet-rect 1 32 32 128) // => {"sx": 32, "sy": 0, "sw": 32, "sh": 32}ease/applyApply an easing curve to t∈[0,1]: linear, in-quad, out-quad, in-out-quad, in-cubic, out-cubic, in-out-cubic, elastic-out, bounce-out (unknown → linear)
(ease/apply t curve)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
t | number | Time value in [0, 1] |
curve | string | Easing curve name |
القيمة المعادة: number
مثال
(ease/apply 0.5 "in-quad") // => 0.25ease/smoothstepSmoothstep: clamp((x-edge0)/(edge1-edge0),0,1) then tt(3-2*t)
(ease/smoothstep x edge0 edge1)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
x | number | Input value |
edge0 | number | Lower edge |
edge1 | number | Upper edge |
القيمة المعادة: number
مثال
(ease/smoothstep 0.5 0 1) // => 0.5noise/fbmFractal Brownian motion: summed perlin octaves (clamped 1..8); output [-1,1]
(noise/fbm x y octaves)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
x | number | X coordinate |
y | number | Y coordinate |
octaves | number | Octave count (variadic) |
القيمة المعادة: number
مثال
(noise/fbm 0.5 0.3 4) // => 0.234noise/perlin2D Perlin noise at (x,y) with optional seed; output [-1,1]
(noise/perlin x y)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
x | number | X coordinate |
y | number | Y coordinate (variadic) |
القيمة المعادة: number
مثال
(noise/perlin 0.5 0.3) // => 0.123noise/simplexValue-coherent noise (perlin-derived) at (x,y) with optional seed; output [-1,1]
(noise/simplex x y)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
x | number | X coordinate |
y | number | Y coordinate (variadic) |
القيمة المعادة: number
مثال
(noise/simplex 0.5 0.3) // => 0.567prob/betaSample from a Beta(alpha, beta) distribution
(prob/beta alpha beta)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
alpha | number | Shape parameter α > 0 |
beta | number | Shape parameter β > 0 |
القيمة المعادة: number
مثال
(prob/beta 2 5) // => value in (0, 1), mean ≈ 0.286prob/categoricalWeighted random selection from items
(prob/categorical items weights)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
items | array | Array of items to sample from |
weights | number[] | Non-negative weights (need not sum to 1) |
القيمة المعادة: any
مثال
(prob/categorical (a "b" "c") [1 2 1]) // => "b" ~50%prob/conditionMark current sample as rejected if predicate is false
(prob/condition predicate)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
predicate | boolean | Condition that must hold for the sample to be accepted |
القيمة المعادة: void · يعمل على: any
مثال
(prob/condition [">",5,0])prob/credible-intervalCompute symmetric credible interval from samples
(prob/credible-interval samples alpha)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
samples | number[] | Numeric samples |
alpha | number | Significance level (e.g. 0.05 for 95% CI) |
القيمة المعادة: array
مثال
(prob/credible-interval [1,2,3,4,5] 0.05) // => 95% CIprob/expected-valueMean of numeric samples
(prob/expected-value samples)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
samples | number[] | Array of numeric samples |
القيمة المعادة: number
مثال
(prob/expected-value [1 2 3 4]) // => 2.5prob/flipBernoulli trial: returns true with probability p
(prob/flip p)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
p | number | Probability (0.0 to 1.0) |
القيمة المعادة: boolean
مثال
(prob/flip 0.7) // => true ~70% of the timeprob/gaussianSample from a Gaussian (normal) distribution
(prob/gaussian mu sigma)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
mu | number | Mean |
sigma | number | Standard deviation |
القيمة المعادة: number
مثال
(prob/gaussian 0 1) // => standard normal sampleprob/histogramBin numeric samples into a histogram
(prob/histogram samples bins)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
samples | number[] | Numeric samples |
bins | number | Number of bins |
القيمة المعادة: object
مثال
(prob/histogram [1,2,3,4,5] 2)prob/inferLike posterior but returns {mean, variance, samples, acceptRate}
(prob/infer model evidence query n)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
model | expression | Model expression (lazy) |
evidence | expression | Boolean evidence condition (lazy) |
query | expression | Value to summarize (lazy) |
n | number | Number of simulation runs |
القيمة المعادة: object
مثال
(prob/infer ["prob/gaussian",0,1] [0.5] "mu" 5000)prob/percentileGet the p-th percentile (0-100) from samples
(prob/percentile samples p)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
samples | number[] | Numeric samples |
p | number | Percentile (0 to 100) |
القيمة المعادة: number
مثال
(prob/percentile [1,2,3,4,5] 50) // => medianprob/poissonSample from a Poisson distribution
(prob/poisson lambda)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
lambda | number | Rate parameter λ > 0 |
القيمة المعادة: number
مثال
(prob/poisson 4) // => integer, mean ≈ 4prob/posteriorRejection sampling: returns accepted query values
(prob/posterior model evidence query n)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
model | expression | Model expression that sets entity fields (lazy) |
evidence | expression | Boolean evidence condition (lazy) |
query | expression | Value to collect from accepted samples (lazy) |
n | number | Number of simulation runs |
القيمة المعادة: array
مثال
(prob/posterior ["prob/gaussian",0,1] [0.5] "mu" 5000)prob/sampleEvaluate an expression n times and collect results
(prob/sample n expr)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
n | number | Number of samples |
expr | expression | Expression to evaluate (lazy) |
القيمة المعادة: array
مثال
(prob/sample 1000 (prob/flip 0.5))prob/seedSet seeded PRNG for deterministic probabilistic sampling
(prob/seed n)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
n | number | Seed value |
القيمة المعادة: void · يعمل على: any
مثال
(prob/seed 42)prob/uniformSample from a uniform distribution [lo, hi)
(prob/uniform lo hi)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
lo | number | Lower bound (inclusive) |
hi | number | Upper bound (exclusive) |
القيمة المعادة: number
مثال
(prob/uniform 0 1) // => value in [0, 1)prob/variancePopulation variance of numeric samples
(prob/variance samples)المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
samples | number[] | Array of numeric samples |
القيمة المعادة: number
مثال
(prob/variance [2 4 4 4 5 5 7 9]) // => 4