hydra.lisp.syntax module

A unified Lisp syntax model covering Clojure, Emacs Lisp, Common Lisp, and Scheme (R7RS). Designed for code generation from Hydra types and terms.

class hydra.lisp.syntax.AndExpression(expressions: Annotated[Sequence[Expression], 'The operand expressions'])

Bases: object

Logical and: (and expr1 expr2 …).

class Builder(_expressions: 'Sequence[Expression]' = None)

Bases: object

build()
expressions(expressions)
EXPRESSIONS = Name(value='expressions')
TYPE_ = Name(value='hydra.lisp.syntax.AndExpression')
static builder()
expressions: Annotated[Sequence[Expression], 'The operand expressions']
with_expressions(expressions)
class hydra.lisp.syntax.Application(function: Annotated[Expression, 'The function being applied'], arguments: Annotated[Sequence[Expression], 'The arguments'])

Bases: object

Function application: (function arg1 arg2 …).

ARGUMENTS = Name(value='arguments')
class Builder(_function: 'Expression' = None, _arguments: 'Sequence[Expression]' = None)

Bases: object

arguments(arguments)
build()
function(function)
FUNCTION = Name(value='function')
TYPE_ = Name(value='hydra.lisp.syntax.Application')
arguments: Annotated[Sequence[Expression], 'The arguments']
static builder()
function: Annotated[Expression, 'The function being applied']
with_arguments(arguments)
with_function(function)
class hydra.lisp.syntax.BeginExpression(expressions: Annotated[Sequence[Expression], 'The expressions to evaluate in sequence'])

Bases: object

An explicit begin block (distinct from do for Scheme compatibility).

class Builder(_expressions: 'Sequence[Expression]' = None)

Bases: object

build()
expressions(expressions)
EXPRESSIONS = Name(value='expressions')
TYPE_ = Name(value='hydra.lisp.syntax.BeginExpression')
static builder()
expressions: Annotated[Sequence[Expression], 'The expressions to evaluate in sequence']
with_expressions(expressions)
class hydra.lisp.syntax.BooleanStyle(*values)

Bases: Enum

The style of boolean literals in a dialect.

HASH_T_F = Name(value='hashTF')
TRUE_FALSE = Name(value='trueFalse')
TYPE_ = Name(value='hydra.lisp.syntax.BooleanStyle')
T_NIL = Name(value='tNil')
class hydra.lisp.syntax.CaseClause(keys: Annotated[Sequence[Expression], 'The matching keys (one or more datum values)'], body: Annotated[Expression, 'The result expression'])

Bases: object

A clause in a case expression.

BODY = Name(value='body')
class Builder(_keys: 'Sequence[Expression]' = None, _body: 'Expression' = None)

Bases: object

body(body)
build()
keys(keys)
KEYS = Name(value='keys')
TYPE_ = Name(value='hydra.lisp.syntax.CaseClause')
body: Annotated[Expression, 'The result expression']
static builder()
keys: Annotated[Sequence[Expression], 'The matching keys (one or more datum values)']
with_body(body)
with_keys(keys)
class hydra.lisp.syntax.CaseExpression(scrutinee: Annotated[Expression, 'The expression being dispatched on'], clauses: Annotated[Sequence[CaseClause], 'The case clauses'], default: Annotated[object, 'Optional default clause'])

Bases: object

Case dispatch on a value. Serializes as (case x key1 expr1 key2 expr2 default) in Clojure, (case x (key1 expr1) (key2 expr2) (otherwise default)) in Common Lisp, (case x ((key1) expr1) ((key2) expr2) (else default)) in Scheme.

class Builder(_scrutinee: 'Expression' = None, _clauses: 'Sequence[CaseClause]' = None, _default: 'Optional[Expression]' = None)

Bases: object

build()
clauses(clauses)
default(default)
scrutinee(scrutinee)
CLAUSES = Name(value='clauses')
DEFAULT = Name(value='default')
SCRUTINEE = Name(value='scrutinee')
TYPE_ = Name(value='hydra.lisp.syntax.CaseExpression')
static builder()
clauses: Annotated[Sequence[CaseClause], 'The case clauses']
default: Annotated[object, 'Optional default clause']
scrutinee: Annotated[Expression, 'The expression being dispatched on']
with_clauses(clauses)
with_default(default)
with_scrutinee(scrutinee)
class hydra.lisp.syntax.CharacterLiteral(value: Annotated[str, 'The character value'])

Bases: object

A character literal. Concrete syntax varies: a (Clojure), ?a (Emacs Lisp), #a (Common Lisp, Scheme).

class Builder(_value: 'str' = None)

Bases: object

build()
value(value)
TYPE_ = Name(value='hydra.lisp.syntax.CharacterLiteral')
VALUE = Name(value='value')
static builder()
value: Annotated[str, 'The character value']
with_value(value)
class hydra.lisp.syntax.Comment(style: Annotated[CommentStyle, 'The comment style'], text: Annotated[str, 'The comment text'])

Bases: object

A comment.

class Builder(_style: 'CommentStyle' = None, _text: 'str' = None)

Bases: object

build()
style(style)
text(text)
STYLE = Name(value='style')
TEXT = Name(value='text')
TYPE_ = Name(value='hydra.lisp.syntax.Comment')
static builder()
style: Annotated[CommentStyle, 'The comment style']
text: Annotated[str, 'The comment text']
with_style(style)
with_text(text)
class hydra.lisp.syntax.CommentStyle(*values)

Bases: Enum

The style of a comment.

BLOCK = Name(value='block')
DATUM = Name(value='datum')
LINE = Name(value='line')
TYPE_ = Name(value='hydra.lisp.syntax.CommentStyle')
class hydra.lisp.syntax.CondClause(condition: Annotated[Expression, 'The test condition'], body: Annotated[Expression, 'The result expression'])

Bases: object

A clause in a cond expression.

BODY = Name(value='body')
class Builder(_condition: 'Expression' = None, _body: 'Expression' = None)

Bases: object

body(body)
build()
condition(condition)
CONDITION = Name(value='condition')
TYPE_ = Name(value='hydra.lisp.syntax.CondClause')
body: Annotated[Expression, 'The result expression']
static builder()
condition: Annotated[Expression, 'The test condition']
with_body(body)
with_condition(condition)
class hydra.lisp.syntax.CondExpression(clauses: Annotated[Sequence[CondClause], 'The condition-expression pairs'], default: Annotated[object, 'Optional default expression'])

Bases: object

Multi-branch conditional. Serializes as (cond test1 expr1 test2 expr2 :else default) in Clojure, (cond (test1 expr1) (test2 expr2) (t default)) in Emacs Lisp and Common Lisp, (cond (test1 expr1) (test2 expr2) (else default)) in Scheme.

class Builder(_clauses: 'Sequence[CondClause]' = None, _default: 'Optional[Expression]' = None)

Bases: object

build()
clauses(clauses)
default(default)
CLAUSES = Name(value='clauses')
DEFAULT = Name(value='default')
TYPE_ = Name(value='hydra.lisp.syntax.CondExpression')
static builder()
clauses: Annotated[Sequence[CondClause], 'The condition-expression pairs']
default: Annotated[object, 'Optional default expression']
with_clauses(clauses)
with_default(default)
class hydra.lisp.syntax.ConsExpression(head: Annotated[Expression, 'The head element'], tail: Annotated[Expression, 'The tail (typically a list or another cons)'])

Bases: object

A cons expression: (cons head tail).

class Builder(_head: 'Expression' = None, _tail: 'Expression' = None)

Bases: object

build()
head(head)
tail(tail)
HEAD = Name(value='head')
TAIL = Name(value='tail')
TYPE_ = Name(value='hydra.lisp.syntax.ConsExpression')
static builder()
head: Annotated[Expression, 'The head element']
tail: Annotated[Expression, 'The tail (typically a list or another cons)']
with_head(head)
with_tail(tail)
class hydra.lisp.syntax.ConstantDefinition(name: Annotated[Symbol, 'The constant name'], value: Annotated[Expression, 'The constant value'], doc: Annotated[object, 'Optional docstring'])

Bases: object

A constant definition. Serializes as (def ^:const name value) in Clojure, (defconst name value) in Emacs Lisp, (defconstant name value) in Common Lisp. Scheme has no dedicated constant form; uses define.

class Builder(_name: 'Symbol' = None, _value: 'Expression' = None, _doc: 'Optional[Docstring]' = None)

Bases: object

build()
doc(doc)
name(name)
value(value)
DOC = Name(value='doc')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.lisp.syntax.ConstantDefinition')
VALUE = Name(value='value')
static builder()
doc: Annotated[object, 'Optional docstring']
name: Annotated[Symbol, 'The constant name']
value: Annotated[Expression, 'The constant value']
with_doc(doc)
with_name(name)
with_value(value)
class hydra.lisp.syntax.ConstructorPattern(constructor: Annotated[Symbol, 'The constructor/tag name'], arguments: Annotated[Sequence[Pattern], 'The sub-patterns for constructor arguments'])

Bases: object

A constructor pattern matching a tagged value.

ARGUMENTS = Name(value='arguments')
class Builder(_constructor: 'Symbol' = None, _arguments: 'Sequence[Pattern]' = None)

Bases: object

arguments(arguments)
build()
constructor(constructor)
CONSTRUCTOR = Name(value='constructor')
TYPE_ = Name(value='hydra.lisp.syntax.ConstructorPattern')
arguments: Annotated[Sequence[Pattern], 'The sub-patterns for constructor arguments']
static builder()
constructor: Annotated[Symbol, 'The constructor/tag name']
with_arguments(arguments)
with_constructor(constructor)
class hydra.lisp.syntax.DestructuringBinding(pattern: Annotated[DestructuringPattern, 'The destructuring pattern'], value: Annotated[Expression, 'The value to destructure'])

Bases: object

A destructuring binding in a let expression.

class Builder(_pattern: 'DestructuringPattern' = None, _value: 'Expression' = None)

Bases: object

build()
pattern(pattern)
value(value)
PATTERN = Name(value='pattern')
TYPE_ = Name(value='hydra.lisp.syntax.DestructuringBinding')
VALUE = Name(value='value')
static builder()
pattern: Annotated[DestructuringPattern, 'The destructuring pattern']
value: Annotated[Expression, 'The value to destructure']
with_pattern(pattern)
with_value(value)
class hydra.lisp.syntax.DestructuringPattern

Bases: object

DestructuringPatternSequential | DestructuringPatternAssociative | DestructuringPatternRest

ASSOCIATIVE = Name(value='associative')
REST = Name(value='rest')
SEQUENTIAL = Name(value='sequential')
TYPE_ = Name(value='hydra.lisp.syntax.DestructuringPattern')
class hydra.lisp.syntax.DestructuringPatternAssociative(value: T)

Bases: Node[Sequence[Symbol]]

Associative/map destructuring: {:keys [a b]} in Clojure

class hydra.lisp.syntax.DestructuringPatternRest(value: T)

Bases: Node[Sequence[Symbol]]

Destructuring with a rest element: [a b & rest] (leading symbols + rest symbol)

class hydra.lisp.syntax.DestructuringPatternSequential(value: T)

Bases: Node[Sequence[Symbol]]

Sequential destructuring: [a b c] in Clojure, (a b c) in others

class hydra.lisp.syntax.Dialect(*values)

Bases: Enum

A Lisp dialect.

CLOJURE = Name(value='clojure')
COMMON_LISP = Name(value='commonLisp')
EMACS_LISP = Name(value='emacsLisp')
SCHEME = Name(value='scheme')
TYPE_ = Name(value='hydra.lisp.syntax.Dialect')
class hydra.lisp.syntax.DoExpression(expressions: Annotated[Sequence[Expression], 'The expressions to evaluate in sequence'])

Bases: object

Sequential evaluation of expressions, returning the last. Serializes as (do expr1 expr2 …) in Clojure, (progn expr1 expr2 …) in Emacs Lisp and Common Lisp, (begin expr1 expr2 …) in Scheme.

class Builder(_expressions: 'Sequence[Expression]' = None)

Bases: object

build()
expressions(expressions)
EXPRESSIONS = Name(value='expressions')
TYPE_ = Name(value='hydra.lisp.syntax.DoExpression')
static builder()
expressions: Annotated[Sequence[Expression], 'The expressions to evaluate in sequence']
with_expressions(expressions)
class hydra.lisp.syntax.Docstring(value: T)

Bases: Node[str]

A documentation string.

TYPE_ = Name(value='hydra.lisp.syntax.Docstring')
class hydra.lisp.syntax.DottedPair(car: Annotated[Expression, 'The first element'], cdr: Annotated[Expression, 'The second element'])

Bases: object

A dotted pair literal: ‘(a . b). Not available in Clojure.

class Builder(_car: 'Expression' = None, _cdr: 'Expression' = None)

Bases: object

build()
car(car)
cdr(cdr)
CAR = Name(value='car')
CDR = Name(value='cdr')
TYPE_ = Name(value='hydra.lisp.syntax.DottedPair')
static builder()
car: Annotated[Expression, 'The first element']
cdr: Annotated[Expression, 'The second element']
with_car(car)
with_cdr(cdr)
class hydra.lisp.syntax.ExportDeclaration(symbols: Annotated[Sequence[Symbol], 'The symbols to export'])

Bases: object

An export/provide declaration. Serializes as (provide ‘name) in Emacs Lisp, (:export :sym1 :sym2) in Common Lisp, (export sym1 sym2) in Scheme. In Clojure, symbols are public by default.

class Builder(_symbols: 'Sequence[Symbol]' = None)

Bases: object

build()
symbols(symbols)
SYMBOLS = Name(value='symbols')
TYPE_ = Name(value='hydra.lisp.syntax.ExportDeclaration')
static builder()
symbols: Annotated[Sequence[Symbol], 'The symbols to export']
with_symbols(symbols)
class hydra.lisp.syntax.Expression

Bases: object

ExpressionApplication | ExpressionLambda | ExpressionLet | ExpressionIf | ExpressionCond | ExpressionCase | ExpressionAnd | ExpressionOr | ExpressionNot | ExpressionDo | ExpressionBegin | ExpressionVariable | ExpressionLiteral | ExpressionList | ExpressionVector | ExpressionMap | ExpressionSet | ExpressionCons | ExpressionDottedPair | ExpressionFieldAccess | ExpressionTypeAnnotation | ExpressionQuote | ExpressionQuasiquote | ExpressionUnquote | ExpressionSplicingUnquote | ExpressionSExpression

AND = Name(value='and')
APPLICATION = Name(value='application')
BEGIN = Name(value='begin')
CASE = Name(value='case')
COND = Name(value='cond')
CONS = Name(value='cons')
DO = Name(value='do')
DOTTED_PAIR = Name(value='dottedPair')
FIELD_ACCESS = Name(value='fieldAccess')
IF = Name(value='if')
LAMBDA = Name(value='lambda')
LET = Name(value='let')
LIST = Name(value='list')
LITERAL = Name(value='literal')
MAP = Name(value='map')
NOT = Name(value='not')
OR = Name(value='or')
QUASIQUOTE = Name(value='quasiquote')
QUOTE = Name(value='quote')
SET = Name(value='set')
SPLICING_UNQUOTE = Name(value='splicingUnquote')
S_EXPRESSION = Name(value='sExpression')
TYPE_ = Name(value='hydra.lisp.syntax.Expression')
TYPE_ANNOTATION = Name(value='typeAnnotation')
UNQUOTE = Name(value='unquote')
VARIABLE = Name(value='variable')
VECTOR = Name(value='vector')
class hydra.lisp.syntax.ExpressionAnd(value: T)

Bases: Node[AndExpression]

Logical and (short-circuiting)

class hydra.lisp.syntax.ExpressionApplication(value: T)

Bases: Node[Application]

Function application: (f arg1 arg2 …)

class hydra.lisp.syntax.ExpressionBegin(value: T)

Bases: Node[BeginExpression]

Sequential evaluation (explicit begin block)

class hydra.lisp.syntax.ExpressionCase(value: T)

Bases: Node[CaseExpression]

Case/match dispatch

class hydra.lisp.syntax.ExpressionCond(value: T)

Bases: Node[CondExpression]

Multi-branch conditional

class hydra.lisp.syntax.ExpressionCons(value: T)

Bases: Node[ConsExpression]

A cons expression

class hydra.lisp.syntax.ExpressionDo(value: T)

Bases: Node[DoExpression]

Sequential evaluation (progn/do/begin)

class hydra.lisp.syntax.ExpressionDottedPair(value: T)

Bases: Node[DottedPair]

A dotted pair literal

class hydra.lisp.syntax.ExpressionFieldAccess(value: T)

Bases: Node[FieldAccess]

Field access on a record/struct

class hydra.lisp.syntax.ExpressionIf(value: T)

Bases: Node[IfExpression]

Conditional expression

class hydra.lisp.syntax.ExpressionLambda(value: T)

Bases: Node[Lambda]

Anonymous function

class hydra.lisp.syntax.ExpressionLet(value: T)

Bases: Node[LetExpression]

Local variable binding

class hydra.lisp.syntax.ExpressionList(value: T)

Bases: Node[ListLiteral]

A list literal

class hydra.lisp.syntax.ExpressionLiteral(value: T)

Bases: Node[Literal]

A literal value

class hydra.lisp.syntax.ExpressionMap(value: T)

Bases: Node[MapLiteral]

A map/association literal

class hydra.lisp.syntax.ExpressionNot(value: T)

Bases: Node[NotExpression]

Logical negation

class hydra.lisp.syntax.ExpressionOr(value: T)

Bases: Node[OrExpression]

Logical or (short-circuiting)

class hydra.lisp.syntax.ExpressionQuasiquote(value: T)

Bases: Node[QuasiquoteExpression]

A quasiquoted expression

class hydra.lisp.syntax.ExpressionQuote(value: T)

Bases: Node[QuoteExpression]

A quoted expression

class hydra.lisp.syntax.ExpressionSExpression(value: T)

Bases: Node[SExpression]

An arbitrary S-expression (escape hatch for dialect-specific forms)

class hydra.lisp.syntax.ExpressionSet(value: T)

Bases: Node[SetLiteral]

A set literal

class hydra.lisp.syntax.ExpressionSplicingUnquote(value: T)

Bases: Node[SplicingUnquoteExpression]

A splicing unquote within a quasiquote

class hydra.lisp.syntax.ExpressionTypeAnnotation(value: T)

Bases: Node[TypeAnnotation]

A type-annotated expression

class hydra.lisp.syntax.ExpressionUnquote(value: T)

Bases: Node[UnquoteExpression]

An unquoted expression within a quasiquote

class hydra.lisp.syntax.ExpressionVariable(value: T)

Bases: Node[VariableReference]

Variable reference

class hydra.lisp.syntax.ExpressionVector(value: T)

Bases: Node[VectorLiteral]

A vector literal

class hydra.lisp.syntax.FieldAccess(record_type: Annotated[Symbol, 'The record type name (used to form accessor name)'], field: Annotated[Symbol, 'The field name'], target: Annotated[Expression, 'The expression being accessed'])

Bases: object

Field access on a record/struct. Serializes as (:field record) in Clojure, (struct-field record) in Emacs Lisp and Common Lisp, (record-field record) in Scheme.

class Builder(_record_type: 'Symbol' = None, _field: 'Symbol' = None, _target: 'Expression' = None)

Bases: object

build()
field(field)
record_type(record_type)
target(target)
FIELD = Name(value='field')
RECORD_TYPE = Name(value='recordType')
TARGET = Name(value='target')
TYPE_ = Name(value='hydra.lisp.syntax.FieldAccess')
static builder()
field: Annotated[Symbol, 'The field name']
record_type: Annotated[Symbol, 'The record type name (used to form accessor name)']
target: Annotated[Expression, 'The expression being accessed']
with_field(field)
with_record_type(record_type)
with_target(target)
class hydra.lisp.syntax.FieldDefinition(name: Annotated[Symbol, 'The field name'], default_value: Annotated[object, 'Optional default value'])

Bases: object

A field in a record type definition.

class Builder(_name: 'Symbol' = None, _default_value: 'Optional[Expression]' = None)

Bases: object

build()
default_value(default_value)
name(name)
DEFAULT_VALUE = Name(value='defaultValue')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.lisp.syntax.FieldDefinition')
static builder()
default_value: Annotated[object, 'Optional default value']
name: Annotated[Symbol, 'The field name']
with_default_value(default_value)
with_name(name)
class hydra.lisp.syntax.FloatLiteral(value: Annotated[float, 'The float value'], precision: Annotated[object, 'Optional precision hint (e.g. 3.14d0 vs 3.14f0 in Common Lisp)'])

Bases: object

A floating-point literal.

class Builder(_value: 'float' = None, _precision: 'Optional[str]' = None)

Bases: object

build()
precision(precision)
value(value)
PRECISION = Name(value='precision')
TYPE_ = Name(value='hydra.lisp.syntax.FloatLiteral')
VALUE = Name(value='value')
static builder()
precision: Annotated[object, 'Optional precision hint (e.g. 3.14d0 vs 3.14f0 in Common Lisp)']
value: Annotated[float, 'The float value']
with_precision(precision)
with_value(value)
class hydra.lisp.syntax.FunctionDefinition(name: Annotated[Symbol, 'The function name'], params: Annotated[Sequence[Symbol], 'The parameter list'], rest_param: Annotated[object, 'Optional rest/variadic parameter'], doc: Annotated[object, 'Optional docstring'], type_hints: Annotated[Sequence[TypeHint], 'Optional type hints for parameters and return type'], body: Annotated[Sequence[Expression], 'The function body (one or more expressions)'])

Bases: object

A named function definition. Serializes as (defn name [params] body) in Clojure, (defun name (params) body) in Emacs Lisp and Common Lisp, (define (name params) body) in Scheme.

BODY = Name(value='body')
class Builder(_name: 'Symbol' = None, _params: 'Sequence[Symbol]' = None, _rest_param: 'Optional[Symbol]' = None, _doc: 'Optional[Docstring]' = None, _type_hints: 'Sequence[TypeHint]' = None, _body: 'Sequence[Expression]' = None)

Bases: object

body(body)
build()
doc(doc)
name(name)
params(params)
rest_param(rest_param)
type_hints(type_hints)
DOC = Name(value='doc')
NAME = Name(value='name')
PARAMS = Name(value='params')
REST_PARAM = Name(value='restParam')
TYPE_ = Name(value='hydra.lisp.syntax.FunctionDefinition')
TYPE_HINTS = Name(value='typeHints')
body: Annotated[Sequence[Expression], 'The function body (one or more expressions)']
static builder()
doc: Annotated[object, 'Optional docstring']
name: Annotated[Symbol, 'The function name']
params: Annotated[Sequence[Symbol], 'The parameter list']
rest_param: Annotated[object, 'Optional rest/variadic parameter']
type_hints: Annotated[Sequence[TypeHint], 'Optional type hints for parameters and return type']
with_body(body)
with_doc(doc)
with_name(name)
with_params(params)
with_rest_param(rest_param)
with_type_hints(type_hints)
class hydra.lisp.syntax.IfExpression(condition: Annotated[Expression, 'The test expression'], then: Annotated[Expression, 'The then branch'], else_: Annotated[object, 'Optional else branch'])

Bases: object

Conditional: (if test then else).

class Builder(_condition: 'Expression' = None, _then: 'Expression' = None, _else_: 'Optional[Expression]' = None)

Bases: object

build()
condition(condition)
else_(else_)
then(then)
CONDITION = Name(value='condition')
ELSE = Name(value='else')
THEN = Name(value='then')
TYPE_ = Name(value='hydra.lisp.syntax.IfExpression')
static builder()
condition: Annotated[Expression, 'The test expression']
else_: Annotated[object, 'Optional else branch']
then: Annotated[Expression, 'The then branch']
with_condition(condition)
with_else_(else_)
with_then(then)
class hydra.lisp.syntax.ImportDeclaration(module: Annotated[NamespaceName, 'The module being imported'], spec: Annotated[ImportSpec, 'Import specification'])

Bases: object

An import/require declaration. Serializes as (:require [name …]) in Clojure, (require ‘name) in Emacs Lisp, (:use :name) or (:import-from :name …) in Common Lisp, (import (name)) in Scheme.

class Builder(_module: 'NamespaceName' = None, _spec: 'ImportSpec' = None)

Bases: object

build()
module(module)
spec(spec)
MODULE = Name(value='module')
SPEC = Name(value='spec')
TYPE_ = Name(value='hydra.lisp.syntax.ImportDeclaration')
static builder()
module: Annotated[NamespaceName, 'The module being imported']
spec: Annotated[ImportSpec, 'Import specification']
with_module(module)
with_spec(spec)
class hydra.lisp.syntax.ImportSpec

Bases: object

ImportSpecAll | ImportSpecAlias | ImportSpecOnly | ImportSpecRename

ALIAS = Name(value='alias')
ALL = Name(value='all')
ONLY = Name(value='only')
RENAME = Name(value='rename')
TYPE_ = Name(value='hydra.lisp.syntax.ImportSpec')
class hydra.lisp.syntax.ImportSpecAlias(value: T)

Bases: Node[Symbol]

Import with an alias: (:require [name :as alias]) in Clojure

class hydra.lisp.syntax.ImportSpecAll

Bases: object

Import everything

class hydra.lisp.syntax.ImportSpecOnly(value: T)

Bases: Node[Sequence[Symbol]]

Import specific symbols: (:require [name :refer [sym1 sym2]]) in Clojure

class hydra.lisp.syntax.ImportSpecRename(value: T)

Bases: Node[Sequence[Sequence[Symbol]]]

Import with renaming: list of (from, to) symbol pairs

class hydra.lisp.syntax.IntegerLiteral(value: Annotated[int, 'The integer value'], bigint: Annotated[bool, 'Whether this is explicitly a big integer (e.g. 42N in Clojure)'])

Bases: object

An integer literal.

BIGINT = Name(value='bigint')
class Builder(_value: 'int' = None, _bigint: 'bool' = None)

Bases: object

bigint(bigint)
build()
value(value)
TYPE_ = Name(value='hydra.lisp.syntax.IntegerLiteral')
VALUE = Name(value='value')
bigint: Annotated[bool, 'Whether this is explicitly a big integer (e.g. 42N in Clojure)']
static builder()
value: Annotated[int, 'The integer value']
with_bigint(bigint)
with_value(value)
class hydra.lisp.syntax.Keyword(name: Annotated[str, 'The keyword name (without the leading colon)'], namespace: Annotated[object, 'Optional namespace (e.g. my.ns/foo in Clojure)'])

Bases: object

A keyword (self-evaluating symbol). Serializes as :name in Clojure, Emacs Lisp, and Common Lisp.

class Builder(_name: 'str' = None, _namespace: 'Optional[str]' = None)

Bases: object

build()
name(name)
namespace(namespace)
NAME = Name(value='name')
NAMESPACE = Name(value='namespace')
TYPE_ = Name(value='hydra.lisp.syntax.Keyword')
static builder()
name: Annotated[str, 'The keyword name (without the leading colon)']
namespace: Annotated[object, 'Optional namespace (e.g. my.ns/foo in Clojure)']
with_name(name)
with_namespace(namespace)
class hydra.lisp.syntax.Lambda(name: Annotated[object, 'Optional name for self-referential lambdas (Clojure named fn)'], params: Annotated[Sequence[Symbol], 'The parameter list'], rest_param: Annotated[object, 'Optional rest parameter'], body: Annotated[Sequence[Expression], 'The lambda body'])

Bases: object

An anonymous function. Serializes as (fn [params] body) in Clojure, (lambda (params) body) in Emacs Lisp, Common Lisp, and Scheme. If name is provided, emits (fn name [params] body) in Clojure for self-reference.

BODY = Name(value='body')
class Builder(_name: 'Optional[Symbol]' = None, _params: 'Sequence[Symbol]' = None, _rest_param: 'Optional[Symbol]' = None, _body: 'Sequence[Expression]' = None)

Bases: object

body(body)
build()
name(name)
params(params)
rest_param(rest_param)
NAME = Name(value='name')
PARAMS = Name(value='params')
REST_PARAM = Name(value='restParam')
TYPE_ = Name(value='hydra.lisp.syntax.Lambda')
body: Annotated[Sequence[Expression], 'The lambda body']
static builder()
name: Annotated[object, 'Optional name for self-referential lambdas (Clojure named fn)']
params: Annotated[Sequence[Symbol], 'The parameter list']
rest_param: Annotated[object, 'Optional rest parameter']
with_body(body)
with_name(name)
with_params(params)
with_rest_param(rest_param)
class hydra.lisp.syntax.LetBinding

Bases: object

LetBindingSimple | LetBindingDestructuring

DESTRUCTURING = Name(value='destructuring')
SIMPLE = Name(value='simple')
TYPE_ = Name(value='hydra.lisp.syntax.LetBinding')
class hydra.lisp.syntax.LetBindingDestructuring(value: T)

Bases: Node[DestructuringBinding]

A destructuring binding

class hydra.lisp.syntax.LetBindingSimple(value: T)

Bases: Node[SimpleBinding]

A simple name-value binding

class hydra.lisp.syntax.LetExpression(kind: Annotated[LetKind, 'The kind of let (parallel or sequential)'], bindings: Annotated[Sequence[LetBinding], 'The variable bindings'], body: Annotated[Sequence[Expression], 'The body expressions'])

Bases: object

Local variable bindings. Serializes as (let [x 1 y 2] body) in Clojure (always sequential), (let ((x 1) (y 2)) body) or (let* …) in other dialects.

BINDINGS = Name(value='bindings')
BODY = Name(value='body')
class Builder(_kind: 'LetKind' = None, _bindings: 'Sequence[LetBinding]' = None, _body: 'Sequence[Expression]' = None)

Bases: object

bindings(bindings)
body(body)
build()
kind(kind)
KIND = Name(value='kind')
TYPE_ = Name(value='hydra.lisp.syntax.LetExpression')
bindings: Annotated[Sequence[LetBinding], 'The variable bindings']
body: Annotated[Sequence[Expression], 'The body expressions']
static builder()
kind: Annotated[LetKind, 'The kind of let (parallel or sequential)']
with_bindings(bindings)
with_body(body)
with_kind(kind)
class hydra.lisp.syntax.LetKind(*values)

Bases: Enum

The kind of let binding.

PARALLEL = Name(value='parallel')
RECURSIVE = Name(value='recursive')
SEQUENTIAL = Name(value='sequential')
TYPE_ = Name(value='hydra.lisp.syntax.LetKind')
class hydra.lisp.syntax.ListLiteral(elements: Annotated[Sequence[Expression], 'The list elements'], quoted: Annotated[bool, 'Whether to use quote syntax vs constructor syntax'])

Bases: object

A list literal: ‘(1 2 3) or (list 1 2 3).

class Builder(_elements: 'Sequence[Expression]' = None, _quoted: 'bool' = None)

Bases: object

build()
elements(elements)
quoted(quoted)
ELEMENTS = Name(value='elements')
QUOTED = Name(value='quoted')
TYPE_ = Name(value='hydra.lisp.syntax.ListLiteral')
static builder()
elements: Annotated[Sequence[Expression], 'The list elements']
quoted: Annotated[bool, 'Whether to use quote syntax vs constructor syntax']
with_elements(elements)
with_quoted(quoted)
class hydra.lisp.syntax.Literal

Bases: object

LiteralInteger | LiteralFloat | LiteralString | LiteralCharacter | LiteralBoolean | LiteralNil | LiteralKeyword | LiteralSymbol

BOOLEAN = Name(value='boolean')
CHARACTER = Name(value='character')
FLOAT = Name(value='float')
INTEGER = Name(value='integer')
KEYWORD = Name(value='keyword')
NIL = Name(value='nil')
STRING = Name(value='string')
SYMBOL = Name(value='symbol')
TYPE_ = Name(value='hydra.lisp.syntax.Literal')
class hydra.lisp.syntax.LiteralBoolean(value: T)

Bases: Node[bool]

A boolean literal (dialect-specific rendering)

class hydra.lisp.syntax.LiteralCharacter(value: T)

Bases: Node[CharacterLiteral]

A character literal

class hydra.lisp.syntax.LiteralFloat(value: T)

Bases: Node[FloatLiteral]

A floating-point literal

class hydra.lisp.syntax.LiteralInteger(value: T)

Bases: Node[IntegerLiteral]

An integer literal

class hydra.lisp.syntax.LiteralKeyword(value: T)

Bases: Node[Keyword]

A keyword literal

class hydra.lisp.syntax.LiteralNil

Bases: object

Nil/null/empty list (dialect-specific rendering)

class hydra.lisp.syntax.LiteralPattern(value: Annotated[Literal, 'The literal to match'])

Bases: object

A pattern matching a literal value.

class Builder(_value: 'Literal' = None)

Bases: object

build()
value(value)
TYPE_ = Name(value='hydra.lisp.syntax.LiteralPattern')
VALUE = Name(value='value')
static builder()
value: Annotated[Literal, 'The literal to match']
with_value(value)
class hydra.lisp.syntax.LiteralString(value: T)

Bases: Node[str]

A string literal

class hydra.lisp.syntax.LiteralSymbol(value: T)

Bases: Node[Symbol]

A quoted symbol literal

class hydra.lisp.syntax.MacroDefinition(name: Annotated[Symbol, 'The macro name'], params: Annotated[Sequence[Symbol], 'The parameter list'], rest_param: Annotated[object, 'Optional rest parameter'], body: Annotated[Sequence[Expression], 'The macro body'])

Bases: object

A macro definition. Serializes as (defmacro name [params] body) in Clojure, (defmacro name (params) body) in Emacs Lisp and Common Lisp, (define-syntax name …) in Scheme.

BODY = Name(value='body')
class Builder(_name: 'Symbol' = None, _params: 'Sequence[Symbol]' = None, _rest_param: 'Optional[Symbol]' = None, _body: 'Sequence[Expression]' = None)

Bases: object

body(body)
build()
name(name)
params(params)
rest_param(rest_param)
NAME = Name(value='name')
PARAMS = Name(value='params')
REST_PARAM = Name(value='restParam')
TYPE_ = Name(value='hydra.lisp.syntax.MacroDefinition')
body: Annotated[Sequence[Expression], 'The macro body']
static builder()
name: Annotated[Symbol, 'The macro name']
params: Annotated[Sequence[Symbol], 'The parameter list']
rest_param: Annotated[object, 'Optional rest parameter']
with_body(body)
with_name(name)
with_params(params)
with_rest_param(rest_param)
class hydra.lisp.syntax.MapEntry(key: Annotated[Expression, 'The key expression'], value: Annotated[Expression, 'The value expression'])

Bases: object

A key-value pair in a map literal.

class Builder(_key: 'Expression' = None, _value: 'Expression' = None)

Bases: object

build()
key(key)
value(value)
KEY = Name(value='key')
TYPE_ = Name(value='hydra.lisp.syntax.MapEntry')
VALUE = Name(value='value')
static builder()
key: Annotated[Expression, 'The key expression']
value: Annotated[Expression, 'The value expression']
with_key(key)
with_value(value)
class hydra.lisp.syntax.MapLiteral(entries: Annotated[Sequence[MapEntry], 'The key-value pairs'])

Bases: object

A map/dictionary literal. Serializes as {:a 1 :b 2} in Clojure, as an alist ‘((a . 1) (b . 2)) in other dialects.

class Builder(_entries: 'Sequence[MapEntry]' = None)

Bases: object

build()
entries(entries)
ENTRIES = Name(value='entries')
TYPE_ = Name(value='hydra.lisp.syntax.MapLiteral')
static builder()
entries: Annotated[Sequence[MapEntry], 'The key-value pairs']
with_entries(entries)
class hydra.lisp.syntax.ModuleDeclaration(name: Annotated[NamespaceName, 'The module/namespace name'], doc: Annotated[object, 'Optional module documentation'])

Bases: object

A module/namespace declaration. Serializes as (ns name …) in Clojure, (provide ‘name) in Emacs Lisp, (defpackage :name … ) (in-package :name) in Common Lisp, (define-library (name) …) in Scheme.

class Builder(_name: 'NamespaceName' = None, _doc: 'Optional[Docstring]' = None)

Bases: object

build()
doc(doc)
name(name)
DOC = Name(value='doc')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.lisp.syntax.ModuleDeclaration')
static builder()
doc: Annotated[object, 'Optional module documentation']
name: Annotated[NamespaceName, 'The module/namespace name']
with_doc(doc)
with_name(name)
class hydra.lisp.syntax.NamespaceName(value: T)

Bases: Node[str]

A namespace or package name.

TYPE_ = Name(value='hydra.lisp.syntax.NamespaceName')
class hydra.lisp.syntax.NilStyle(*values)

Bases: Enum

The style of nil/null in a dialect.

EMPTY_LIST = Name(value='emptyList')
NIL = Name(value='nil')
TYPE_ = Name(value='hydra.lisp.syntax.NilStyle')
class hydra.lisp.syntax.NotExpression(expression: Annotated[Expression, 'The operand expression'])

Bases: object

Logical negation: (not expr).

class Builder(_expression: 'Expression' = None)

Bases: object

build()
expression(expression)
EXPRESSION = Name(value='expression')
TYPE_ = Name(value='hydra.lisp.syntax.NotExpression')
static builder()
expression: Annotated[Expression, 'The operand expression']
with_expression(expression)
class hydra.lisp.syntax.OrExpression(expressions: Annotated[Sequence[Expression], 'The operand expressions'])

Bases: object

Logical or: (or expr1 expr2 …).

class Builder(_expressions: 'Sequence[Expression]' = None)

Bases: object

build()
expressions(expressions)
EXPRESSIONS = Name(value='expressions')
TYPE_ = Name(value='hydra.lisp.syntax.OrExpression')
static builder()
expressions: Annotated[Sequence[Expression], 'The operand expressions']
with_expressions(expressions)
class hydra.lisp.syntax.Pattern

Bases: object

PatternConstructor | PatternLiteral | PatternWildcard | PatternVariable

CONSTRUCTOR = Name(value='constructor')
LITERAL = Name(value='literal')
TYPE_ = Name(value='hydra.lisp.syntax.Pattern')
VARIABLE = Name(value='variable')
WILDCARD = Name(value='wildcard')
class hydra.lisp.syntax.PatternConstructor(value: T)

Bases: Node[ConstructorPattern]

A constructor pattern (for union/sum type matching)

class hydra.lisp.syntax.PatternLiteral(value: T)

Bases: Node[LiteralPattern]

A literal pattern

class hydra.lisp.syntax.PatternVariable(value: T)

Bases: Node[Symbol]

A variable pattern that binds the matched value

class hydra.lisp.syntax.PatternWildcard(value: T)

Bases: Node[WildcardPattern]

A wildcard pattern matching anything

class hydra.lisp.syntax.Program(dialect: Annotated[Dialect, 'The target Lisp dialect'], module: Annotated[object, 'Optional module/namespace declaration'], imports: Annotated[Sequence[ImportDeclaration], 'Import/require declarations'], exports: Annotated[Sequence[ExportDeclaration], 'Export/provide declarations'], forms: Annotated[Sequence[TopLevelFormWithComments], 'The top-level forms in the program'])

Bases: object

A Lisp program, consisting of a sequence of top-level forms.

class Builder(_dialect: 'Dialect' = None, _module: 'Optional[ModuleDeclaration]' = None, _imports: 'Sequence[ImportDeclaration]' = None, _exports: 'Sequence[ExportDeclaration]' = None, _forms: 'Sequence[TopLevelFormWithComments]' = None)

Bases: object

build()
dialect(dialect)
exports(exports)
forms(forms)
imports(imports)
module(module)
DIALECT = Name(value='dialect')
EXPORTS = Name(value='exports')
FORMS = Name(value='forms')
IMPORTS = Name(value='imports')
MODULE = Name(value='module')
TYPE_ = Name(value='hydra.lisp.syntax.Program')
static builder()
dialect: Annotated[Dialect, 'The target Lisp dialect']
exports: Annotated[Sequence[ExportDeclaration], 'Export/provide declarations']
forms: Annotated[Sequence[TopLevelFormWithComments], 'The top-level forms in the program']
imports: Annotated[Sequence[ImportDeclaration], 'Import/require declarations']
module: Annotated[object, 'Optional module/namespace declaration']
with_dialect(dialect)
with_exports(exports)
with_forms(forms)
with_imports(imports)
with_module(module)
class hydra.lisp.syntax.QualifiedSymbol(namespace: Annotated[str, 'The namespace or package'], name: Annotated[str, 'The local name'])

Bases: object

A namespace-qualified symbol. Serializes as ns/name in Clojure, pkg:name or pkg::name in Common Lisp.

class Builder(_namespace: 'str' = None, _name: 'str' = None)

Bases: object

build()
name(name)
namespace(namespace)
NAME = Name(value='name')
NAMESPACE = Name(value='namespace')
TYPE_ = Name(value='hydra.lisp.syntax.QualifiedSymbol')
static builder()
name: Annotated[str, 'The local name']
namespace: Annotated[str, 'The namespace or package']
with_name(name)
with_namespace(namespace)
class hydra.lisp.syntax.QuasiquoteExpression(body: Annotated[Expression, 'The quasiquoted form'])

Bases: object

A quasiquoted form: `expr.

BODY = Name(value='body')
class Builder(_body: 'Expression' = None)

Bases: object

body(body)
build()
TYPE_ = Name(value='hydra.lisp.syntax.QuasiquoteExpression')
body: Annotated[Expression, 'The quasiquoted form']
static builder()
with_body(body)
class hydra.lisp.syntax.QuoteExpression(body: Annotated[Expression, 'The quoted form'])

Bases: object

A quoted form: ‘expr or (quote expr).

BODY = Name(value='body')
class Builder(_body: 'Expression' = None)

Bases: object

body(body)
build()
TYPE_ = Name(value='hydra.lisp.syntax.QuoteExpression')
body: Annotated[Expression, 'The quoted form']
static builder()
with_body(body)
class hydra.lisp.syntax.RecordTypeDefinition(name: Annotated[Symbol, 'The record type name'], fields: Annotated[Sequence[FieldDefinition], 'The field definitions'], doc: Annotated[object, 'Optional docstring'])

Bases: object

A record/struct type definition. Serializes as (defrecord Name [fields]) in Clojure, (cl-defstruct name fields) in Emacs Lisp, (defstruct name fields) in Common Lisp, (define-record-type <Name> …) in Scheme.

class Builder(_name: 'Symbol' = None, _fields: 'Sequence[FieldDefinition]' = None, _doc: 'Optional[Docstring]' = None)

Bases: object

build()
doc(doc)
fields(fields)
name(name)
DOC = Name(value='doc')
FIELDS = Name(value='fields')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.lisp.syntax.RecordTypeDefinition')
static builder()
doc: Annotated[object, 'Optional docstring']
fields: Annotated[Sequence[FieldDefinition], 'The field definitions']
name: Annotated[Symbol, 'The record type name']
with_doc(doc)
with_fields(fields)
with_name(name)
class hydra.lisp.syntax.SExpression

Bases: object

SExpressionAtom | SExpressionList

ATOM = Name(value='atom')
LIST = Name(value='list')
TYPE_ = Name(value='hydra.lisp.syntax.SExpression')
class hydra.lisp.syntax.SExpressionAtom(value: T)

Bases: Node[str]

An atomic value

class hydra.lisp.syntax.SExpressionList(value: T)

Bases: Node[Sequence[SExpression]]

A list of S-expressions

class hydra.lisp.syntax.SetLiteral(elements: Annotated[Sequence[Expression], 'The set elements'])

Bases: object

A set literal. Serializes as #{1 2 3} in Clojure. Other dialects use a list-based construction.

class Builder(_elements: 'Sequence[Expression]' = None)

Bases: object

build()
elements(elements)
ELEMENTS = Name(value='elements')
TYPE_ = Name(value='hydra.lisp.syntax.SetLiteral')
static builder()
elements: Annotated[Sequence[Expression], 'The set elements']
with_elements(elements)
class hydra.lisp.syntax.SimpleBinding(name: Annotated[Symbol, 'The bound variable'], value: Annotated[Expression, 'The value expression'])

Bases: object

A simple name-value binding in a let expression.

class Builder(_name: 'Symbol' = None, _value: 'Expression' = None)

Bases: object

build()
name(name)
value(value)
NAME = Name(value='name')
TYPE_ = Name(value='hydra.lisp.syntax.SimpleBinding')
VALUE = Name(value='value')
static builder()
name: Annotated[Symbol, 'The bound variable']
value: Annotated[Expression, 'The value expression']
with_name(name)
with_value(value)
class hydra.lisp.syntax.SplicingUnquoteExpression(body: Annotated[Expression, 'The spliced form'])

Bases: object

A splicing unquote within a quasiquote: ~@expr or ,@expr.

BODY = Name(value='body')
class Builder(_body: 'Expression' = None)

Bases: object

body(body)
build()
TYPE_ = Name(value='hydra.lisp.syntax.SplicingUnquoteExpression')
body: Annotated[Expression, 'The spliced form']
static builder()
with_body(body)
class hydra.lisp.syntax.Symbol(value: T)

Bases: Node[str]

A Lisp symbol (identifier).

TYPE_ = Name(value='hydra.lisp.syntax.Symbol')
class hydra.lisp.syntax.TopLevelForm

Bases: object

TopLevelFormFunction | TopLevelFormVariable | TopLevelFormConstant | TopLevelFormRecordType | TopLevelFormMacro | TopLevelFormExpression

CONSTANT = Name(value='constant')
EXPRESSION = Name(value='expression')
FUNCTION = Name(value='function')
MACRO = Name(value='macro')
RECORD_TYPE = Name(value='recordType')
TYPE_ = Name(value='hydra.lisp.syntax.TopLevelForm')
VARIABLE = Name(value='variable')
class hydra.lisp.syntax.TopLevelFormConstant(value: T)

Bases: Node[ConstantDefinition]

A constant definition

class hydra.lisp.syntax.TopLevelFormExpression(value: T)

Bases: Node[Expression]

A bare expression at the top level

class hydra.lisp.syntax.TopLevelFormFunction(value: T)

Bases: Node[FunctionDefinition]

A named function definition

class hydra.lisp.syntax.TopLevelFormMacro(value: T)

Bases: Node[MacroDefinition]

A macro definition

class hydra.lisp.syntax.TopLevelFormRecordType(value: T)

Bases: Node[RecordTypeDefinition]

A record/struct type definition

class hydra.lisp.syntax.TopLevelFormVariable(value: T)

Bases: Node[VariableDefinition]

A global variable definition

class hydra.lisp.syntax.TopLevelFormWithComments(doc: Annotated[object, 'Optional documentation string'], comment: Annotated[object, 'Optional comment'], form: Annotated[TopLevelForm, 'The form itself'])

Bases: object

A top-level form together with optional documentation.

class Builder(_doc: 'Optional[Docstring]' = None, _comment: 'Optional[Comment]' = None, _form: 'TopLevelForm' = None)

Bases: object

build()
comment(comment)
doc(doc)
form(form)
COMMENT = Name(value='comment')
DOC = Name(value='doc')
FORM = Name(value='form')
TYPE_ = Name(value='hydra.lisp.syntax.TopLevelFormWithComments')
static builder()
comment: Annotated[object, 'Optional comment']
doc: Annotated[object, 'Optional documentation string']
form: Annotated[TopLevelForm, 'The form itself']
with_comment(comment)
with_doc(doc)
with_form(form)
class hydra.lisp.syntax.TypeAnnotation(expression: Annotated[Expression, 'The annotated expression'], type: Annotated[TypeSpecifier, 'The type specifier'])

Bases: object

An expression with a type annotation.

class Builder(_expression: 'Expression' = None, _type: 'TypeSpecifier' = None)

Bases: object

build()
expression(expression)
type(type)
EXPRESSION = Name(value='expression')
TYPE = Name(value='type')
TYPE_ = Name(value='hydra.lisp.syntax.TypeAnnotation')
static builder()
expression: Annotated[Expression, 'The annotated expression']
type: Annotated[TypeSpecifier, 'The type specifier']
with_expression(expression)
with_type(type)
class hydra.lisp.syntax.TypeHint(name: Annotated[Symbol, 'The annotated symbol'], type: Annotated[TypeSpecifier, 'The type specifier'])

Bases: object

A type hint or annotation. In Clojure: ^Type name. In Common Lisp: (declare (type Type name)). In Scheme and Emacs Lisp: typically unused.

class Builder(_name: 'Symbol' = None, _type: 'TypeSpecifier' = None)

Bases: object

build()
name(name)
type(type)
NAME = Name(value='name')
TYPE = Name(value='type')
TYPE_ = Name(value='hydra.lisp.syntax.TypeHint')
static builder()
name: Annotated[Symbol, 'The annotated symbol']
type: Annotated[TypeSpecifier, 'The type specifier']
with_name(name)
with_type(type)
class hydra.lisp.syntax.TypeSpecifier

Bases: object

TypeSpecifierNamed | TypeSpecifierList | TypeSpecifierFunction | TypeSpecifierMaybe | TypeSpecifierMap | TypeSpecifierSet | TypeSpecifierPair | TypeSpecifierEither | TypeSpecifierUnit

EITHER = Name(value='either')
FUNCTION = Name(value='function')
LIST = Name(value='list')
MAP = Name(value='map')
MAYBE = Name(value='maybe')
NAMED = Name(value='named')
PAIR = Name(value='pair')
SET = Name(value='set')
TYPE_ = Name(value='hydra.lisp.syntax.TypeSpecifier')
UNIT = Name(value='unit')
class hydra.lisp.syntax.TypeSpecifierEither(value: T)

Bases: Node[Sequence[TypeSpecifier]]

An either/union type (two type specifiers)

class hydra.lisp.syntax.TypeSpecifierFunction(value: T)

Bases: Node[Sequence[TypeSpecifier]]

A function type (params and return)

class hydra.lisp.syntax.TypeSpecifierList(value: T)

Bases: Node[TypeSpecifier]

A list type

class hydra.lisp.syntax.TypeSpecifierMap(value: T)

Bases: Node[Sequence[TypeSpecifier]]

A map type (key and value type specifiers)

class hydra.lisp.syntax.TypeSpecifierMaybe(value: T)

Bases: Node[TypeSpecifier]

An optional type

class hydra.lisp.syntax.TypeSpecifierNamed(value: T)

Bases: Node[Symbol]

A named type reference

class hydra.lisp.syntax.TypeSpecifierPair(value: T)

Bases: Node[Sequence[TypeSpecifier]]

A pair/tuple type (two type specifiers)

class hydra.lisp.syntax.TypeSpecifierSet(value: T)

Bases: Node[TypeSpecifier]

A set type

class hydra.lisp.syntax.TypeSpecifierUnit

Bases: object

The unit type

class hydra.lisp.syntax.UnquoteExpression(body: Annotated[Expression, 'The unquoted form'])

Bases: object

An unquoted form within a quasiquote: ~expr or ,expr.

BODY = Name(value='body')
class Builder(_body: 'Expression' = None)

Bases: object

body(body)
build()
TYPE_ = Name(value='hydra.lisp.syntax.UnquoteExpression')
body: Annotated[Expression, 'The unquoted form']
static builder()
with_body(body)
class hydra.lisp.syntax.VariableDefinition(name: Annotated[Symbol, 'The variable name'], value: Annotated[Expression, 'The initial value'], doc: Annotated[object, 'Optional docstring'])

Bases: object

A global variable definition. Serializes as (def name value) in Clojure, (defvar name value) in Emacs Lisp and Common Lisp, (define name value) in Scheme.

class Builder(_name: 'Symbol' = None, _value: 'Expression' = None, _doc: 'Optional[Docstring]' = None)

Bases: object

build()
doc(doc)
name(name)
value(value)
DOC = Name(value='doc')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.lisp.syntax.VariableDefinition')
VALUE = Name(value='value')
static builder()
doc: Annotated[object, 'Optional docstring']
name: Annotated[Symbol, 'The variable name']
value: Annotated[Expression, 'The initial value']
with_doc(doc)
with_name(name)
with_value(value)
class hydra.lisp.syntax.VariableReference(name: Annotated[Symbol, 'The variable name'], function_namespace: Annotated[bool, "Whether to reference from the function namespace. In Lisp-2 dialects (Common Lisp), this emits #'name. In Lisp-1 dialects, this has no effect."])

Bases: object

A reference to a variable by name.

class Builder(_name: 'Symbol' = None, _function_namespace: 'bool' = None)

Bases: object

build()
function_namespace(function_namespace)
name(name)
FUNCTION_NAMESPACE = Name(value='functionNamespace')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.lisp.syntax.VariableReference')
static builder()
function_namespace: Annotated[bool, "Whether to reference from the function namespace. In Lisp-2 dialects (Common Lisp), this emits #'name. In Lisp-1 dialects, this has no effect."]
name: Annotated[Symbol, 'The variable name']
with_function_namespace(function_namespace)
with_name(name)
class hydra.lisp.syntax.VectorLiteral(elements: Annotated[Sequence[Expression], 'The vector elements'])

Bases: object

A vector literal. Serializes as [1 2 3] in Clojure and Emacs Lisp, #(1 2 3) in Common Lisp and Scheme.

class Builder(_elements: 'Sequence[Expression]' = None)

Bases: object

build()
elements(elements)
ELEMENTS = Name(value='elements')
TYPE_ = Name(value='hydra.lisp.syntax.VectorLiteral')
static builder()
elements: Annotated[Sequence[Expression], 'The vector elements']
with_elements(elements)