Macro cons_node

Source
macro_rules! cons_node {
    ($term:expr, $next:expr, $count:expr, $tail_var:expr) => { ... };
}
Expand description

Constructs one node of a singly linked list.

§Notes

  • This macro does no validation.
  • Ordinarily, use slist! to make a Suiron list.

§Arguments

  • term - Unifiable
  • next - must be an SLinkedList or Nil
  • count - number of nodes in the linked list
  • tail_var - boolean, true indicates that the term is a tail variable

§Return

§Usage

  • To build: [a | $X]
use suiron::*;

let x = logic_var!("$X");
let a = atom!("a");
let node1 = cons_node!(x, Nil, 1, true);  // tail variable
let node2 = cons_node!(a, node1, 2, false);
println!("{}", node2);  // Prints: [a | $X]