pub enum MonadOp {
Show 51 variants
Scalar(ScalarMonad),
ShapeOf,
Tally,
Ravel,
TransposeAxes,
Head,
Behead,
Tail,
Curtail,
Reverse,
Nub,
GradeUp {
origin: i64,
},
GradeDown {
origin: i64,
},
IotaJ,
IotaApl {
origin: i64,
},
Echo,
Same,
Format,
DecodeBits,
EncodeBits,
Itemize,
TableOf,
Enclose(Enclose),
Open,
Raze,
First,
Enlist,
Depth,
Indices {
origin: i64,
boxed_coords: bool,
},
Steps,
ToExact,
NthPrime,
PrimeFactors,
MatrixInverse,
Roll {
origin: i64,
fixed: bool,
float_at_zero: bool,
},
ComplexParts {
polar: bool,
},
SelfClassify,
NubSieve,
Unicode {
pass_chars: bool,
},
Words,
Nest,
LevelOf,
MapPaths,
PolyRoots,
PolyDeriv,
AnagramIndex,
CycleForm,
Split,
Execute {
apl: bool,
},
NotYet(&'static str),
None,
}Expand description
Monadic meaning of a primitive.
Variants§
Scalar(ScalarMonad)
ShapeOf
Shape as an integer vector (J $, APL ⍴).
Tally
Item count as a scalar (J #, APL ≢).
Ravel
All elements as a vector (J/APL ,).
TransposeAxes
Reverse the axes (J |:, APL ⍉).
Head
First item (J {.).
Behead
All but the first item (J }.).
Tail
Last item (J {:); a cell of fills when there are no items.
Curtail
All but the last item (J }:).
Reverse
Reverse the items, i.e. along the leading axis (J |., APL ⊖).
Nub
Distinct items in first-occurrence order (J ~., APL ∪).
GradeUp
The stable permutation that sorts the items ascending (J /:, APL ⍋).
GradeDown
The stable permutation that sorts the items descending (J \:, APL ⍒).
IotaJ
J i.: integers 0.. filling shape |y|, reversed along negative axes.
IotaApl
APL ⍳ on a scalar: origin .. origin+y-1.
Echo
Print the formatted argument, yield an empty array (J echo).
Same
The argument itself (APL ⊢).
Format
J ": / APL ⍕: the argument as the characters that display it.
A rank-0 argument gives a character vector, a rank-r one a character
array of rank r (the display’s lines, padded to one width).
DecodeBits
J #. / APL monadic base-2 decode: a vector of digits as one number.
EncodeBits
J #:: base-2 encode. The width comes from the largest magnitude in
the whole argument, so the verb has infinite rank; the digits become
a new trailing axis.
Itemize
J ,:: a leading axis of one (shape 2 3 becomes 1 2 3).
TableOf
APL ⍪: the argument as a matrix — one row per item, that item’s
elements ravelled. A scalar becomes 1×1, a vector n×1.
Enclose(Enclose)
J < / APL ⊂: the argument as one box.
Open
J > / APL ⊃: open a box (rank 0, so the frame reassembles the
contents, filling where their shapes differ). A non-box opens to
itself.
Raze
J ;: raze — the items of the opened boxes, catenated.
First
APL ↑: the first element, disclosed; the type’s fill when there
is none.
Enlist
APL ∊: enlist — every leaf element, in ravel order, as a vector.
Depth
APL ≡: depth — 0 for a simple scalar, 1 for a simple array, one
more than the deepest content for a box.
Indices
J I. / APL ⍸: index i repeated y[i] times. J applies at
rank 1; APL applies whole, and answers a rank-2-or-higher argument
with one boxed coordinate vector per occurrence.
Steps
J i:: the integers from -y to y, one step apart.
ToExact
J x:: the argument in the exact types — extended when every value
is whole, rational otherwise.
NthPrime
J p:: the y-th prime, counting from zero.
PrimeFactors
J q:: y’s prime factors, ascending, with multiplicity.
MatrixInverse
J %. / APL ⌹: the inverse, or the least-squares pseudo-inverse.
Roll
J ? / ?. and APL ?: roll. Each element of y is replaced by a
random value below it, counted from origin. fixed restarts the
generator at its fixed seed, which is J’s ?.; float_at_zero is
J’s ? 0, a uniform double, where APL refuses a zero.
ComplexParts
J +. y (rectangular) and *. y (polar): the two parts of a
complex number as a two-element vector, which becomes a new trailing
axis. A real argument is the pair y 0 / |y| 0.
SelfClassify
J =: self-classify — one row per distinct item, holding 1 where
that item stands among y’s items.
NubSieve
J ~: / APL ≠: nub sieve — 1 at each item that has not occurred
before.
Unicode
J u: / APL ⎕UCS: codepoints become characters, characters become
their codepoints. pass_chars is J’s monad, which answers characters
with themselves rather than converting them.
Words
J ;:: J’s own tokeniser over a character list, one box per word.
Nest
APL ⊆ (Dyalog): nest — enclose y unless it is already nested, or
a simple scalar, which cannot be enclosed any further.
LevelOf
J L.: the boxing level — 0 for anything unboxed, one more than the
deepest content otherwise.
MapPaths
J {::: y’s box structure with every leaf replaced by the path that
fetches it — a boxed list holding one index per level descended.
PolyRoots
J p.: the roots of the polynomial whose ascending coefficients y
holds, as the boxed pair multiplier ; roots; a boxed argument of
that form converts back to coefficients.
PolyDeriv
J p..: the derivative of the polynomial y’s ascending coefficients
describe, again as coefficients.
AnagramIndex
J A.: the anagram index of the permutation y’s items rank as.
CycleForm
J C.: a direct permutation as its cycles, or a boxed list of
cycles as the direct permutation. The argument’s type decides which.
Split
APL ↓: split — each major cell of y enclosed, the leading axis
becoming the shape of the result.
Execute
J ". y / APL ⍎ y: compile the characters of y as a program of
this language and run it here, over the names the caller already
has. Nothing else about the sandbox changes: the nested program can
reach exactly what the outer one can.
NotYet(&'static str)
Present in the language, not implemented: named feature.
None
No monadic meaning exists for this primitive in its language.
Trait Implementations§
impl Copy for MonadOp
impl Eq for MonadOp
impl StructuralPartialEq for MonadOp
Auto Trait Implementations§
impl Freeze for MonadOp
impl RefUnwindSafe for MonadOp
impl Send for MonadOp
impl Sync for MonadOp
impl Unpin for MonadOp
impl UnsafeUnpin for MonadOp
impl UnwindSafe for MonadOp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more