Modifying your lambda object

Modifying your Hyperlambda graph object

Since there are no explicit variables in Hyperlambda, yet all nodes potentially might change, this requires the ability to change your nodes as you execute your Hyperlambda. Magic provides many slots to achieve this, both to change the names, values, and types of your nodes - In addition to adding a range of nodes into some other node, and/or remove nodes from the children collection of your nodes.

  • add - This slot allows you to dynamically add nodes into a destination node.
  • insert-before - This slot works the exact same way as the [add] node, except it will insert the nodes before the node(s) referenced in its main/destination argument.
  • insert-after - This slot works the exact same way as the [add] and [insert-before] slots, except it will insert the nodes after the node(s) referenced in its main/destination argument.
  • remove-nodes - This slot will remove all nodes its expression is pointing to.
  • include - This slot is logically the combination of a [for-each], [add] and [eval/invoke].
  • filter - Filter allows you to filter using a predicate.
  • set-value - Changes the value of all nodes referenced as its main expression to whatever its single source happens to be.
  • set-x - Similar to [set-value], but does not evaluate expressions found in its source.
  • set-name - Changes the name of all nodes referenced as its main expression to whatever its single source happens to be.
  • unwrap - This slot is useful if you want to evaluate some expression before the node where it’s referenced is reached.
  • get-value - Returns the value of the node its expression is pointing to.
  • get-name - Returns the name of the node referenced in its expression.
  • get-count - This slot returns the number of nodes its expression is pointing to.
  • get-nodes - Returns the nodes its expression is referencing.
  • exists - [exists] will evaluate to true if its specified expression yields one or more results.
  • not-exists - [not-exists] will evaluate to true if its specified expression yields zero results.
  • null - [null] will evaluate to true if its specified expression yields null, or the expression returns no nodes.
  • not-null - [not-null] will evaluate to true if its specified expression returns nodes and at least one of those nodes has a value.
  • reference - This slot will evaluate its expression, and add the entire node the expression is pointing to, as a referenced node into its value.
  • get-first-value - Returns the first non-null value resulting from evaluating its expression, and/or its children nodes.
  • get-context - This slot returns a context stack object, which is an object added to the stack using [context].