@thi.ng/pointfree
Version:
Pointfree functional composition / Forth style stack execution engine
161 lines • 4.85 kB
TypeScript
import type { StackContext } from "./api.js";
/**
* Removes `x` from d-stack, calls `q` and restores `x` to the top of
* the d-stack after quotation is finished.
*
* Stack effect: `( x q -- x )`
*
* Same behavior as: `[swap, movdr, exec, movrd]`, only the current
* implementation doesn't use r-stack and stashes `x` off stack.
*
* @param ctx -
*/
export declare const dip: (ctx: StackContext) => StackContext;
/**
* Removes `x y` from d-stack, calls `q` and restores removed vals
* to the top of the d-stack after quotation is finished.
*
* Stack effect: `( x y q -- x y )`
*/
export declare const dip2: import("./api.js").StackFn;
/**
* Removes `x y z` from d-stack, calls `q` and restores removed
* vals to the top of the d-stack after quotation is finished.
*
* Stack effect: `( x y z q -- x y z )`
*/
export declare const dip3: import("./api.js").StackFn;
/**
* Removes `x y z w` from d-stack, calls `q` and restores removed
* vals to the top of the d-stack after quotation is finished.
*
* Stack effect: `( x y z w q -- x y z w )`
*/
export declare const dip4: import("./api.js").StackFn;
/**
* Calls a quotation with a value on the d-stack, restoring the value
* after quotation finished.
*
* Stack effect: `( x q -- .. x )`
*/
export declare const keep: import("./api.js").StackFn;
/**
* Call a quotation with two values on the stack, restoring the values
* after quotation finished.
*
* Stack effect: `( x y q -- .. x y )`
*/
export declare const keep2: import("./api.js").StackFn;
/**
* Call a quotation with three values on the stack, restoring the values
* after quotation finished.
*
* Stack effect: `( x y z q -- .. x y z )`
*/
export declare const keep3: import("./api.js").StackFn;
/**
* First applies `p` to the value `x`, then applies `q` to the same
* value.
*
* Stack effect: `( x p q -- px qx )`
*/
export declare const bi: import("./api.js").StackFn;
/**
* First applies `p` to the two input values `x y`, then applies `q` to
* the same values.
*
* Stack effect: `( x y p q -- pxy qxy )`
*/
export declare const bi2: import("./api.js").StackFn;
/**
* First applies `p` to the three input values `x y z`, then applies `q`
* to the same values.
*
* Stack effect: `( x y z p q -- pxyz qxyz )`
*/
export declare const bi3: import("./api.js").StackFn;
/**
* Applies `p` to `x`, then `q` to `x`, and finally `r` to `x`
*
* Stack effect: `( x p q r -- px qx rx )`
*/
export declare const tri: import("./api.js").StackFn;
/**
* Applies `p` to the two input values `x y`, then same with `q`, and
* finally with `r`.
*
* Stack effect: `( x y p q r -- pxy qxy rxy )`
*/
export declare const tri2: import("./api.js").StackFn;
/**
* Applies `p` to the three input values `x y z`, then same with `q`,
* and finally with `r`.
*
* Stack effect: `( x y z p q r -- pxyz qxyz rxyz )`
*/
export declare const tri3: import("./api.js").StackFn;
/**
* Applies `p` to `x`, then applies `q` to `y`.
*
* Stack effect: `( x y p q -- px qy )`
*/
export declare const bis: import("./api.js").StackFn;
/**
* Applies `p` to `a b`, then applies `q` to `c d`.
*
* Stack effect: `( a b c d p q -- pab qcd )`
*/
export declare const bis2: import("./api.js").StackFn;
/**
* Applies `p` to `x`, then `q` to `y`, and finally `r` to `z`.
*
* Stack effect: `( x y z p q r -- )`
*/
export declare const tris: import("./api.js").StackFn;
/**
* Applies `p` to `u v`, then `q` to `w x`, and finally `r` to `y z`.
*
* Stack effect: `( u v w x y z p q r -- puv qwx ryz )`
*/
export declare const tris2: import("./api.js").StackFn;
/**
* Applies the quotation `q` to `x`, then to `y`.
*
* Stack effect: `( x y q -- qx qy )`
*/
export declare const bia: import("./api.js").StackFn;
/**
* Applies the quotation `q` to `x y`, then to `z w`.
*
* Stack effect: `( x y z w q -- qxy qzw )`
*/
export declare const bia2: import("./api.js").StackFn;
/**
* Applies the `q` to `x`, then to `y`, and finally to `z`.
*
* Stack effect: `( x y z q -- qx qy qz )`
*/
export declare const tria: import("./api.js").StackFn;
/**
* Applies the quotation to `u v`, then to `w x`, and then to `y z`.
*
* Stack effect: `( u v w x y z q -- quv qwx qyz )`
*/
export declare const tria2: import("./api.js").StackFn;
/**
* Applies `q` individually to both input vals `x y` and combines
* results with `and`. The final result will be true if both interim
* results were truthy.
*
* Stack effect: `( x y q -- qx && qy )`
*/
export declare const both: import("./api.js").StackFn;
/**
* Applies `q` individually to both input vals `x y` and combines results with `or`.
* The final result will be true if at least one of the interim results
* was truthy.
*
* Stack effect: `( x y q -- qx || qy )`
*/
export declare const either: import("./api.js").StackFn;
//# sourceMappingURL=dataflow.d.ts.map