Class Num
Hierarchy
- Cell<V>
- Num (View Summary)
Accessors
isEven
Returns this extends WritableBrand ? Writable<Bool> : Bool
isOdd
True when odd.
Returns this extends WritableBrand ? Writable<Bool> : Bool
Methods
add
Parameters
- b: Val<number>
Returns this
affine
clamp
cyclic
Reads pass through; a write picks the value closest to the current one modulo
period, so dragging an angle never jumps a full turn.Parameters
- period: Val<number>
Returns this
derive
Read-only same-type view: the RO dual of the endo
.lens. For a cross-type view use the typed staticTarget.derive(src, fn).Parameters
- this: Cell<number>
- fn: (v: number) => number
Returns this
divisibleBy
exp
Natural exponential; inverts via log.
Returns this
greaterThan
lens
- lens(
this: Cell<number>,
fwd: (v: number) => number,
bwd: (target: number, current: number) => number,
): thisEndomorphic lens. A 2-arg
bwd(view, current)consults the current source; a 1-argbwd(view)reconstructs it from the view alone.Parameters
- this: Cell<number>
- fwd: (v: number) => number
- bwd: (target: number, current: number) => number
Returns this
lessThan
merge
peek
Returns number
quantize
Snap reads and writes to the nearest multiple of
step(lossy).Parameters
- step: Val<number>
Returns this
scale
Parameters
- k: Val<number>
Returns this
sin
Sine of
this(radians). The inverse is multi-valued; a write picks the angle nearest the current value, so a drag stays on its branch.Returns this
sub
Parameters
- b: Val<number>
Returns this
through
to
Staticcoerce
Staticderive
Staticis
Staticlens
- lens<C extends AnyCellCtor, P>(
this: C,
parent: Read<P>,
fwd: (v: P) => Inner<InstanceType<C>>,
bwd: (target: Inner<InstanceType<C>>, v: P) => P,
): Writable<InstanceType<C>>Writable lens.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N; a 2-argbwdreads the source, a 1-argbwdreconstructs it.Cls.lens(parent(s), spec)builds a complement-carrying lens from{ init, step, fwd, bwd }.Type Parameters
- C extends AnyCellCtor
- P
Parameters
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P extends readonly Read<unknown>[]>(
this: C,
parents: P,
fwd: (vals: ReadValues<P>) => Inner<InstanceType<C>>,
bwd: (
target: Inner<InstanceType<C>>,
vals: ReadValues<P>,
) => BackUpdates<ReadValuesOrSkip<P>>,
): Writable<InstanceType<C>>Writable lens.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N; a 2-argbwdreads the source, a 1-argbwdreconstructs it.Cls.lens(parent(s), spec)builds a complement-carrying lens from{ init, step, fwd, bwd }.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
Parameters
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P, Cm>(
this: C,
parent: Read<P>,
spec: StatefulLensSpec1<P, Inner<InstanceType<C>>, Cm>,
): Writable<InstanceType<C>>Writable lens.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N; a 2-argbwdreads the source, a 1-argbwdreconstructs it.Cls.lens(parent(s), spec)builds a complement-carrying lens from{ init, step, fwd, bwd }.Type Parameters
- C extends AnyCellCtor
- P
- Cm
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P extends readonly Read<unknown>[], Cm>(
this: C,
parents: P,
spec: StatefulLensSpec<ReadValues<P>, Inner<InstanceType<C>>, Cm>,
): Writable<InstanceType<C>>Writable lens.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N; a 2-argbwdreads the source, a 1-argbwdreconstructs it.Cls.lens(parent(s), spec)builds a complement-carrying lens from{ init, step, fwd, bwd }.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
- Cm
Returns Writable<InstanceType<C>>
True when even.