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
- Unifiablenext
- must be an SLinkedList or Nilcount
- number of nodes in the linked listtail_var
- boolean, true indicates that the term is a tail variable
§Return
node
- SLinkedList
§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]