Primordials¶
-
amalgam.primordials._add(_env: Environment, *nums: am.Numeric) → am.Numeric[source]¶ Returns the sum of
nums.
-
amalgam.primordials._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._at(_env: Environment, index: am.Numeric, vector: am.Vector) → am.Amalgam[source]¶ Indexes
vectorwithindex.
-
amalgam.primordials._bool(_env: Environment, expr: am.Amalgam) → am.Atom[source]¶ Checks for the truthiness of an
expr.
-
amalgam.primordials._concat(_env: Environment, *strings: am.String) → am.String[source]¶ Concatenates the given
strings.
-
amalgam.primordials._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._cons(_env: Environment, amalgam: am.Amalgam, vector: am.Vector) → am.Vector[source]¶ Preprends an
amalgamtovector.
-
amalgam.primordials._div(_env: Environment, *nums: am.Numeric) → am.Numeric[source]¶ Divides
nums[0]and the product ofnums[1:]
-
amalgam.primordials._do(env: Environment, *exprs: am.Amalgam) → am.Amalgam[source]¶ Evaluates a variadic amount of
exprs, returning the final expression evaluated.
-
amalgam.primordials._eq(_env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶ Performs an equals comparison.
-
amalgam.primordials._eval(env: Environment, amalgam: am.Amalgam) → am.Amalgam[source]¶ Evaluates a given
amalgam.
-
amalgam.primordials._exit(env: Environment, exit_code: am.Numeric = <Numeric '0' @ 0x7f4206a81c90>) → am.Amalgam[source]¶ Exits the program with the given
exit_code.
-
amalgam.primordials._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._ge(env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶ Performs a greater than or equal comparison.
-
amalgam.primordials._gt(_env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶ Performs a greater than comparison.
-
amalgam.primordials._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._is_map(_env: Environment, vector: am.Vector) → am.Atom[source]¶ Verifies whether
vectoris a mapping.
-
amalgam.primordials._le(env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶ Performs a less than or equal comparison.
-
amalgam.primordials._len(_env: Environment, vector: am.Vector) → am.Numeric[source]¶ Returns the length of a
vector.
-
amalgam.primordials._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._loop(env: Environment, *exprs: am.Amalgam) → am.Amalgam[source]¶ Loops through and evaluates
exprsindefinitely until abreakorreturnis encountered.
-
amalgam.primordials._lt(_env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶ Performs a less than comparison.
-
amalgam.primordials._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._make_function(name: str, func: Optional[Callable[[…], T]] = None, defer: bool = False, contextual: bool = False, allows: Optional[Sequence[str]] = None) → Union[functools.partial, Callable[[…], T]][source]¶ Transforms a given function func into a Function and stores it inside of the FUNCTIONS mapping.
-
amalgam.primordials._map_at(_env: Environment, vector: am.Vector, atom: am.Atom) → am.Amalgam[source]¶ Obtains the value bound to
atominvector.
-
amalgam.primordials._map_in(_env: Environment, vector: am.Vector, atom: am.Atom) → am.Atom[source]¶ Checks whether
atomis a member ofvector.
-
amalgam.primordials._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._merge(_env: Environment, *vectors: am.Vector) → am.Vector[source]¶ Merges the given
vectors.
-
amalgam.primordials._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._mul(_env: Environment, *nums: am.Numeric) → am.Numeric[source]¶ Returns the product of
nums.
-
amalgam.primordials._ne(_env: Environment, x: am.Amalgam, y: am.Amalgam) → am.Atom[source]¶ Performs a not equals comparison.
-
amalgam.primordials._not(_env: Environment, expr: am.Amalgam) → am.Atom[source]¶ Checks and negates the truthiness of
expr.
-
amalgam.primordials._or(env: Environment, *exprs: am.Amalgam) → am.Atom[source]¶ Checks the truthiness of the evaluated
exprsand performs an or operation. Short-circuits when:TRUEis returned and does not evaluate subsequent expressions.
-
amalgam.primordials._print(_env: Environment, amalgam: am.Amalgam) → am.Amalgam[source]¶ Prints the provided
amalgamand returns it.
-
amalgam.primordials._putstrln(_env: Environment, string: am.String) → am.String[source]¶ Prints the provided
stringand returns it.
-
amalgam.primordials._remove(_env: Environment, index: am.Numeric, vector: am.Vector) → am.Vector[source]¶ Removes an item in
vectorusingindex.
-
amalgam.primordials._return(env: Environment, result: am.Amalgam) → am.Notification[source]¶ Exits a context with a
result.
-
amalgam.primordials._setn(env: Environment, name: am.Symbol, amalgam: am.Amalgam) → am.Amalgam[source]¶ Binds
nameto the evaluatedamalgamvalue in the immediateenvand returns that value.
-
amalgam.primordials._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.
-
amalgam.primordials._slice(_env: Environment, vector: am.Vector, start: am.Numeric, stop: am.Numeric, step: am.Numeric = <Numeric '1' @ 0x7f4206a816d0>) → am.Vector[source]¶ Returns a slice of the given
vector.
-
amalgam.primordials._snoc(_env: Environment, vector: am.Vector, amalgam: am.Amalgam) → am.Vector[source]¶ Appends an
amalgamtovector.
-
amalgam.primordials._sub(_env: Environment, *nums: am.Numeric) → am.Numeric[source]¶ Subtracts
nums[0]and the summation ofnums[1:].