glisp / session
session
Classes
Session
Defined in: session.ts:42
Constructors
Constructor
new Session(
parent):Session
Defined in: session.ts:46
Parameters
| Parameter | Type |
|---|---|
parent | Env |
Returns
Accessors
env
Get Signature
get env():
Env
Defined in: session.ts:55
Env to evaluate against: the session’s let-frame on top of the prelude.
Returns
Methods
ast()
ast():
LetAST
Defined in: session.ts:60
Snapshot of the session as a let-block AST. Re-parses cleanly.
Returns
bindings()
bindings(): readonly
string[]
Defined in: session.ts:69
Names currently bound in the session, in insertion order.
Returns
readonly string[]
evalAst()
evalAst(
ast):EvalResult
Defined in: session.ts:123
Evaluate an AST against the session env. Top-level (def "name" expr) / (undef "name") are intercepted as binding mutations on the session’s let-block; everything else is delegated to evaluate. Top-level IO results are passed through unchanged so the caller can decide whether to force them (the CLI / browser REPLs auto-run them).
Parameters
| Parameter | Type |
|---|---|
ast | AST |
Returns
evalSrc()
evalSrc(
src):EvalResult
Defined in: session.ts:137
REPL-friendly entry point. Recognizes top-level name = expr, path/seg = expr (path-based assignment over the existing let-block), and (undef "name"); everything else goes through parse + evalAst. Path segments are identifiers or integer indices separated by /. Throws ParseError if the source can’t be parsed.
Parameters
| Parameter | Type |
|---|---|
src | string |
Returns
reset()
reset():
void
Defined in: session.ts:111
Clear every binding. Equivalent to a fresh session.
Returns
void
setAtPath()
setAtPath(
path,expr):string|null
Defined in: session.ts:91
Set the AST at a path inside the session let-block. The first segment names a top-level binding; further segments descend into its value’s structure (let-block, record, vector, function body).
Returns null on success, or a string describing why the path could not be reached. The session is mutated only on success.
Parameters
| Parameter | Type |
|---|---|
path | readonly (string | number)[] |
expr | AST |
Returns
string | null
setBinding()
setBinding(
name,ast):void
Defined in: session.ts:74
Set or replace a binding. Last-wins by name.
Parameters
| Parameter | Type |
|---|---|
name | string |
ast | AST |
Returns
void
unsetBinding()
unsetBinding(
name):boolean
Defined in: session.ts:79
Remove a binding. Returns whether it was present.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
boolean
References
isIO
Re-exports isIO