macro_rules! slist {
() => { ... };
($vbar:expr, $($terms:expr),*) => { ... };
}Expand description
Builds a Suiron list.
Suiron lists are defined and used the same way as Prolog lists. Examples:
[a, b, c]Internally, these lists are implemented as singly linked lists.
[a, b, c | $Tail]
[$Head | $Tail]
§Arguments
vbar- boolean, true if there is a vertical bar (pipe): [a, b, c | $X]terms- list of Unifiable terms
§Return
- list - SLinkedList
§Usage
- To build: [a, b, c]
use suiron::*;
let a = atom!("a");
let b = atom!("b");
let c = atom!("c");
let list1 = slist!(false, a, b, c);- To build: [a, b, c | $X]
use suiron::*;
let a = atom!("a");
let b = atom!("b");
let c = atom!("c");
let x = logic_var!(next_id(), "$X");
let list2 = slist!(true, a, b, c, x);- To build: []
use suiron::*;
let list3 = slist!();