Skip to main content

MonadOp

Enum MonadOp 

Source
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 ).

Fields

§origin: i64
§

GradeDown

The stable permutation that sorts the items descending (J \:, APL ).

Fields

§origin: i64
§

IotaJ

J i.: integers 0.. filling shape |y|, reversed along negative axes.

§

IotaApl

APL on a scalar: origin .. origin+y-1.

Fields

§origin: i64
§

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.

Fields

§origin: i64
§boxed_coords: bool
§

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.

Fields

§origin: i64
§fixed: bool
§float_at_zero: bool
§

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.

Fields

§polar: bool
§

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.

Fields

§pass_chars: bool
§

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.

Fields

§apl: bool
§

NotYet(&'static str)

Present in the language, not implemented: named feature.

§

None

No monadic meaning exists for this primitive in its language.

Trait Implementations§

Source§

impl Clone for MonadOp

Source§

fn clone(&self) -> MonadOp

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MonadOp

Source§

impl Debug for MonadOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MonadOp

Source§

impl PartialEq for MonadOp

Source§

fn eq(&self, other: &MonadOp) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MonadOp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,