Primordials¶
Arithmetic¶
- amalgam.primordials.arithmetic._add(env: Environment, *nums: am.Numeric) → am.Numeric[source]¶
Returns the sum of
nums.
- amalgam.primordials.arithmetic._div(env: Environment, *nums: am.Numeric) → am.Numeric[source]¶
Divides
nums[0]and the product ofnums[1:]
Boolean¶
- amalgam.primordials.boolean._and(env: Environment, *exprs: am.Amalgam) → am.Atom[source]¶
Checks the truthiness of the evaluated
exprsand performs an and operation. Short-circuits when:FALSEis returned and does not evaluate subsequent expressions.
- amalgam.primordials.boolean._bool(env: Environment, expr: am.Amalgam) → am.Atom[source]¶
Checks for the truthiness of an
expr.
Comparison¶
- amalgam.primordials.comparison._eq(env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶
Performs an equals comparison.
- amalgam.primordials.comparison._ge(env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶
Performs a greater than or equal comparison.
- amalgam.primordials.comparison._gt(env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶
Performs a greater than comparison.
- amalgam.primordials.comparison._le(env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶
Performs a less than or equal comparison.
Control¶
- amalgam.primordials.control._cond(env: Environment, *pairs: am.Vector[am.Amalgam]) → am.Amalgam[source]¶
Traverses pairs of conditions and values. If the condition evaluates to
:TRUE, returns the value pair and short-circuits evaluation. If no conditions are met,:NILis returned.
- amalgam.primordials.control._do(env: Environment, *exprs: am.Amalgam) → am.Amalgam[source]¶
Evaluates a variadic amount of
exprs, returning the final expression evaluated.
- amalgam.primordials.control._if(env: Environment, cond: am.Amalgam, then: am.Amalgam, else_: am.Amalgam) → am.Amalgam[source]¶
Checks the truthiness of the evaluated
cond, evaluates and returnsthenif:TRUE, otherwise, evaluates and returnselse_.
- amalgam.primordials.control._loop(env: Environment, *exprs: am.Amalgam) → am.Amalgam[source]¶
Loops through and evaluates
exprsindefinitely until abreakorreturnis encountered.
IO¶
- amalgam.primordials.io._exit(env: Environment, exit_code: am.Numeric = <Numeric '0' @ 0x7feb38801710>) → am.Amalgam[source]¶
Exits the program with the given
exit_code.
Meta¶
- amalgam.primordials.meta._eval(env: Environment, amalgam: am.Amalgam) → am.Amalgam[source]¶
Evaluates a given
amalgam.
- amalgam.primordials.meta._fn(env: Environment, args: am.Vector[am.Symbol], body: am.Amalgam) → am.Function[source]¶
Creates an anonymous function using the provided arguments.
Binds
envto the createdamalgams.Functionif a closure is formed.
- amalgam.primordials.meta._let(env: Environment, pairs: am.Vector[am.Vector], body: am.Amalgam) → am.Amalgam[source]¶
Creates temporary bindings of names to values specified in
pairsbefore evaluatingbody.
- amalgam.primordials.meta._macro(env: Environment, name: am.Symbol, args: am.Vector[am.Symbol], body: am.Amalgam) → am.Amalgam[source]¶
Creates a named macro using the provided arguments.
- amalgam.primordials.meta._mkfn(env: Environment, name: am.Symbol, args: am.Vector[am.Symbol], body: am.Amalgam) → am.Amalgam[source]¶
Creates a named function using the provided arguments.
- amalgam.primordials.meta._setn(env: Environment, name: am.Symbol, amalgam: am.Amalgam) → am.Amalgam[source]¶
Binds
nameto the evaluatedamalgamvalue in the immediateenvand returns that value.
- amalgam.primordials.meta._setr(env: Environment, rname: am.Amalgam, amalgam: am.Amalgam) → am.Amalgam[source]¶
Attemps to resolve
rnameto aamalgams.Symboland binds it to the evaluatedamalgamin the immediateenv.
String¶
Utils¶
- amalgam.primordials.utils.make_function(store: Store, name: str, func: Callable[[...], amalgam.primordials.utils.T], defer: bool = False, contextual: bool = False, allows: Sequence[str] = None) → Callable[[...], amalgam.primordials.utils.T][source]¶
- amalgam.primordials.utils.make_function(store: Store, name: str, func: None = None, defer: bool = False, contextual: bool = False, allows: Sequence[str] = None) → functools.partial
Transforms a
funcinto aamalgams.Functionand places it inside of astore.
Vector¶
- amalgam.primordials.vector._at(env: Environment, index: am.Numeric, vector: am.Vector) → am.Amalgam[source]¶
Indexes
vectorwithindex.
- amalgam.primordials.vector._cons(env: Environment, amalgam: am.Amalgam, vector: am.Vector) → am.Vector[source]¶
Preprends an
amalgamtovector.
- amalgam.primordials.vector._is_map(env: Environment, vector: am.Vector) → am.Atom[source]¶
Verifies whether
vectoris a mapping.
- amalgam.primordials.vector._len(env: Environment, vector: am.Vector) → am.Numeric[source]¶
Returns the length of a
vector.
- amalgam.primordials.vector._map_at(env: Environment, vector: am.Vector, atom: am.Atom) → am.Amalgam[source]¶
Obtains the value bound to
atominvector.
- amalgam.primordials.vector._map_in(env: Environment, vector: am.Vector, atom: am.Atom) → am.Atom[source]¶
Checks whether
atomis a member ofvector.
- amalgam.primordials.vector._map_up(env: Environment, vector: am.Vector, atom: am.Atom, amalgam: am.Amalgam) → am.Vector[source]¶
Updates the
vector mapping with :data:`atom, andamalgam.
- amalgam.primordials.vector._merge(env: Environment, *vectors: am.Vector) → am.Vector[source]¶
Merges the given
vectors.
- amalgam.primordials.vector._remove(env: Environment, index: am.Numeric, vector: am.Vector) → am.Vector[source]¶
Removes an item in
vectorusingindex.