@thi.ng/pointfree
Version:
Pointfree functional composition / Forth style stack execution engine
52 lines • 1.4 kB
TypeScript
import type { StackContext } from "./api.js";
/**
* Pushes current env onto d-stack.
*
* Stack effect: `( -- env )`
*
* @param ctx -
* @param env -
*/
export declare const pushenv: (ctx: StackContext) => StackContext;
/**
* Loads value for `key` from current env and pushes it on d-stack.
* Throws error if var doesn't exist.
*
* Stack effect: `( key -- env[key] )`
*
* @param ctx -
* @param env -
*/
export declare const load: (ctx: StackContext) => StackContext;
/**
* Stores `val` under `key` in env.
*
* Stack effect: `( val key -- )`
*
* @param ctx -
* @param env -
*/
export declare const store: (ctx: StackContext) => StackContext;
/**
* Higher order word. Similar to {@link load}, but always uses given
* preconfigured `key` instead of reading it from d-stack at runtime
* (also slightly faster). Throws error if var doesn't exist.
*
* Stack effect: `( -- env[key] )`
*
* @param ctx -
* @param env -
*/
export declare const defLoadKey: (key: PropertyKey) => (ctx: StackContext) => StackContext;
/**
* Higher order word. Similar to {@link store}, but always uses given
* preconfigure `key` instead of reading it from d-stack at runtime
* (also slightly faster).
*
* Stack effect: `( val -- )`
*
* @param ctx -
* @param env -
*/
export declare const defStoreKey: (key: PropertyKey) => (ctx: StackContext) => StackContext;
//# sourceMappingURL=env.d.ts.map