Failing
alias
fn alias(valid: bool) -> (Vec<String>, Option<String>, bool) {
let mut arena = Valued::<usize>::default();
let element = 200usize;
let _ = arena.allocate(element).expect("allocation failed");
let lookup = if valid {
element
} else {
999
};
let (result, events) = capture(|| arena.alias(&lookup));
let found = result.is_ok();
let event = events.first();
let chs = event.map(channels).unwrap_or_default();
let captured = event.and_then(|e| stream::field(&e.fields, "id")).map(ToString::to_string);
(chs, captured, found)
}
#0
{"valid": true}
{"()": [["arena"null], "0"null, true]}
#1
{"valid": false}
{"()": [[], null, false]}
allocate
fn allocate(existing: bool) -> (usize, Vec<String>, Option<String>, Option<String>) {
let mut arena = Valued::<usize>::default();
let element = 42usize;
if existing {
let _ = arena.allocate(element);
}
let (result, events) = capture(|| arena.allocate(element));
let id = result.expect("allocation failed");
let event = events.first();
let chs = event.map(channels).unwrap_or_default();
let captured = event.and_then(|e| stream::field(&e.fields, "id")).map(ToString::to_string);
let state = event.and_then(|e| stream::field(&e.fields, "state")).map(ToString::to_string);
(id, chs, captured, state)
}
#0
{"existing": false}
{"()": [0, ["arena"null], "0"null, "Created"null]}
#1
{"existing": true}
{"()": [0, ["arena"null], "0"null, "Existing"null]}
value
fn value(valid: bool) -> (Vec<String>, Option<String>, bool) {
let mut arena = Valued::<usize>::default();
let element = 100usize;
let id = arena.allocate(element).expect("allocation failed");
let lookup = if valid {
id
} else {
id + 999
};
let (result, events) = capture(|| arena.value(lookup));
let found = result.is_ok();
let event = events.first();
let chs = event.map(channels).unwrap_or_default();
let captured = event.and_then(|e| stream::field(&e.fields, "id")).map(ToString::to_string);
(chs, captured, found)
}
#0
{"valid": true}
{"()": [["arena"null], "0"null, true]}
#1
{"valid": false}
{"()": [[], null, false]}
diffuse
fn diffuse(count: usize) -> (Vec<String>, Vec<String>, usize) {
let mut graph = empty();
let particles = (0..count).map(Particle::fundamental).collect::<Vec<_>>();
let wave = Wave::from(particles.as_slice());
let (labels, events) = capture(&["hypergraph"], || graph.diffuse(wave).collect::<Vec<_>>());
let event = events.last();
let chs = event.map(channels).unwrap_or_default();
let flds = event.map(names).unwrap_or_default();
(chs, flds, labels.len())
}
#0
{"count": 1}
{"()": [["hypergraph"null], ["signal"null, "labels"null], 1]}
#1
{"count": 3}
{"()": [["hypergraph"null], ["signal"null, "labels"null], 3]}
fixed
fn fixed(populated: bool) -> (Vec<String>, Vec<String>, Option<String>) {
let mut graph = empty();
if populated {
let particle = Particle::fundamental(1usize);
let _ = graph.focus(particle);
}
let rules = if populated {
let source = Wave::monochromatic(Particle::fundamental(1usize));
let sink = Wave::monochromatic(Particle::fundamental(2usize));
let mut adjacency = BTreeMap::new();
adjacency.insert(source, BTreeSet::from([sink]));
Related::new(adjacency)
} else {
Related::default()
};
let (result, events) = capture(&["hypergraph"], || graph.fixed(rules));
let _ = result.expect("fixed failed");
let event = events.last();
let chs = event.map(channels).unwrap_or_default();
let flds = event.map(names).unwrap_or_default();
let iterations = event.and_then(|e| stream::field(&e.fields, "iterations")).map(ToString::to_string);
(chs, flds, iterations)
}
#0
{"populated": false}
{
"()": [["hypergraph"null], ["rules"null, "edges"null, "iterations"null, "count"null], "0"null]
}
#1
{"populated": true}
{
"()": [["hypergraph"null], ["rules"null, "edges"null, "iterations"null, "count"null], "1"null]
}
focus
fn focus() -> (Vec<String>, Vec<String>, Option<String>) {
let mut graph = empty();
let particle = Particle::fundamental(1usize);
let (label, events) = capture(&["hypergraph"], || graph.focus(particle));
let event = events.first();
let chs = event.map(channels).unwrap_or_default();
let flds = event.map(names).unwrap_or_default();
let captured = event.and_then(|e| stream::field(&e.fields, "label")).map(ToString::to_string);
let _ = label;
(chs, flds, captured)
}
#0
{}
{"()": [["hypergraph"null], ["label"null, "particle"null, "world"null], "0"null]}
infer
fn infer(populated: bool) -> (Vec<String>, Vec<String>, Option<String>) {
let mut graph = empty();
if populated {
let particle = Particle::fundamental(1usize);
let _ = graph.focus(particle);
}
let rules = if populated {
let source = Wave::monochromatic(Particle::fundamental(1usize));
let sink = Wave::monochromatic(Particle::fundamental(2usize));
let mut adjacency = BTreeMap::new();
adjacency.insert(source, BTreeSet::from([sink]));
Related::new(adjacency)
} else {
Related::default()
};
let (result, events) = capture(&["query"], || graph.infer(rules));
let _ = result.expect("infer failed");
let event = events.first();
let chs = event.map(channels).unwrap_or_default();
let flds = event.map(names).unwrap_or_default();
let count = event.and_then(|e| stream::field(&e.fields, "count")).map(ToString::to_string);
(chs, flds, count)
}
#0
{"populated": false}
{"()": [["query"null], ["rules"null, "edges"null, "count"null], "0"null]}
#1
{"populated": true}
{"()": [["query"null], ["rules"null, "edges"null, "count"null], "1"null]}
locate
fn locate(valid: bool) -> (Vec<String>, Vec<String>, bool) {
let mut graph = empty();
let particle = Particle::fundamental(1usize);
let label = graph.focus(particle);
let lookup = if valid {
label
} else {
Label(9999)
};
let (result, events) = capture(&["hypergraph"], || graph.locate(lookup));
let found = result.is_ok();
let event = events.first();
let chs = event.map(channels).unwrap_or_default();
let flds = event.map(names).unwrap_or_default();
(chs, flds, found)
}
#0
{"valid": true}
{"()": [["hypergraph"null], ["label"null, "resolved"null], true]}
#1
{"valid": false}
{"()": [[], [], false]}
translate
fn translate(existing: bool) -> (Vec<String>, Vec<String>, Option<String>) {
let mut graph = empty();
let particle = Particle::fundamental(1usize);
let l1 = graph.focus(particle.clone());
let l2 = graph.focus(particle.clone());
let source = BTreeSet::from([l1]);
let destinations = BTreeSet::from([l2]);
let relation = Relation {
source: Wave::monochromatic(particle.clone()),
sink: Wave::monochromatic(particle.clone())
};
if existing {
let _ = graph.translate(source.clone(), destinations.clone(), relation.clone());
}
let (result, events) = capture(&["hypergraph"], || {
graph.translate(source, destinations, relation)
});
let _ = result.expect("translate failed");
let event = events.last();
let chs = event.map(channels).unwrap_or_default();
let flds = event.map(names).unwrap_or_default();
let state = event.and_then(|e| stream::field(&e.fields, "state")).map(ToString::to_string);
(chs, flds, state)
}
#0
{"existing": false}
{
"()": [
["hypergraph"null],
["source"null, "destinations"null, "rule"null, "edge"null, "state"null],
"Created"null
]
}
#1
{"existing": true}
{
"()": [
["hypergraph"null],
["source"null, "destinations"null, "rule"null, "edge"null, "state"null],
"Existing"null
]
}
unite
fn unite(same: bool) -> (Vec<String>, Vec<String>, bool) {
let mut graph = empty();
let p1 = Particle::fundamental(1usize);
let p2 = Particle::fundamental(2usize);
let l1 = graph.focus(p1);
let l2 = if same {
l1
} else {
graph.focus(p2)
};
let (result, events) = capture(&["hypergraph"], || graph.unite(l1, l2));
let _ = result.expect("unite failed");
let event = events.last();
let chs = event.map(channels).unwrap_or_default();
let flds = event.map(names).unwrap_or_default();
let subset = flds.contains(&"subset".to_string());
(chs, flds, subset)
}
#0
{"same": true}
{"()": [["hypergraph"null], ["first"null, "second"null, "merged"null], false]}
#1
{"same": false}
{
"()": [["hypergraph"null], ["first"null, "second"null, "merged"null, "subset"null], truefalse]
}
traced
fn traced(value: usize) -> (usize, String, String) {
let sink = Streamer::assembler(stream::predicate("test")).open();
let result = compute(value);
let event = sink
.close()
.events()
.next();
let level = event
.as_ref()
.map(|e| format!("{:?}" , e . metadata . level))
.unwrap_or_default();
let captured = event
.as_ref()
.and_then(|e| stream::field(&e.fields, "result"))
.map(ToString::to_string)
.unwrap_or_default();
(result, level, captured)
}
#0
{"value": 5}
{"()": [10, "Info""", "10"""]}
#1
{"value": 0}
{"()": [0, "Info""", "0"""]}
#2
{"value": 100}
{"()": [200, "Info""", "200"""]}
leveled
fn leveled(level: usize) -> (usize, String) {
let sink = Streamer::assembler(stream::predicate("test")).open();
let guard = tracing::debug_span!("test" , channels = "test:1").entered();
match level {
0 => record::trace!(level = 0),
1 => record::debug!(level = 1),
2 => record::info!(level = 2),
3 => record::warn!(level = 3),
4 => record::error!(level = 4),
_ => {
},
}
drop(guard);
let captured = sink
.close()
.events()
.next()
.map(|e| format!("{:?}" , e . metadata . level))
.unwrap_or_default();
(usize::from(!captured.is_empty()), captured)
}
#0
{"level": 0}
{"()": [10, "Trace"""]}
#1
{"level": 1}
{"()": [10, "Debug"""]}
#2
{"level": 2}
{"()": [10, "Info"""]}
#3
{"level": 3}
{"()": [10, "Warn"""]}
#4
{"level": 4}
{"()": [10, "Error"""]}
#5
{"level": 99}
{"()": [0, ""]}
instrumented
fn instrumented(value: usize) -> (usize, String, String) {
let sink = Streamer::assembler(stream::predicate("test")).open();
let _ = traced(value);
let collected = sink
.close()
.events()
.collect::<Vec<_>>();
let event = collected.first();
let level = event.map(|e| format!("{:?}" , e . metadata . level)).unwrap_or_default();
let captured = event
.and_then(|e| stream::field(&e.fields, "inside"))
.map(ToString::to_string)
.unwrap_or_default();
(collected.len(), level, captured)
}
#0
{"value": 10}
{"()": [10, "Info""", "10"""]}
#1
{"value": 0}
{"()": [10, "Info""", "0"""]}
Passing
from.slice
pub fn slice(elements: Vec<String>) -> Particle<String> {
Particle::from(elements.as_slice())
}
#0
{"elements": ["a", "b", "a", "c", "b", "a"]}
{"()": [["a", 3], ["b", 2], ["c", 1]]}
#1
{"elements": ["x", "y", "z"]}
{"()": [["x", 1], ["y", 1], ["z", 1]]}
#2
{"elements": []}
{"()": []}
fundamental
fn fundamental(data: String) -> Particle<String> {
Particle::fundamental(data)
}
#0
{"data": "test"}
{"()": [["test", 1]]}
#1
{"data": "hello"}
{"()": [["hello", 1]]}
new
fn new(elements: BTreeMap<String, usize>) -> Particle<String> {
Particle::new(elements)
}
#0
{"elements": {"a": 2, "b": 3}}
{"()": [["a", 2], ["b", 3]]}
#1
{"elements": {}}
{"()": []}
empty
fn empty(wave: &Wave<String>) -> bool {
wave.empty()
}
#0
{"wave": []}
{"()": true}
#1
{"wave": [[[["a", 1]], 1]]}
{"()": false}
from.slice
pub fn slice(particles: Vec<Particle<String>>) -> Wave<String> {
Wave::from(particles.as_slice())
}
#0
{"particles": []}
{"()": []}
#1
{"particles": [[["a", 1]]]}
{"()": [[[["a", 1]], 1]]}
#2
{"particles": [[["a", 1]], [["a", 1]], [["b", 1]]]}
{"()": [[[["a", 1]], 2], [[["b", 1]], 1]]}
monochromatic
fn monochromatic(data: Particle<String>) -> Wave<String> {
Wave::monochromatic(data)
}
#0
{"data": [["test", 1]]}
{"()": [[[["test", 1]], 1]]}
#1
{"data": [["a", 2], ["b", 3]]}
{"()": [[[["a", 2], ["b", 3]], 1]]}
new
fn new(particles: Vec<(Particle<String>, usize)>) -> Wave<String> {
Wave::new(particles.into_iter().collect())
}
#0
{"particles": []}
{"()": []}
#1
{"particles": [[[["a", 1]], 2]]}
{"()": [[[["a", 1]], 2]]}
#2
{"particles": [[[["a", 1]], 2], [[["b", 1]], 3]]}
{"()": [[[["a", 1]], 2], [[["b", 1]], 3]]}
polychromatic
fn polychromatic(data: Particle<String>, multiplicity: usize) -> Wave<String> {
Wave::polychromatic(data, multiplicity)
}
#0
{"data": [["test", 1]], "multiplicity": 5}
{"()": [[[["test", 1]], 5]]}
#1
{"data": [["a", 2], ["b", 1]], "multiplicity": 3}
{"()": [[[["a", 2], ["b", 1]], 3]]}
new
fn new(adjacency: Vec<(String, BTreeSet<String>)>) -> Related<String> {
Related::new(adjacency.into_iter().collect())
}
#0
{"adjacency": []}
{"()": {"adjacency": []}}
#1
{"adjacency": [["a", ["b"]]]}
{"()": {"adjacency": [["a", ["b"]]]}}
#2
{"adjacency": [["a", ["b", "c"]], ["b", ["d"]]]}
{"()": {"adjacency": [["a", ["b", "c"]], ["b", ["d"]]]}}
relate
fn relate(mut related: Related<String>, label: String, relation: String) -> Related<String> {
related.relate(&label, &relation).clone()
}
#0
{"label": "a", "relation": "b", "related": {"adjacency": []}}
{"()": {"adjacency": [["a", ["b"]]]}}
#1
{
"label": "a",
"relation": "c",
"related": {"adjacency": [["a", ["b"]]]}
}
{"()": {"adjacency": [["a", ["b", "c"]]]}}
#2
{
"label": "c",
"relation": "d",
"related": {"adjacency": [["a", ["b"]]]}
}
{"()": {"adjacency": [["a", ["b"]], ["c", ["d"]]]}}
assembler.category
pub fn category(value: Category<String>) -> Attribute<String> {
Assembler::empty().category(value).assemble()
}
#0
{"value": "Partition"}
{"()": {"category": "Partition", "context": []}}
assembler.context
pub fn context(category: Category<String>, attribute: Attribute<String>) -> Attribute<String> {
let mut assembler = Assembler::new(category);
assembler.context(attribute);
assembler.assemble()
}
#0
{
"attribute": {"category": {"Attribute": "child"}, "context": []},
"category": {"Attribute": "parent"}
}
{
"()": {
"category": {"Attribute": "parent"},
"context": [{"category": {"Attribute": "child"}, "context": []}]
}
}
assembler.empty
pub fn empty() -> Attribute<String> {
Assembler::empty().assemble()
}
#0
{}
{"()": {"category": "Void", "context": []}}
assembler.new
pub fn new(category: Category<String>) -> Attribute<String> {
Assembler::new(category).assemble()
}
#0
{"category": {"Attribute": "value"}}
{"()": {"category": {"Attribute": "value"}, "context": []}}
#1
{"category": "Context"}
{"()": {"category": "Context", "context": []}}
assembler.then
pub fn then(category: Category<String>, attributes: Vec<Attribute<String>>) -> Attribute<String> {
let mut assembler = Assembler::new(category);
for attribute in attributes { let _ = assembler . then (attribute) ; }
assembler.assemble()
}
#0
{"attributes": [], "category": {"Attribute": "root"}}
{"()": {"category": {"Attribute": "root"}, "context": []}}
#1
{
"attributes": [
{"category": "Context", "context": []},
{"category": "Group", "context": []}
],
"category": {"Attribute": "root"}
}
{
"()": {
"category": {"Attribute": "root"},
"context": [
{"category": "Context", "context": []},
{"category": "Group", "context": []}
]
}
}
category.attribute
pub fn attribute(value: String) -> Category<String> {
Category::Attribute(value)
}
#0
{"value": "test"}
{"()": {"Attribute": "test"}}
#1
{"value": "hello"}
{"()": {"Attribute": "hello"}}
category.context
pub fn context() -> Category<String> {
Category::Context
}
#0
{}
{"()": "Context"}
category.group
pub fn group() -> Category<String> {
Category::Group
}
#0
{}
{"()": "Group"}
category.partition
pub fn partition() -> Category<String> {
Category::Partition
}
#0
{}
{"()": "Partition"}
category.void
pub fn void() -> Category<String> {
Category::Void
}
#0
{}
{"()": "Void"}
from.u8
pub fn u8(value: u8) -> String {
format!("{:?}" , Syntax :: from (value))
}
#0
{"value": 91}
{"()": "Contexting"}
#1
{"value": 93}
{"()": "Contexted"}
#2
{"value": 40}
{"()": "Grouping"}
#3
{"value": 41}
{"()": "Grouped"}
#4
{"value": 44}
{"()": "Partition"}
#5
{"value": 46}
{"()": "Continuation"}
#6
{"value": 65}
{"()": "Element(65)"}
#7
{"value": 48}
{"()": "Element(48)"}
#8
{"value": 32}
{"()": "Element(32)"}
elements
fn elements(translation: Translation<String>) -> Vec<String> {
translation.elements().to_vec()
}
#0
{"translation": {"initial": 0, "terminal": 0, "elements": []}}
{"()": []}
#1
{
"translation": {"initial": 1, "terminal": 2, "elements": ["a", "b", "c"]}
}
{"()": ["a", "b", "c"]}
initial
fn initial(translation: Translation<String>) -> u64 {
translation.initial()
}
#0
{
"translation": {"initial": 5, "terminal": 10, "elements": ["test"]}
}
{"()": 5}
length
fn length(translation: Translation<String>) -> usize {
translation.length()
}
#0
{"translation": {"initial": 0, "terminal": 0, "elements": []}}
{"()": 0}
#1
{
"translation": {"initial": 0, "terminal": 0, "elements": ["test"]}
}
{"()": 1}
#2
{
"translation": {"initial": 0, "terminal": 0, "elements": ["a", "b", "c", "d", "e"]}
}
{"()": 5}
new
fn new(initial: u64, terminal: u64, elements: Vec<String>) -> Translation<String> {
Translation::new(initial, terminal, elements)
}
#0
{"terminal": 0, "elements": [], "initial": 0}
{"()": {"initial": 0, "terminal": 0, "elements": []}}
#1
{"terminal": 2, "elements": ["hello"], "initial": 1}
{"()": {"initial": 1, "terminal": 2, "elements": ["hello"]}}
#2
{"elements": ["foo", "bar", "baz"], "terminal": 20, "initial": 10}
{
"()": {"initial": 10, "terminal": 20, "elements": ["foo", "bar", "baz"]}
}
terminal
fn terminal(translation: Translation<String>) -> u64 {
translation.terminal()
}
#0
{
"translation": {"initial": 5, "terminal": 10, "elements": ["test"]}
}
{"()": 10}
translation.char.parsed
pub fn parsed(translation: Translation<char>) -> String {
translation.parsed()
}
#0
{
"translation": {"initial": 0, "terminal": 1, "elements": ["H", "e", "l", "l", "o"]}
}
{"()": "Hello"}
#1
{
"translation": {
"initial": 1,
"terminal": 2,
"elements": ["h", "e", "l", "l", "o", " ", "w", "o", "r", "l", "d"]
}
}
{"()": "hello world"}
#2
{"translation": {"initial": 0, "terminal": 0, "elements": []}}
{"()": ""}
translation.u8.characterize
pub fn characterize(translation: Translation<u8>) -> Translation<char> {
translation.characterize()
}
#0
{
"translation": {"initial": 1, "terminal": 2, "elements": [72, 101, 108, 108, 111]}
}
{
"()": {"initial": 1, "terminal": 2, "elements": ["H", "e", "l", "l", "o"]}
}
#1
{
"translation": {"initial": 0, "terminal": 1, "elements": [49, 50, 51]}
}
{"()": {"initial": 0, "terminal": 1, "elements": ["1", "2", "3"]}}
#2
{"translation": {"initial": 5, "terminal": 5, "elements": []}}
{"()": {"initial": 5, "terminal": 5, "elements": []}}
compressed
fn compressed(graph: Hypergraph<usize>) -> (bool, bool) {
let uncompressed = assembler(&graph, "uncompressed")
.compressed(false)
.assemble()
.expect("assemble failed");
let compressed = assembler(&graph, "compressed")
.compressed(true)
.assemble()
.expect("assemble failed");
let smaller = compressed.state.len() <= uncompressed.state.len();
let restored: Hypergraph<usize> = restore(&compressed).expect("restore failed");
let valid = graph == restored;
(smaller, valid)
}
#0
{
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
}
}
{"()": [true, true]}
#1
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]], [3, [[4, 1]]], [4, [[5, 1]]]],
"edges": [],
"particles": 5,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4},
"world": {"0": 0, "1": 0, "2": 0, "3": 0, "4": 0},
"worlds": 1,
"united": {"0": [0, 1, 2, 3, 4]},
"future": {"0": [], "1": [], "2": [], "3": [], "4": []},
"past": {"0": [], "1": [], "2": [], "3": [], "4": []}
}
}
{"()": [true, true]}
roundtrip
fn roundtrip(graph: Hypergraph<usize>) -> bool {
let snapshot = capture(&graph, "test").expect("capture failed");
let restored: Hypergraph<usize> = restore(&snapshot).expect("restore failed");
graph == restored
}
#0
{
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
}
}
{"()": true}
#1
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
}
}
{"()": true}
#2
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]]],
"edges": [],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 0, "2": 0},
"worlds": 1,
"united": {"0": [0, 1, 2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
}
}
{"()": true}
timestamp
fn timestamp(graph: Hypergraph<usize>) -> bool {
let snapshot = capture(&graph, "test").expect("capture failed");
snapshot.timestamp > 0
}
#0
{
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
}
}
{"()": true}
trigger
fn trigger(graph: Hypergraph<usize>, name: String) -> String {
let snapshot = capture(&graph, &name).expect("capture failed");
snapshot.trigger
}
#0
{
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
},
"name": "manual"
}
{"()": "manual"}
#1
{
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
},
"name": "step"
}
{"()": "step"}
particle.disjoint
pub fn disjoint(source: Particle<String>, basis: Particle<String>) -> bool {
source.disjoint(&basis).is_some()
}
#0
{"basis": [["B", 1]], "source": [["A", 1]]}
{"()": true}
#1
{"basis": [["B", 1]], "source": [["A", 1], ["B", 1]]}
{"()": false}
particle.empty
pub fn empty(source: Particle<String>) -> bool {
source.empty()
}
#0
{"source": []}
{"()": true}
#1
{"source": [["A", 1]]}
{"()": false}
particle.isomorphic
pub fn isomorphic(source: Particle<String>, basis: Particle<String>) -> bool {
source.isomorphic(&basis).is_some()
}
#0
{"basis": [["A", 1], ["B", 1]], "source": [["A", 1], ["B", 1]]}
{"()": true}
#1
{"basis": [["A", 1], ["B", 1]], "source": [["A", 1]]}
{"()": false}
particle.joint
pub fn joint(source: Particle<String>, basis: Particle<String>) -> bool {
source.joint(&basis).is_some()
}
#0
{"source": [["A", 1], ["B", 1]], "basis": [["B", 1], ["C", 1]]}
{"()": true}
#1
{"source": [["A", 1]], "basis": [["B", 1]]}
{"()": false}
particle.rank
pub fn rank(source: Particle<String>) -> usize {
source.rank()
}
#0
{"source": []}
{"()": 0}
#1
{"source": [["A", 1]]}
{"()": 1}
#2
{"source": [["A", 1], ["B", 1], ["C", 1]]}
{"()": 3}
particle.subset
pub fn subset(source: Particle<String>, basis: Particle<String>) -> bool {
source.subset(&basis).is_some()
}
#0
{"source": [], "basis": [["A", 1]]}
{"()": true}
#1
{"source": [["A", 1]], "basis": [["A", 1], ["B", 1]]}
{"()": true}
#2
{"source": [["A", 1], ["C", 1]], "basis": [["A", 1], ["B", 1]]}
{"()": false}
particle.superset
pub fn superset(source: Particle<String>, basis: Particle<String>) -> bool {
source.superset(&basis).is_some()
}
#0
{"source": [["A", 1], ["B", 1]], "basis": [["A", 1]]}
{"()": true}
#1
{"source": [["A", 1]], "basis": [["A", 1], ["B", 1]]}
{"()": false}
wave.diverges
pub fn diverges(source: Wave<String>, basis: Wave<String>) -> Vec<Wave<String>> {
source.diverges(&basis)
}
#0
{"source": [[[["A", 1]], 1]], "basis": []}
{"()": [[[[["A", 1]], 1]]]}
#1
{"source": [[[["A", 1]], 1]], "basis": [[[["A", 1]], 1]]}
{"()": [[]]}
wave.rank
pub fn rank(source: Wave<String>) -> usize {
source.rank()
}
#0
{"source": []}
{"()": 0}
#1
{"source": [[[["A", 1]], 1]]}
{"()": 1}
#2
{"source": [[[["A", 1]], 2], [[["B", 1]], 1]]}
{"()": 3}
wave.subset
pub fn subset(source: Wave<String>, basis: Wave<String>) -> bool {
source.subset(&basis).is_some()
}
#0
{"basis": [[[["A", 1]], 1]], "source": []}
{"()": true}
#1
{"basis": [[[["A", 1], ["B", 1]], 1]], "source": [[[["A", 1]], 1]]}
{"()": true}
#2
{"basis": [[[["A", 1]], 1]], "source": [[[["C", 1]], 1]]}
{"()": false}
wave.superset
pub fn superset(source: Wave<String>, basis: Wave<String>) -> bool {
source.superset(&basis).is_some()
}
#0
{"basis": [], "source": [[[["A", 1]], 1]]}
{"()": true}
#1
{"source": [[[["A", 1], ["B", 1]], 1]], "basis": [[[["A", 1]], 1]]}
{"()": true}
arena
fn arena(resource: PathBuf) -> Arena<Attribute<String>> {
let module = utility::unwrap(utility::unwrap(Source::path(resource)).module());
utility::unwrap(module.arena())
}
#0
{
"resource": "Molten/test/resource/system/graph/module/echo/symbolic/echo.lava"
}
{
"()": {
"indices": [
[
{
"category": "Group",
"context": [
{"category": {"Attribute": "Stream"}},
{"category": {"Attribute": "Sink"}},
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
}
]
},
3
],
[
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
15
],
[{"category": {"Attribute": "Data"}}, 10],
[
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
},
4
],
[{"category": {"Attribute": "Sink"}}, 6],
[{"category": {"Attribute": "Stream"}}, 5],
[
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
},
7
],
[
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
},
8
],
[{"category": "Partition"}, 13],
[{"category": {"Attribute": "value"}}, 16],
[
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
},
17
],
[{"category": {"Attribute": "Format"}}, 11],
[{"category": "Void"}, 2],
[
{
"category": "Context",
"context": [
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
}
]
},
1
],
[{"category": {"Attribute": "Binary"}}, 14],
[
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
},
9
],
[{"category": {"Attribute": "8"}}, 18],
[{"category": {"Attribute": "Unicode"}}, 12],
[
{
"category": "Group",
"context": [
{
"category": "Context",
"context": [
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": {"Attribute": "Stream"}},
{"category": {"Attribute": "Sink"}},
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
}
]
}
]
},
0
]
],
"values": {
"6": {"category": {"Attribute": "Sink"}},
"17": {
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
},
"18": {"category": {"Attribute": "8"}},
"13": {"category": "Partition"},
"9": {
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
},
"1": {
"category": "Context",
"context": [
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
}
]
},
"15": {
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
"7": {
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
},
"10": {"category": {"Attribute": "Data"}},
"16": {"category": {"Attribute": "value"}},
"4": {
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
},
"0": {
"category": "Group",
"context": [
{
"category": "Context",
"context": [
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": {"Attribute": "Stream"}},
{"category": {"Attribute": "Sink"}},
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
}
]
}
]
},
"8": {
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
},
"2": {"category": "Void"},
"14": {"category": {"Attribute": "Binary"}},
"11": {"category": {"Attribute": "Format"}},
"5": {"category": {"Attribute": "Stream"}},
"12": {"category": {"Attribute": "Unicode"}},
"3": {
"category": "Group",
"context": [
{"category": {"Attribute": "Stream"}},
{"category": {"Attribute": "Sink"}},
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
}
]
}
},
"counter": 19
}
}
relations
fn relations(resource: PathBuf) -> Related<Wave<usize>> {
let module = utility::unwrap(utility::unwrap(Source::path(resource)).module());
let index: Arena<Attribute<String>> = utility::unwrap(module.arena());
utility::unwrap(system::graph::constructor::relate(&module, index.borrow()))
}
#0
{
"resource": "Molten/test/resource/system/graph/module/echo/symbolic/echo.lava"
}
{"()": {"adjacency": [[[[[[4, 1]], 1]], [[[[[3, 1]], 1]]]]]}}
#1
{
"resource": "Molten/test/resource/system/graph/module/math/numeric/logic/boolean/symbolic/boolean.magma"
}
{
"()": {
"adjacency": [
[[[[[3, 1], [14, 1]], 1]], [[[[[7, 1]], 1]]]],
[[[[[3, 2], [15, 1]], 1]], [[[[[9, 1]], 1]]]],
[[[[[3, 2], [17, 1]], 1]], [[[[[11, 1]], 1]]]],
[[[[[7, 1]], 1], [[[12, 1]], 1]], [[[[[13, 1]], 1]]]],
[[[[[7, 1]], 1], [[[13, 1]], 1]], [[[[[12, 1]], 1]]]],
[[[[[9, 1]], 1], [[[12, 1]], 1]], [[[[[12, 1]], 1]]]],
[[[[[9, 1]], 1], [[[13, 2]], 1]], [[[[[13, 1]], 1]]]],
[[[[[11, 1]], 1], [[[12, 2]], 1]], [[[[[12, 1]], 1]]]],
[[[[[11, 1]], 1], [[[13, 1]], 1]], [[[[[13, 1]], 1]]]],
[[[[[12, 1]], 1]], [[[[[3, 1]], 1]]]],
[[[[[13, 1]], 1]], [[[[[3, 1]], 1]]]]
]
}
}
#2
{
"resource": "Molten/test/resource/system/graph/module/join/symbolic/join.magma"
}
{
"()": {
"adjacency": [
[[[[[9, 1]], 1], [[[10, 1]], 1]], [[[[[3, 1]], 1]]]],
[
[[[[9, 1]], 1], [[[10, 1]], 1], [[[11, 1]], 1]],
[[[[[3, 1]], 1]], [[[[6, 1]], 1]], [[[[8, 1]], 1]]]
],
[[[[[10, 1]], 1]], [[[[[6, 1]], 1]]]]
]
}
}
graph
fn graph(attribute: Attribute<String>) -> Related<Wave<usize>> {
let index: Arena<Attribute<String>> = utility::unwrap(attribute.arena());
utility::unwrap(system::graph::constructor::relate(&attribute, index.borrow()))
}
#0
{
"attribute": {
"category": "Context",
"context": [
{
"category": "Context",
"context": [{"category": {"Attribute": "inner"}, "context": []}]
},
{"category": "Void", "context": []},
{
"category": "Group",
"context": [
{
"category": "Context",
"context": [{"category": {"Attribute": "inner"}, "context": []}]
}
]
}
]
}
}
{"()": {"adjacency": [[[[[[4, 1]], 1]], [[[[[3, 1]], 1]]]]]}}
#1
{
"attribute": {
"category": "Group",
"context": [
{
"category": "Context",
"context": [
{"category": {"Attribute": "A"}, "context": []},
{"category": {"Attribute": "B"}, "context": []}
]
},
{"category": "Void", "context": []},
{"category": {"Attribute": "C"}, "context": []},
{"category": {"Attribute": "D"}, "context": []}
]
}
}
{
"()": {"adjacency": [[[[[[5, 1], [6, 1]], 1]], [[[[[3, 1], [4, 1]], 1]]]]]}
}
#2
{
"attribute": {
"category": "Group",
"context": [
{
"category": "Context",
"context": [{"category": {"Attribute": "A"}, "context": []}]
},
{"category": "Void", "context": []},
{"category": {"Attribute": "B"}, "context": []},
{"category": {"Attribute": "C"}, "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "D"}, "context": []}
]
}
}
{
"()": {
"adjacency": [[[[[[6, 1]], 1]], [[[[[3, 1], [4, 1]], 1]], [[[[5, 1]], 1]]]]]
}
}
descendants
fn descendants(source: Related<String>, from: String) -> Option<Vec<String>> {
source.descendants(&from).map(|set| set.into_iter().collect::<Vec<_>>())
}
#0
{
"source": {"adjacency": [["A", ["B", "C"]], ["B", ["D"]]]},
"from": "A"
}
{"()": ["B", "C"]}
#1
{"source": {"adjacency": [["A", ["B"]]]}, "from": "Z"}
{"()": null}
#2
{"source": {"adjacency": []}, "from": "A"}
{"()": null}
predecessors
fn predecessors(source: Related<String>, from: String) -> Option<Vec<String>> {
source.predecessors(&from).map(|set| set.into_iter().collect::<Vec<_>>())
}
#0
{"from": "C", "source": {"adjacency": [["A", ["C"]], ["B", ["C"]]]}}
{"()": ["A", "B"]}
#1
{"from": "Z", "source": {"adjacency": [["A", ["B"]]]}}
{"()": null}
#2
{"from": "C", "source": {"adjacency": [["A", ["B", "C"]]]}}
{"()": ["A"]}
relate
fn relate(source: Related<String>, label: String, relation: String) -> Related<String> {
let mut graph = source;
graph.relate(&label, &relation);
graph
}
#0
{"label": "A", "source": {"adjacency": []}, "relation": "B"}
{"()": {"adjacency": [["A", ["B"]]]}}
#1
{
"relation": "C",
"source": {"adjacency": [["A", ["B"]]]},
"label": "A"
}
{"()": {"adjacency": [["A", ["B", "C"]]]}}
#2
{
"label": "C",
"source": {"adjacency": [["A", ["B"]]]},
"relation": "D"
}
{"()": {"adjacency": [["A", ["B"]], ["C", ["D"]]]}}
allocate
fn allocate(mut index: Data<String>, attribute: Attribute<String>) -> (usize, Wave<usize>) {
utility::unwrap(index.allocate(attribute))
}
#0
{
"index": {
"arena": {"indices": [], "values": {}, "counter": 0},
"relations": {"adjacency": []}
},
"attribute": {"category": {"Attribute": "test"}, "context": []}
}
{"()": [0, []]}
#1
{
"index": {
"arena": {"indices": [], "values": {}, "counter": 0},
"relations": {"adjacency": []}
},
"attribute": {
"category": "Context",
"context": [{"category": {"Attribute": "inner"}, "context": []}]
}
}
{"()": [0, [[[[1, 1]], 1]]]}
#2
{
"index": {
"arena": {"indices": [], "values": {}, "counter": 0},
"relations": {"adjacency": []}
},
"attribute": {
"category": "Group",
"context": [{"category": {"Attribute": "member"}, "context": []}]
}
}
{"()": [0, [[[[1, 1]], 1]]]}
#3
{
"index": {
"arena": {"indices": [], "values": {}, "counter": 0},
"relations": {"adjacency": []}
},
"attribute": {"category": "Partition", "context": []}
}
{"()": [0, []]}
#4
{
"index": {
"arena": {"indices": [], "values": {}, "counter": 0},
"relations": {"adjacency": []}
},
"attribute": {"category": "Void", "context": []}
}
{"()": [0, []]}
#5
{
"index": {
"arena": {"indices": [], "values": {}, "counter": 0},
"relations": {"adjacency": []}
},
"attribute": {
"category": "Context",
"context": [
{
"category": "Context",
"context": [{"category": {"Attribute": "deep"}, "context": []}]
}
]
}
}
{"()": [0, [[[[1, 1]], 1]]]}
#6
{
"index": {
"arena": {"indices": [], "values": {}, "counter": 0},
"relations": {"adjacency": []}
},
"attribute": {
"category": "Context",
"context": [
{"category": {"Attribute": "first"}, "context": []},
{"category": {"Attribute": "second"}, "context": []}
]
}
}
{"()": [0, [[[[1, 1], [2, 1]], 1]]]}
#7
{
"attribute": {"category": {"Attribute": "new"}, "context": []},
"index": {
"arena": {
"indices": [[{"category": {"Attribute": "existing"}, "context": []}, 0]],
"values": {"0": {"category": {"Attribute": "existing"}, "context": []}},
"counter": 1
},
"relations": {"adjacency": []}
}
}
{"()": [1, []]}
#8
{
"attribute": {
"category": "Context",
"context": [{"category": {"Attribute": "child"}, "context": []}]
},
"index": {
"arena": {
"indices": [[{"category": {"Attribute": "existing"}, "context": []}, 0]],
"values": {"0": {"category": {"Attribute": "existing"}, "context": []}},
"counter": 1
},
"relations": {"adjacency": []}
}
}
{"()": [1, [[[[2, 1]], 1]]]}
breadth
fn breadth(resource: PathBuf) -> Vec<Attribute<String>> {
let component: Attribute<String> = utility::unwrap(utility::unwrap(Source::path(resource)).attribute());
component
.breadth()
.cloned()
.collect()
}
#0
{
"resource": "Molten/test/resource/system/graph/symbolic/group/group.lava"
}
{
"()": [
{
"category": {"Attribute": ""},
"context": [
{
"category": "Group",
"context": [
{"category": "Void", "context": []},
{"category": {"Attribute": "Molten"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Meta"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Program"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Alpha"}, "context": []},
{"category": {"Attribute": "Alpha"}, "context": []}
]
}
]
},
{
"category": "Group",
"context": [
{"category": "Void", "context": []},
{"category": {"Attribute": "Molten"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Meta"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Program"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Alpha"}, "context": []},
{"category": {"Attribute": "Alpha"}, "context": []}
]
},
{"category": "Void", "context": []},
{"category": {"Attribute": "Molten"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Meta"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Program"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Alpha"}, "context": []},
{"category": {"Attribute": "Alpha"}, "context": []}
]
}
disjoint
fn disjoint(candidate: Particle<String>, basis: Particle<String>) -> Option<Particle<String>> {
candidate.disjoint(&basis).map(|_| candidate.clone())
}
#0
{"candidate": [["a", 1], ["b", 2]], "basis": [["c", 1], ["d", 2]]}
{"()": [["a", 1], ["b", 2]]}
#1
{"candidate": [["a", 1], ["b", 2]], "basis": [["b", 3], ["c", 1]]}
{"()": null}
#2
{
"candidate": [["a", 1], ["b", 2], ["c", 3]],
"basis": [["a", 5], ["b", 1], ["d", 2]]
}
{"()": null}
#3
{"candidate": [["a", 1], ["b", 2]], "basis": [["a", 1], ["b", 2]]}
{"()": null}
#4
{"candidate": [], "basis": [["a", 1], ["b", 2]]}
{"()": []}
#5
{"candidate": [["a", 1], ["b", 2]], "basis": []}
{"()": [["a", 1], ["b", 2]]}
#6
{"candidate": [], "basis": []}
{"()": []}
isomorphic
fn isomorphic(candidate: Particle<String>, basis: Particle<String>) -> Option<Particle<String>> {
candidate.isomorphic(&basis).map(|_| candidate.clone())
}
#0
{"candidate": [["a", 1], ["b", 2]], "basis": [["a", 1], ["b", 2]]}
{"()": [["a", 1], ["b", 2]]}
#1
{"candidate": [["a", 1], ["b", 2]], "basis": [["a", 2], ["b", 1]]}
{"()": null}
#2
{"candidate": [["a", 1], ["b", 2]], "basis": [["a", 1], ["c", 2]]}
{"()": null}
#3
{
"candidate": [["a", 1], ["b", 2]],
"basis": [["a", 1], ["b", 2], ["c", 1]]
}
{"()": null}
#4
{
"candidate": [["a", 1], ["b", 2], ["c", 1]],
"basis": [["a", 1], ["b", 2]]
}
{"()": null}
#5
{"candidate": [], "basis": []}
{"()": []}
#6
{"candidate": [], "basis": [["a", 1]]}
{"()": null}
#7
{"candidate": [["a", 1]], "basis": []}
{"()": null}
#8
{
"candidate": [["apple", 3], ["banana", 1], ["cherry", 2], ["date", 5]],
"basis": [["apple", 3], ["banana", 1], ["cherry", 2], ["date", 5]]
}
{"()": [["apple", 3], ["banana", 1], ["cherry", 2], ["date", 5]]}
joint
fn joint(candidate: Particle<String>, basis: Particle<String>) -> Option<Particle<String>> {
candidate.joint(&basis).map(|_| candidate.clone())
}
#0
{"basis": [["b", 3], ["c", 1]], "candidate": [["a", 1], ["b", 2]]}
{"()": [["a", 1], ["b", 2]]}
#1
{
"basis": [["a", 5], ["b", 1], ["d", 2]],
"candidate": [["a", 1], ["b", 2], ["c", 3]]
}
{"()": [["a", 1], ["b", 2], ["c", 3]]}
#2
{"basis": [["a", 3], ["b", 4]], "candidate": [["a", 1], ["b", 2]]}
{"()": [["a", 1], ["b", 2]]}
#3
{"basis": [["c", 1], ["d", 2]], "candidate": [["a", 1], ["b", 2]]}
{"()": null}
#4
{"basis": [["a", 1], ["b", 2]], "candidate": []}
{"()": null}
#5
{"basis": [], "candidate": [["a", 1], ["b", 2]]}
{"()": null}
#6
{"basis": [], "candidate": []}
{"()": null}
subset
fn subset(candidate: Particle<String>, basis: Particle<String>) -> Option<Particle<String>> {
candidate.subset(&basis).map(|_| candidate.clone())
}
#0
{
"basis": [["a", 1], ["b", 1], ["c", 1]],
"candidate": [["a", 1], ["b", 1]]
}
{"()": [["a", 1], ["b", 1]]}
#1
{
"basis": [["a", 1], ["b", 1]],
"candidate": [["a", 1], ["b", 1], ["c", 1]]
}
{"()": null}
#2
{"basis": [["a", 1], ["b", 1]], "candidate": []}
{"()": []}
#3
{"basis": [], "candidate": [["a", 1], ["b", 1]]}
{"()": null}
#4
{"basis": [["a", 1], ["b", 1]], "candidate": [["a", 1], ["b", 1]]}
{"()": [["a", 1], ["b", 1]]}
#5
{"basis": [["a", 1], ["b", 1]], "candidate": [["x", 1], ["y", 1]]}
{"()": null}
superset
fn superset(candidate: Particle<String>, basis: Particle<String>) -> Option<Particle<String>> {
candidate.superset(&basis).map(|_| candidate.clone())
}
#0
{
"basis": [["a", 1], ["b", 2]],
"candidate": [["a", 2], ["b", 3], ["c", 1]]
}
{"()": [["a", 2], ["b", 3], ["c", 1]]}
#1
{"basis": [["a", 1], ["b", 2]], "candidate": [["a", 1], ["b", 2]]}
{"()": [["a", 1], ["b", 2]]}
#2
{
"basis": [["a", 1], ["b", 2], ["c", 1]],
"candidate": [["a", 1], ["b", 2]]
}
{"()": null}
#3
{"basis": [["a", 2], ["b", 1]], "candidate": [["a", 1], ["b", 2]]}
{"()": null}
#4
{"basis": [], "candidate": [["a", 1], ["b", 2]]}
{"()": [["a", 1], ["b", 2]]}
#5
{"basis": [["a", 1]], "candidate": []}
{"()": null}
#6
{"basis": [], "candidate": []}
{"()": []}
disjoint
fn disjoint(candidate: &Wave<String>, basis: &Wave<String>) -> Option<Wave<String>> {
candidate.disjoint(basis).map(|_| candidate.clone())
}
#0
{"candidate": [[[["a", 1], ["b", 1]], 1]], "basis": [[[["a", 1]], 1]]}
{"()": null}
#1
{"basis": [[[["b", 2]], 1]], "candidate": [[[["a", 1]], 2]]}
{"()": [[[["a", 1]], 2]]}
#2
{
"candidate": [[[["a", 1]], 2], [[["b", 2]], 1]],
"basis": [[[["c", 3]], 1], [[["d", 4]], 2]]
}
{"()": [[[["a", 1]], 2], [[["b", 2]], 1]]}
#3
{
"candidate": [[[["a", 1]], 2], [[["b", 2]], 1]],
"basis": [[[["a", 1]], 1], [[["c", 3]], 2]]
}
{"()": null}
#4
{"basis": [[[["a", 1]], 3]], "candidate": [[[["a", 1]], 2]]}
{"()": null}
#5
{"candidate": [], "basis": []}
{"()": []}
#6
{"candidate": [], "basis": [[[["a", 1]], 1]]}
{"()": []}
#7
{"basis": [], "candidate": [[[["a", 1]], 1]]}
{"()": [[[["a", 1]], 1]]}
diverge
fn diverge(candidate: &Wave<String>, basis: &Wave<String>) -> Option<Wave<String>> {
candidate.diverge(basis)
}
#0
{
"basis": [[[["a", 1]], 1]],
"candidate": [[[["a", 1]], 2], [[["b", 1]], 1]]
}
{"()": [[[["a", 1]], 1], [[["b", 1]], 1]]}
#1
{"basis": [[[["a", 1]], 1]], "candidate": [[[["a", 1]], 1]]}
{"()": null}
diverges
fn diverges(candidate: &Wave<String>, basis: &Wave<String>) -> Vec<Wave<String>> {
candidate
.diverges(basis)
.into_iter()
.collect()
}
#0
{
"basis": [[[["a", 1]], 1]],
"candidate": [[[["a", 1]], 1], [[["a", 1], ["b", 1]], 1]]
}
{"()": [[[[["a", 1]], 1]], [[[["a", 1], ["b", 1]], 1]]]}
#1
{"candidate": [], "basis": [[[["a", 1]], 1]]}
{"()": []}
#2
{
"candidate": [[[["a", 1]], 1], [[["b", 1]], 1]],
"basis": [[[["a", 1]], 1]]
}
{"()": [[[[["b", 1]], 1]]]}
#3
{
"candidate": [[[["a", 1]], 1], [[["b", 1]], 1]],
"basis": [[[["a", 1]], 1], [[["b", 1]], 1]]
}
{"()": [[]]}
intersect
fn intersect(candidate: &Wave<String>, basis: &Wave<String>) -> Option<Wave<String>> {
candidate.intersect(basis)
}
#0
{
"basis": [[[["a", 1]], 3], [[["c", 1]], 1]],
"candidate": [[[["a", 1]], 2], [[["b", 1]], 1]]
}
{"()": [[[["a", 1]], 2]]}
#1
{"basis": [[[["y", 1]], 1]], "candidate": [[[["x", 1]], 1]]}
{"()": null}
isomorphic
fn isomorphic(candidate: &Wave<String>, basis: &Wave<String>) -> Option<Wave<String>> {
candidate.isomorphic(basis).map(|_| candidate.clone())
}
#0
{"candidate": [[[["a", 1]], 2]], "basis": [[[["a", 1]], 2]]}
{"()": [[[["a", 1]], 2]]}
#1
{"candidate": [[[["a", 1]], 2]], "basis": [[[["a", 1]], 3]]}
{"()": null}
#2
{"candidate": [[[["a", 1]], 2]], "basis": [[[["b", 1]], 2]]}
{"()": null}
#3
{
"candidate": [[[["a", 1]], 2], [[["b", 2]], 1]],
"basis": [[[["b", 2]], 1], [[["a", 1]], 2]]
}
{"()": [[[["a", 1]], 2], [[["b", 2]], 1]]}
#4
{
"candidate": [[[["a", 1]], 2]],
"basis": [[[["a", 1]], 2], [[["b", 2]], 1]]
}
{"()": null}
#5
{"candidate": [], "basis": []}
{"()": []}
#6
{
"candidate": [[[["a", 1]], 3], [[["b", 2]], 2], [[["c", 3]], 1]],
"basis": [[[["c", 3]], 1], [[["a", 1]], 3], [[["b", 2]], 2]]
}
{"()": [[[["a", 1]], 3], [[["b", 2]], 2], [[["c", 3]], 1]]}
join
fn join(candidate: &Wave<String>, basis: &Wave<String>) -> Option<Wave<String>> {
candidate.join(basis)
}
#0
{"candidate": [], "basis": [[[["a", 1]], 2]]}
{"()": [[[["a", 1]], 2]]}
#1
{
"candidate": [[[["a", 1]], 2]],
"basis": [[[["a", 1]], 1], [[["b", 1]], 3]]
}
{"()": [[[["a", 1]], 3], [[["b", 1]], 3]]}
#2
{
"candidate": [[[["a", 1]], 1], [[["b", 1]], 2]],
"basis": [[[["c", 1]], 1]]
}
{"()": [[[["a", 1]], 1], [[["b", 1]], 2], [[["c", 1]], 1]]}
#3
{
"candidate": [[[["a", 1]], 1], [[["b", 1]], 2], [[["c", 1]], 3]],
"basis": [[[["d", 1]], 1]]
}
{
"()": [[[["a", 1]], 1], [[["b", 1]], 2], [[["c", 1]], 3], [[["d", 1]], 1]]
}
#4
{
"candidate": [[[["a", 1]], 1], [[["b", 1]], 2], [[["c", 1]], 3], [[["d", 1]], 4]],
"basis": [[[["e", 1]], 1]]
}
{
"()": [
[[["a", 1]], 1],
[[["b", 1]], 2],
[[["c", 1]], 3],
[[["d", 1]], 4],
[[["e", 1]], 1]
]
}
#5
{
"candidate": [
[[["a", 1]], 1],
[[["b", 1]], 2],
[[["c", 1]], 3],
[[["d", 1]], 4],
[[["e", 1]], 5]
],
"basis": [[[["f", 1]], 1]]
}
{
"()": [
[[["a", 1]], 1],
[[["b", 1]], 2],
[[["c", 1]], 3],
[[["d", 1]], 4],
[[["e", 1]], 5],
[[["f", 1]], 1]
]
}
#6
{
"candidate": [
[[["a", 1]], 1],
[[["b", 1]], 2],
[[["c", 1]], 3],
[[["d", 1]], 4],
[[["e", 1]], 5],
[[["f", 1]], 6],
[[["g", 1]], 7]
],
"basis": [[[["h", 1]], 1]]
}
{
"()": [
[[["a", 1]], 1],
[[["b", 1]], 2],
[[["c", 1]], 3],
[[["d", 1]], 4],
[[["e", 1]], 5],
[[["f", 1]], 6],
[[["g", 1]], 7],
[[["h", 1]], 1]
]
}
#7
{
"candidate": [
[[["a", 1]], 1],
[[["b", 1]], 2],
[[["c", 1]], 3],
[[["d", 1]], 4],
[[["e", 1]], 5],
[[["f", 1]], 6],
[[["g", 1]], 7],
[[["h", 1]], 8],
[[["i", 1]], 9],
[[["j", 1]], 10]
],
"basis": [[[["k", 1]], 1]]
}
{
"()": [
[[["a", 1]], 1],
[[["b", 1]], 2],
[[["c", 1]], 3],
[[["d", 1]], 4],
[[["e", 1]], 5],
[[["f", 1]], 6],
[[["g", 1]], 7],
[[["h", 1]], 8],
[[["i", 1]], 9],
[[["j", 1]], 10],
[[["k", 1]], 1]
]
}
joint
fn joint(candidate: &Wave<String>, basis: &Wave<String>) -> Option<Wave<String>> {
candidate.joint(basis).map(|_| candidate.clone())
}
#0
{"basis": [[[["a", 1], ["b", 1]], 1]], "candidate": [[[["a", 1]], 1]]}
{"()": [[[["a", 1]], 1]]}
#1
{"basis": [[[["a", 1]], 3]], "candidate": [[[["a", 1]], 2]]}
{"()": [[[["a", 1]], 2]]}
#2
{
"basis": [[[["a", 1]], 1], [[["c", 3]], 2]],
"candidate": [[[["a", 1]], 2], [[["b", 2]], 1]]
}
{"()": [[[["a", 1]], 2], [[["b", 2]], 1]]}
#3
{"basis": [[[["b", 2]], 1]], "candidate": [[[["a", 1]], 2]]}
{"()": null}
#4
{"basis": [], "candidate": []}
{"()": null}
#5
{"basis": [[[["a", 1]], 1]], "candidate": []}
{"()": null}
#6
{"basis": [], "candidate": [[[["a", 1]], 1]]}
{"()": null}
subset
fn subset(candidate: &Wave<String>, basis: &Wave<String>) -> Option<Wave<String>> {
candidate.subset(basis).map(|_| candidate.clone())
}
#0
{"basis": [[[["a", 1]], 3]], "candidate": [[[["a", 1]], 2]]}
{"()": [[[["a", 1]], 2]]}
#1
{"basis": [[[["a", 1]], 2]], "candidate": [[[["a", 1]], 3]]}
{"()": null}
#2
{
"basis": [[[["a", 1], ["b", 1]], 1], [[["b", 1], ["c", 1]], 1]],
"candidate": [[[["a", 1]], 1], [[["b", 1]], 1]]
}
{"()": [[[["a", 1]], 1], [[["b", 1]], 1]]}
#3
{
"basis": [[[["a", 1]], 2]],
"candidate": [[[["a", 1]], 1], [[["a", 1]], 1]]
}
{"()": [[[["a", 1]], 1], [[["a", 1]], 1]]}
#4
{
"basis": [[[["a", 1], ["b", 1]], 1]],
"candidate": [[[["a", 1]], 1], [[["b", 1]], 1]]
}
{"()": null}
#5
{
"basis": [[[["a", 1]], 1], [[["b", 1]], 1]],
"candidate": [[[["a", 1]], 1], [[["b", 1]], 1]]
}
{"()": [[[["a", 1]], 1], [[["b", 1]], 1]]}
#6
{
"basis": [[[["a", 1]], 1], [[["b", 1]], 1]],
"candidate": [[[["a", 1], ["b", 1]], 1]]
}
{"()": null}
#7
{
"basis": [[[["a", 1]], 1], [[["b", 1]], 1], [[["c", 1]], 1]],
"candidate": [[[["a", 1], ["b", 1]], 2], [[["b", 1], ["c", 1]], 1]]
}
{"()": null}
#8
{
"basis": [
[[["x", 1], ["y", 1]], 2],
[[["y", 1], ["z", 1]], 1],
[[["x", 1], ["z", 1]], 1]
],
"candidate": [[[["x", 1]], 2], [[["y", 1]], 1], [[["z", 1]], 1]]
}
{"()": [[[["x", 1]], 2], [[["y", 1]], 1], [[["z", 1]], 1]]}
#9
{"basis": [[[["a", 1]], 1]], "candidate": []}
{"()": []}
#10
{"basis": [], "candidate": [[[["a", 1]], 1]]}
{"()": null}
#11
{"basis": [], "candidate": []}
{"()": []}
#12
{
"basis": [[[["a", 1]], 2], [[["b", 1]], 1], [[["a", 1], ["b", 1]], 1]],
"candidate": [[[["a", 1]], 2], [[["b", 1]], 1]]
}
{"()": [[[["a", 1]], 2], [[["b", 1]], 1]]}
#13
{
"basis": [[[["a", 1], ["b", 1]], 1], [[["a", 1]], 1]],
"candidate": [[[["a", 1]], 2]]
}
{"()": null}
#14
{
"basis": [[[["a", 1]], 1], [[["a", 1]], 1]],
"candidate": [[[["a", 1]], 2]]
}
{"()": null}
#15
{
"basis": [[[["a", 1]], 1], [[["b", 1]], 1], [[["d", 1]], 1]],
"candidate": [[[["a", 1], ["b", 1], ["c", 1]], 1]]
}
{"()": null}
#16
{
"basis": [[[["a", 1], ["x", 1]], 1], [[["b", 1], ["y", 1]], 1]],
"candidate": [[[["a", 1]], 1], [[["b", 1]], 1]]
}
{"()": [[[["a", 1]], 1], [[["b", 1]], 1]]}
#17
{
"basis": [[[["x", 1], ["y", 1]], 1], [[["x", 1], ["z", 1]], 1]],
"candidate": [[[["x", 1]], 1], [[["x", 1]], 1]]
}
{"()": [[[["x", 1]], 1], [[["x", 1]], 1]]}
#18
{
"basis": [[[["a", 1], ["x", 1]], 2], [[["a", 1], ["y", 1]], 2]],
"candidate": [[[["a", 1]], 2]]
}
{"()": [[[["a", 1]], 2]]}
#19
{
"basis": [[[["p", 1]], 2]],
"candidate": [[[["p", 1]], 1], [[["p", 1]], 1]]
}
{"()": [[[["p", 1]], 1], [[["p", 1]], 1]]}
#20
{
"basis": [[[["m", 1], ["x", 1]], 1], [[["n", 1], ["y", 1]], 1]],
"candidate": [[[["m", 1]], 1], [[["n", 1]], 1]]
}
{"()": [[[["m", 1]], 1], [[["n", 1]], 1]]}
#21
{
"basis": [[[["a", 1], ["b", 1]], 1], [[["a", 1]], 1]],
"candidate": [[[["a", 1]], 1], [[["a", 1], ["b", 1]], 1]]
}
{"()": [[[["a", 1]], 1], [[["a", 1], ["b", 1]], 1]]}
#22
{
"basis": [[[["x", 1]], 3]],
"candidate": [[[["x", 1]], 1], [[["x", 1]], 1], [[["x", 1]], 1]]
}
{"()": [[[["x", 1]], 1], [[["x", 1]], 1], [[["x", 1]], 1]]}
#23
{"basis": [[[["y", 1]], 3]], "candidate": [[[["y", 1]], 5]]}
{"()": null}
#24
{"basis": [[[], 1], [[["a", 1]], 1]], "candidate": [[[], 1]]}
{"()": [[[], 1]]}
#25
{
"basis": [
[[["a", 1], ["x", 1]], 1],
[[["b", 1], ["c", 1], ["d", 1], ["e", 1], ["f", 1]], 1]
],
"candidate": [[[["a", 1]], 1], [[["b", 1], ["c", 1], ["d", 1], ["e", 1], ["f", 1]], 1]]
}
{
"()": [[[["a", 1]], 1], [[["b", 1], ["c", 1], ["d", 1], ["e", 1], ["f", 1]], 1]]
}
#26
{
"basis": [[[["a", 1], ["b", 1], ["c", 1]], 1], [[["a", 1]], 1], [[["b", 1]], 1]],
"candidate": [[[["a", 1]], 1], [[["b", 1]], 1], [[["c", 1]], 1]]
}
{"()": [[[["a", 1]], 1], [[["b", 1]], 1], [[["c", 1]], 1]]}
#27
{"basis": [[[["z", 1]], 999]], "candidate": [[[["z", 1]], 999]]}
{"()": [[[["z", 1]], 999]]}
superset
fn superset(candidate: &Wave<String>, basis: &Wave<String>) -> Option<Wave<String>> {
candidate.superset(basis).map(|_| candidate.clone())
}
#0
{"basis": [[[["a", 1]], 1]], "candidate": [[[["a", 1], ["b", 1]], 1]]}
{"()": [[[["a", 1], ["b", 1]], 1]]}
#1
{"basis": [[[["a", 1]], 2]], "candidate": [[[["a", 1]], 3]]}
{"()": [[[["a", 1]], 3]]}
#2
{"basis": [[[["a", 1]], 3]], "candidate": [[[["a", 1]], 2]]}
{"()": null}
#3
{"basis": [[[["a", 1]], 2]], "candidate": [[[["a", 1]], 2]]}
{"()": [[[["a", 1]], 2]]}
#4
{"basis": [[[["a", 1]], 1]], "candidate": []}
{"()": null}
#5
{"basis": [], "candidate": [[[["a", 1]], 1]]}
{"()": [[[["a", 1]], 1]]}
#6
{"basis": [], "candidate": []}
{"()": []}
consume.filter
pub fn filter(input: String, target: char) -> String {
let mut cursor = Cursor::new(input.as_bytes());
let consumed = utility::unwrap(Translation::rules().filter(rule::is(target as u8)).consume(cursor.by_ref()));
consumed.characterize().parsed()
}
#0
{
"input": "
This is a consumable string",
"target": "i"
}
{"()": "iii"}
consume.quantity
pub fn quantity(input: String, limit: usize) -> String {
let mut cursor = Cursor::new(input.as_bytes());
let consumed = utility::unwrap(Translation::rules().limiter(limit).consume(cursor.by_ref()));
consumed.characterize().parsed()
}
#0
{"limit": 4, "input": "This is a viewable string"}
{"()": "This"}
#1
{"limit": 4, "input": "This is a viewable string"}
{"()": "This"}
consume.space
pub fn space(input: String) -> String {
let mut cursor = Cursor::new(input.as_bytes());
let consumed = utility::unwrap(Translation::rules().terminator(rule::glyph()).consume(cursor.by_ref()));
consumed.characterize().parsed()
}
#0
{"input": "
This is a consumable string"}
{"()": "
"}
consume.termination
pub fn termination(input: String, terminator: char) -> String {
let mut cursor = Cursor::new(input.as_bytes());
let consumed = utility::unwrap(Translation::rules().terminator(rule::is(terminator as u8)).consume(cursor.by_ref()));
consumed.characterize().parsed()
}
#0
{"input": "This is a consumable string", "terminator": "i"}
{"()": "Th"}
#1
{
"input": "
This is a consumable string",
"terminator": "T"
}
{"()": "
"}
view.filter
pub fn filter(input: String, target: char) -> String {
let mut cursor = Cursor::new(input.as_bytes());
let viewed = utility::unwrap(Translation::rules().filter(rule::is(target as u8)).view(cursor.by_ref()));
viewed.characterize().parsed()
}
#0
{
"input": "
This is a consumable string",
"target": "i"
}
{"()": "iii"}
view.quantity
pub fn quantity(input: String, limit: usize) -> String {
let mut cursor = Cursor::new(input.as_bytes());
let viewed = utility::unwrap(Translation::rules().limiter(limit).view(cursor.by_ref()));
viewed.characterize().parsed()
}
#0
{"limit": 4, "input": "This is a viewable string"}
{"()": "This"}
#1
{"limit": 4, "input": "This is a viewable string"}
{"()": "This"}
view.space
pub fn space(input: String) -> String {
let mut cursor = Cursor::new(input.as_bytes());
let viewed = utility::unwrap(Translation::rules().terminator(rule::glyph()).view(cursor.by_ref()));
viewed.characterize().parsed()
}
#0
{"input": "
This is a consumable string"}
{"()": "
"}
view.termination
pub fn termination(input: String, terminator: char) -> String {
let mut cursor = Cursor::new(input.as_bytes());
let viewed = utility::unwrap(Translation::rules().terminator(rule::is(terminator as u8)).view(cursor.by_ref()));
viewed.characterize().parsed()
}
#0
{"input": "This is a viewable string", "terminator": "i"}
{"()": "Th"}
attribute
fn attribute(resource: PathBuf, width: usize) -> String {
let label = utility::unwrap(utility::unwrap(Source::path(resource)).module());
let component: Attribute<String> = label;
let arena: Arena<Attribute<String>> = utility::unwrap(component.arena());
symbolic::renderer::attribute(width, &arena, &component)
}
#0
{
"resource": "Molten/test/resource/system/graph/module/breadth/symbolic/breadth.lava",
"width": 1000
}
{"()": "(Alpha.Beta(Delta).Gamma)"}
#1
{
"resource": "Molten/test/resource/system/graph/module/breadth/symbolic/breadth.lava",
"width": 15
}
{"()": "(Alpha.Beta(Delta).3)"}
#2
{
"resource": "Molten/test/resource/system/graph/module/echo/symbolic/echo.lava",
"width": 1000
}
{
"()": "([Echo(Data.Format.Unicode, Binary.Width(8), value)] (Stream.Sink.Console(value)))"
}
#3
{
"resource": "Molten/test/resource/system/graph/module/echo/symbolic/echo.lava",
"width": 30
}
{
"()": "([Echo(Data.Format.Unicode, Binary.15(18), 16)] (5.6.7(16)))"
}
#4
{
"resource": "Molten/test/resource/system/graph/module/nested/symbolic/nested.lava",
"width": 1000
}
{
"()": "(Alpha([Beta.Gamma([Epsilon(Delta, Phi, Upsilon)])](Pi, Eta.Zeta)))"
}
#5
{
"resource": "Molten/test/resource/system/graph/module/nested/symbolic/nested.lava",
"width": 10
}
{"()": "(Alpha([Beta.5([12(14, 15, 16)])](6, 9.10)))"}
arena
fn arena(resource: PathBuf) -> Arena<Attribute<String>> {
let module = utility::unwrap(utility::unwrap(Source::path(resource)).module());
utility::unwrap(module.arena())
}
#0
{
"resource": "Molten/test/resource/system/graph/module/echo/symbolic/echo.lava"
}
{
"()": {
"indices": [
[{"category": {"Attribute": "Binary"}}, 14],
[
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
},
9
],
[{"category": {"Attribute": "Unicode"}}, 12],
[{"category": "Void"}, 2],
[
{
"category": "Group",
"context": [
{
"category": "Context",
"context": [
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": {"Attribute": "Stream"}},
{"category": {"Attribute": "Sink"}},
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
}
]
}
]
},
0
],
[
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
},
8
],
[{"category": {"Attribute": "Data"}}, 10],
[{"category": {"Attribute": "8"}}, 18],
[
{
"category": "Context",
"context": [
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
}
]
},
1
],
[
{
"category": "Group",
"context": [
{"category": {"Attribute": "Stream"}},
{"category": {"Attribute": "Sink"}},
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
}
]
},
3
],
[{"category": {"Attribute": "Sink"}}, 6],
[
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
15
],
[
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
},
7
],
[{"category": "Partition"}, 13],
[{"category": {"Attribute": "Stream"}}, 5],
[{"category": {"Attribute": "value"}}, 16],
[
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
},
4
],
[{"category": {"Attribute": "Format"}}, 11],
[
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
},
17
]
],
"values": {
"15": {
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
"18": {"category": {"Attribute": "8"}},
"10": {"category": {"Attribute": "Data"}},
"17": {
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
},
"5": {"category": {"Attribute": "Stream"}},
"9": {
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
},
"12": {"category": {"Attribute": "Unicode"}},
"14": {"category": {"Attribute": "Binary"}},
"1": {
"category": "Context",
"context": [
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
}
]
},
"4": {
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
},
"8": {
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
},
"16": {"category": {"Attribute": "value"}},
"7": {
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
},
"0": {
"category": "Group",
"context": [
{
"category": "Context",
"context": [
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": {"Attribute": "Stream"}},
{"category": {"Attribute": "Sink"}},
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
}
]
}
]
},
"2": {"category": "Void"},
"3": {
"category": "Group",
"context": [
{"category": {"Attribute": "Stream"}},
{"category": {"Attribute": "Sink"}},
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
}
]
},
"11": {"category": {"Attribute": "Format"}},
"6": {"category": {"Attribute": "Sink"}},
"13": {"category": "Partition"}
},
"counter": 19
}
}
#1
{
"resource": "Molten/test/resource/system/graph/module/breadth/symbolic/breadth.lava"
}
{
"()": {
"indices": [
[{"category": {"Attribute": "Delta"}}, 5],
[{"category": {"Attribute": "Alpha"}}, 1],
[
{
"category": "Group",
"context": [
{"category": {"Attribute": "Alpha"}},
{
"category": {"Attribute": "Beta"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "Delta"}}]
}
]
},
{"category": {"Attribute": "Gamma"}}
]
},
0
],
[
{
"category": "Group",
"context": [{"category": {"Attribute": "Delta"}}]
},
4
],
[
{
"category": {"Attribute": "Beta"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "Delta"}}]
}
]
},
2
],
[{"category": {"Attribute": "Gamma"}}, 3]
],
"values": {
"3": {"category": {"Attribute": "Gamma"}},
"0": {
"category": "Group",
"context": [
{"category": {"Attribute": "Alpha"}},
{
"category": {"Attribute": "Beta"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "Delta"}}]
}
]
},
{"category": {"Attribute": "Gamma"}}
]
},
"4": {
"category": "Group",
"context": [{"category": {"Attribute": "Delta"}}]
},
"1": {"category": {"Attribute": "Alpha"}},
"2": {
"category": {"Attribute": "Beta"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "Delta"}}]
}
]
},
"5": {"category": {"Attribute": "Delta"}}
},
"counter": 6
}
}
#2
{
"resource": "Molten/test/resource/system/graph/module/math/numeric/logic/boolean/symbolic/boolean.magma"
}
{
"()": {
"indices": [
[{"category": {"Attribute": "Not"}}, 14],
[{"category": {"Attribute": "Boolean"}}, 3],
[
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
1
],
[{"category": "Void"}, 2],
[
{
"category": "Context",
"context": [
{"category": {"Attribute": "False"}},
{"category": {"Attribute": "False"}}
]
},
18
],
[{"category": {"Attribute": "True"}}, 13],
[{"category": {"Attribute": "And"}}, 15],
[{"category": {"Attribute": "Or"}}, 17],
[
{
"category": "Context",
"context": [
{"category": {"Attribute": "Not"}},
{"category": {"Attribute": "Boolean"}}
]
},
6
],
[
{
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"}
]
},
7
],
[{"category": {"Attribute": "False"}}, 12],
[
{
"category": "Group",
"context": [
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "Boolean"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "Boolean"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "Not"}},
{"category": {"Attribute": "Boolean"}}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"}
]
},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "And"}},
{"category": {"Attribute": "Boolean"}},
{"category": {"Attribute": "Boolean"}}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "True"}},
{"category": {"Attribute": "True"}}
]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"}
]
},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "Or"}},
{"category": {"Attribute": "Boolean"}},
{"category": {"Attribute": "Boolean"}}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "False"}},
{"category": {"Attribute": "False"}}
]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"}
]
},
{"category": "Partition"}
]
},
0
],
[{"category": "Partition"}, 4],
[
{
"category": "Context",
"context": [
{"category": {"Attribute": "True"}},
{"category": {"Attribute": "True"}}
]
},
16
],
[
{
"category": "Context",
"context": [
{"category": {"Attribute": "Or"}},
{"category": {"Attribute": "Boolean"}},
{"category": {"Attribute": "Boolean"}}
]
},
10
],
[
{
"category": "Context",
"context": [
{"category": {"Attribute": "And"}},
{"category": {"Attribute": "Boolean"}},
{"category": {"Attribute": "Boolean"}}
]
},
8
],
[
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
5
],
[
{
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "True"}},
{"category": {"Attribute": "True"}}
]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"}
]
},
9
],
[
{
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "False"}},
{"category": {"Attribute": "False"}}
]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"}
]
},
11
]
],
"values": {
"15": {"category": {"Attribute": "And"}},
"18": {
"category": "Context",
"context": [
{"category": {"Attribute": "False"}},
{"category": {"Attribute": "False"}}
]
},
"1": {
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
"12": {"category": {"Attribute": "False"}},
"8": {
"category": "Context",
"context": [
{"category": {"Attribute": "And"}},
{"category": {"Attribute": "Boolean"}},
{"category": {"Attribute": "Boolean"}}
]
},
"4": {"category": "Partition"},
"5": {
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
"2": {"category": "Void"},
"10": {
"category": "Context",
"context": [
{"category": {"Attribute": "Or"}},
{"category": {"Attribute": "Boolean"}},
{"category": {"Attribute": "Boolean"}}
]
},
"7": {
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"}
]
},
"3": {"category": {"Attribute": "Boolean"}},
"17": {"category": {"Attribute": "Or"}},
"11": {
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "False"}},
{"category": {"Attribute": "False"}}
]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"}
]
},
"0": {
"category": "Group",
"context": [
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "Boolean"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "Boolean"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "Not"}},
{"category": {"Attribute": "Boolean"}}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"}
]
},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "And"}},
{"category": {"Attribute": "Boolean"}},
{"category": {"Attribute": "Boolean"}}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "True"}},
{"category": {"Attribute": "True"}}
]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"}
]
},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "Or"}},
{"category": {"Attribute": "Boolean"}},
{"category": {"Attribute": "Boolean"}}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "True"}}]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "False"}},
{"category": {"Attribute": "False"}}
]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"}
]
},
{"category": "Partition"}
]
},
"16": {
"category": "Context",
"context": [
{"category": {"Attribute": "True"}},
{"category": {"Attribute": "True"}}
]
},
"9": {
"category": "Group",
"context": [
{"category": "Void"},
{
"category": "Context",
"context": [
{"category": {"Attribute": "True"}},
{"category": {"Attribute": "True"}}
]
},
{"category": "Void"},
{"category": {"Attribute": "True"}},
{"category": "Partition"},
{"category": "Void"},
{
"category": "Context",
"context": [{"category": {"Attribute": "False"}}]
},
{"category": "Void"},
{"category": {"Attribute": "False"}},
{"category": "Partition"},
{"category": "Void"}
]
},
"14": {"category": {"Attribute": "Not"}},
"13": {"category": {"Attribute": "True"}},
"6": {
"category": "Context",
"context": [
{"category": {"Attribute": "Not"}},
{"category": {"Attribute": "Boolean"}}
]
}
},
"counter": 19
}
}
partition
fn partition(resource: PathBuf) -> Attribute<String> {
utility::unwrap(utility::unwrap(Source::path(resource)).partition())
}
#0
{
"resource": "Molten/test/resource/system/graph/symbolic/partition/partition.lava"
}
{"()": {"category": "Partition"}}
group
fn group(resource: PathBuf) -> Attribute<String> {
utility::unwrap(utility::unwrap(Source::path(resource)).group())
}
#0
{
"resource": "Molten/test/resource/system/graph/symbolic/group/group.lava"
}
{
"()": {
"category": "Group",
"context": [
{"category": "Void"},
{"category": {"Attribute": "Molten"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Meta"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Program"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Alpha"}},
{"category": {"Attribute": "Alpha"}}
]
}
}
context
fn context(resource: PathBuf) -> Attribute<String> {
utility::unwrap(utility::unwrap(Source::path(resource)).context())
}
#0
{
"resource": "Molten/test/resource/system/graph/symbolic/context/context.lava"
}
{
"()": {
"category": "Context",
"context": [
{"category": {"Attribute": "Molten"}},
{"category": "Partition"},
{"category": {"Attribute": "Meta"}},
{"category": "Partition"},
{"category": {"Attribute": "Program"}},
{"category": "Partition"},
{"category": "Partition"}
]
}
}
module
fn module(resource: PathBuf) -> Attribute<String> {
utility::unwrap(utility::unwrap(Source::path(resource)).module())
}
#0
{
"resource": "Molten/test/resource/system/graph/module/breadth/symbolic/breadth.lava"
}
{
"()": {
"category": "Group",
"context": [
{"category": {"Attribute": "Alpha"}},
{
"category": {"Attribute": "Beta"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "Delta"}}]
}
]
},
{"category": {"Attribute": "Gamma"}}
]
}
}
#1
{
"resource": "Molten/test/resource/system/graph/module/echo/symbolic/echo.lava"
}
{
"()": {
"category": "Group",
"context": [
{
"category": "Context",
"context": [
{
"category": {"Attribute": "Echo"},
"context": [
{
"category": "Group",
"context": [
{"category": {"Attribute": "Data"}},
{"category": {"Attribute": "Format"}},
{"category": {"Attribute": "Unicode"}},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "Binary"}},
{
"category": {"Attribute": "Width"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "8"}}]
}
]
},
{"category": "Partition"},
{"category": "Void"},
{"category": {"Attribute": "value"}}
]
}
]
}
]
},
{"category": "Void"},
{
"category": "Group",
"context": [
{"category": {"Attribute": "Stream"}},
{"category": {"Attribute": "Sink"}},
{
"category": {"Attribute": "Console"},
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "value"}}]
}
]
}
]
}
]
}
}
attribute
fn attribute(resource: PathBuf) -> Attribute<String> {
utility::unwrap(utility::unwrap(Source::path(resource)).attribute())
}
#0
{
"resource": "Molten/test/resource/system/graph/symbolic/attribute/attribute.lava"
}
{"()": {"category": {"Attribute": "Meta"}, "context": []}}
#1
{
"resource": "Molten/test/resource/system/graph/symbolic/group/group.lava"
}
{
"()": {
"category": {"Attribute": ""},
"context": [
{
"category": "Group",
"context": [
{"category": "Void", "context": []},
{"category": {"Attribute": "Molten"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Meta"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Program"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Void", "context": []},
{"category": {"Attribute": "Alpha"}, "context": []},
{"category": {"Attribute": "Alpha"}, "context": []}
]
}
]
}
}
#2
{
"resource": "Molten/test/resource/system/graph/symbolic/context/context.lava"
}
{
"()": {
"category": {"Attribute": ""},
"context": [
{
"category": "Context",
"context": [
{"category": {"Attribute": "Molten"}, "context": []},
{"category": "Partition", "context": []},
{"category": {"Attribute": "Meta"}, "context": []},
{"category": "Partition", "context": []},
{"category": {"Attribute": "Program"}, "context": []},
{"category": "Partition", "context": []},
{"category": "Partition", "context": []}
]
}
]
}
}
error
fn error(resource: PathBuf) -> bool {
utility::unwrap(Source::path(resource)).attribute().is_err()
}
#0
{
"resource": "Molten/test/resource/system/graph/symbolic/attribute/invalid.lava"
}
{"()": true}
depth
fn depth(ast: Attribute<String>) -> Vec<usize> {
let mut result = Vec::new();
molten(&ast, &mut result, |state: &mut Vec<usize>, context: &Context<Attribute<String>>, phase: Phase| {
if matches!(phase , Phase :: Visit) {
state.push(context.depth);
}
});
result
}
#0
{"ast": {"category": {"Attribute": "A"}}}
{"()": [0]}
#1
{
"ast": {
"category": "Group",
"context": [
{"category": {"Attribute": "A"}},
{"category": {"Attribute": "B"}}
]
}
}
{"()": [0, 1, 1]}
#2
{
"ast": {
"category": "Group",
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "X"}}]
}
]
}
}
{"()": [0, 1, 2]}
phases
fn phases(ast: Attribute<String>) -> Vec<String> {
let mut result = Vec::new();
molten(&ast, &mut result, |state: &mut Vec<String>, context: &Context<Attribute<String>>, phase: Phase| {
let label = match &context.node.category {
Category::Attribute(value) => value.clone(),
Category::Context => "Context".to_string(),
Category::Group => "Group".to_string(),
Category::Partition => "Partition".to_string(),
Category::Void => "Void".to_string(),
};
let phase = match phase {
Phase::Enter => "Enter",
Phase::Visit => "Visit",
Phase::Exit => "Exit",
};
state.push(format!("{phase}:{label}"));
});
result
}
#0
{"ast": {"category": {"Attribute": "A"}}}
{"()": ["Enter:A", "Visit:A", "Exit:A"]}
#1
{
"ast": {
"category": "Group",
"context": [
{"category": {"Attribute": "A"}},
{"category": {"Attribute": "B"}}
]
}
}
{
"()": [
"Enter:Group",
"Visit:Group",
"Enter:A",
"Visit:A",
"Exit:A",
"Enter:B",
"Visit:B",
"Exit:B",
"Exit:Group"
]
}
#2
{
"ast": {
"category": "Group",
"context": [
{
"category": "Group",
"context": [{"category": {"Attribute": "X"}}]
}
]
}
}
{
"()": [
"Enter:Group",
"Visit:Group",
"Enter:Group",
"Visit:Group",
"Enter:X",
"Visit:X",
"Exit:X",
"Exit:Group",
"Exit:Group"
]
}
absorb
fn absorb(graph: &mut Hypergraph<usize>, source: BTreeSet<Label>, relation: Relation<Wave<usize>>) -> Vec<Label> {
utility::unwrap(graph.absorb(source, relation)).collect()
}
#0
{
"graph": {
"_meta": {},
"nodes": [[0, [[2, 1]]], [1, [[2, 1]]], [2, [[3, 1]]]],
"edges": [],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"0": [0], "1": [1], "2": [2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
},
"relation": {"source": [[[[2, 1]], 1]], "sink": [[[[3, 1]], 1]]},
"source": [0]
}
{
"()": [3],
"graph": {
"_meta": {},
"nodes": [[0, [[2, 1]]], [1, [[2, 1]]], [2, [[3, 1]]]],
"edges": [
{
"label": 3,
"inference": {"source": [0], "sink": [2]},
"relation": {"source": [[[[2, 1]], 1]], "sink": [[[[3, 1]], 1]]}
}
],
"particles": 4,
"refractions": {"0": 2, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"1": [1], "2": [0, 2]},
"future": {"0": [3], "1": [], "2": []},
"past": {"0": [], "1": [], "2": [3]}
}
}
#1
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
},
"relation": {"source": [[[[2, 1]], 1]], "sink": [[[[3, 1]], 1]]},
"source": [0]
}
{
"()": [],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
}
}
#2
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
},
"relation": {"source": [[[[2, 1]], 1]], "sink": [[[[3, 1]], 1]]},
"source": []
}
{
"()": [],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
}
}
#3
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
},
"relation": {"source": [], "sink": []},
"source": [0]
}
{
"()": [1],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [
{
"label": 1,
"inference": {"source": [0], "sink": [0]},
"relation": {"source": [], "sink": []}
}
],
"particles": 2,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": [1]},
"past": {"0": [1]}
}
}
#4
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[2, 1]]], [3, [[2, 1]]]],
"edges": [],
"particles": 4,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3},
"world": {"0": 0, "1": 1, "2": 2, "3": 3},
"worlds": 4,
"united": {"0": [0], "1": [1], "2": [2], "3": [3]},
"future": {"0": [], "1": [], "2": [], "3": []},
"past": {"0": [], "1": [], "2": [], "3": []}
},
"relation": {"source": [[[[1, 1]], 1]], "sink": [[[[2, 1]], 1]]},
"source": [0]
}
{
"()": [4, 5, 6],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[2, 1]]], [3, [[2, 1]]]],
"edges": [
{
"label": 4,
"inference": {"source": [0], "sink": [1]},
"relation": {"source": [[[[1, 1]], 1]], "sink": [[[[2, 1]], 1]]}
},
{
"label": 5,
"inference": {"source": [0], "sink": [2]},
"relation": {"source": [[[[1, 1]], 1]], "sink": [[[[2, 1]], 1]]}
},
{
"label": 6,
"inference": {"source": [0], "sink": [3]},
"relation": {"source": [[[[1, 1]], 1]], "sink": [[[[2, 1]], 1]]}
}
],
"particles": 7,
"refractions": {"0": 2, "1": 2, "2": 3, "3": 3},
"world": {"0": 0, "1": 1, "2": 2, "3": 3},
"worlds": 4,
"united": {"3": [0, 1, 2, 3]},
"future": {"0": [4, 5, 6], "1": [], "2": [], "3": []},
"past": {"0": [], "1": [4], "2": [5], "3": [6]}
}
}
#5
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
},
"relation": {"source": [], "sink": [[[[2, 1]], 1]]},
"source": [0]
}
{
"()": [2],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [
{
"label": 2,
"inference": {"source": [0], "sink": [0, 1]},
"relation": {"source": [], "sink": [[[[2, 1]], 1]]}
}
],
"particles": 3,
"refractions": {"0": 1, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"1": [0, 1]},
"future": {"0": [2], "1": []},
"past": {"0": [2], "1": [2]}
}
}
#6
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1], [2, 1]]], [1, [[3, 1], [4, 1]]]],
"edges": [],
"particles": 2,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [], "1": []},
"past": {"0": [], "1": []}
},
"relation": {"source": [[[[2, 1]], 1]], "sink": []},
"source": [0]
}
{
"()": [2],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1], [2, 1]]], [1, [[3, 1], [4, 1]]]],
"edges": [
{
"label": 2,
"inference": {"source": [0], "sink": []},
"relation": {"source": [[[[2, 1]], 1]], "sink": []}
}
],
"particles": 3,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [2], "1": []},
"past": {"0": [], "1": []}
}
}
bipartitions
fn bipartitions(source: &Wave<usize>, sink: &Wave<usize>) -> Vec<Wave<usize>> {
system::hypergraph::evaluate::bipartitions(source, sink).collect()
}
#0
{"sink": [[[[1, 1]], 1]], "source": [[[[1, 1]], 1]]}
{"()": [[]]}
#1
{"sink": [[[[2, 1]], 1]], "source": [[[[1, 1]], 1]]}
{"()": []}
#2
{
"sink": [[[[1, 1]], 1], [[[3, 1]], 1]],
"source": [[[[1, 1]], 1], [[[2, 1]], 1]]
}
{"()": []}
#3
{
"sink": [[[[2, 1]], 1], [[[4, 1]], 1]],
"source": [[[[1, 1], [2, 1]], 1], [[[3, 1], [4, 1]], 1]]
}
{"()": [[[[[1, 1]], 1], [[[3, 1]], 1]]]}
#4
{"sink": [], "source": [[[[1, 1]], 1], [[[2, 1]], 1]]}
{"()": [[[[[1, 1]], 1], [[[2, 1]], 1]]]}
#5
{
"sink": [[[[2, 1]], 1]],
"source": [[[[1, 1], [2, 1]], 1], [[[2, 1], [3, 1]], 1]]
}
{
"()": [
[[[[1, 1]], 1], [[[2, 1], [3, 1]], 1]],
[[[[1, 1], [2, 1]], 1], [[[3, 1]], 1]]
]
}
#6
{
"sink": [[[[1, 1]], 2]],
"source": [[[[1, 1], [2, 1]], 2], [[[1, 1], [3, 1]], 2]]
}
{
"()": [
[[[[1, 1], [2, 1]], 2], [[[3, 1]], 2]],
[[[[1, 1], [3, 1]], 2], [[[2, 1]], 2]]
]
}
#7
{
"sink": [[[[1, 1]], 2]],
"source": [[[[1, 1], [2, 1]], 1], [[[1, 1], [3, 1]], 1]]
}
{"()": [[[[[2, 1]], 1], [[[3, 1]], 1]]]}
#8
{
"sink": [[[[1, 1]], 1], [[[3, 1]], 1]],
"source": [[[[1, 1], [2, 1]], 1], [[[3, 1], [4, 1]], 1]]
}
{"()": [[[[[2, 1]], 1], [[[4, 1]], 1]]]}
#9
{
"sink": [[[[1, 1], [2, 1]], 1], [[[1, 1]], 1]],
"source": [[[[1, 1], [2, 1], [3, 1]], 1], [[[1, 1], [2, 1], [4, 1]], 1]]
}
{
"()": [
[[[[2, 1], [3, 1]], 1], [[[4, 1]], 1]],
[[[[2, 1], [4, 1]], 1], [[[3, 1]], 1]]
]
}
#10
{
"sink": [[[[2, 1]], 2]],
"source": [[[[2, 1], [1, 1]], 1], [[[2, 1]], 2]]
}
{"()": [[[[[1, 1]], 1], [[[2, 1]], 1]], [[[[1, 1], [2, 1]], 1]]]}
diffuse
fn diffuse(graph: &mut Hypergraph<usize>, signal: Wave<usize>) -> Vec<Label> {
graph.diffuse(signal).collect()
}
#0
{
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
},
"signal": [[[[1, 1]], 1]]
}
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
},
"()": [0]
}
#1
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
},
"signal": [[[[2, 1]], 1], [[[3, 1]], 1], [[[4, 1]], 1]]
}
{
"()": [1, 2, 3],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]], [3, [[4, 1]]]],
"edges": [],
"particles": 4,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3},
"world": {"0": 0, "1": 1, "2": 2, "3": 3},
"worlds": 4,
"united": {"0": [0], "1": [1], "2": [2], "3": [3]},
"future": {"0": [], "1": [], "2": [], "3": []},
"past": {"0": [], "1": [], "2": [], "3": []}
}
}
#2
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
},
"signal": []
}
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
},
"()": []
}
#3
{
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
},
"signal": [[[[1, 1]], 1], [[[2, 1]], 1], [[[3, 1]], 1], [[[4, 1]], 1], [[[5, 1]], 1]]
}
{
"()": [0, 1, 2, 3, 4],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]], [3, [[4, 1]]], [4, [[5, 1]]]],
"edges": [],
"particles": 5,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4},
"world": {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4},
"worlds": 5,
"united": {"0": [0], "1": [1], "2": [2], "3": [3], "4": [4]},
"future": {"0": [], "1": [], "2": [], "3": [], "4": []},
"past": {"0": [], "1": [], "2": [], "3": [], "4": []}
}
}
edge
fn edge(graph: &Hypergraph<usize>, label: Label) -> Label {
utility::unwrap(graph.edge(label)).label
}
#0
{
"label": 0,
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [
{
"label": 0,
"inference": {"source": [0], "sink": [1]},
"relation": {"source": [[[[1, 1]], 1]], "sink": [[[[2, 1]], 1]]}
}
],
"particles": 2,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [], "1": []},
"past": {"0": [], "1": []}
}
}
{"()": 0}
#1
{
"label": 0,
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]]],
"edges": [
{
"label": 0,
"inference": {"source": [0, 1], "sink": [2]},
"relation": {"source": [[[[1, 1]], 1], [[[2, 1]], 1]], "sink": [[[[3, 1]], 1]]}
}
],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"0": [0], "1": [1], "2": [2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
}
}
{"()": 0}
#2
{
"label": 0,
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]]],
"edges": [
{
"label": 0,
"inference": {"source": [0], "sink": [1, 2]},
"relation": {"source": [[[[1, 1]], 1]], "sink": [[[[2, 1]], 1], [[[3, 1]], 1]]}
}
],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"0": [0], "1": [1], "2": [2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
}
}
{"()": 0}
#3
{
"label": 0,
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]], [3, [[4, 1]]]],
"edges": [
{
"label": 0,
"inference": {"source": [0, 1], "sink": [2, 3]},
"relation": {
"source": [[[[1, 1]], 1], [[[2, 1]], 1]],
"sink": [[[[3, 1]], 1], [[[4, 1]], 1]]
}
}
],
"particles": 4,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3},
"world": {"0": 0, "1": 1, "2": 2, "3": 3},
"worlds": 4,
"united": {"0": [0], "1": [1], "2": [2], "3": [3]},
"future": {"0": [], "1": [], "2": [], "3": []},
"past": {"0": [], "1": [], "2": [], "3": []}
}
}
{"()": 0}
fixed
fn fixed(graph: &mut Hypergraph<usize>, refractions: Related<Wave<usize>>) -> Inference {
utility::unwrap(graph.fixed(refractions))
}
#0
{
"refractions": {"adjacency": []},
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
}
}
{"()": {"edges": []}}
#1
{
"refractions": {"adjacency": [[[[[[1, 1]], 1]], [[[[[2, 1]], 1]]]]]},
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
}
}
{"()": {"edges": [2]}}
focus
fn focus(graph: &mut Hypergraph<usize>, particle: Particle<usize>) -> Label {
graph.focus(particle)
}
#0
{
"particle": [[1, 1]],
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
}
}
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
},
"()": 0
}
#1
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]]],
"edges": [],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"0": [0], "1": [1], "2": [2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
},
"particle": [[4, 1]]
}
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]], [3, [[4, 1]]]],
"edges": [],
"particles": 4,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3},
"world": {"0": 0, "1": 1, "2": 2, "3": 3},
"worlds": 4,
"united": {"0": [0], "1": [1], "2": [2], "3": [3]},
"future": {"0": [], "1": [], "2": [], "3": []},
"past": {"0": [], "1": [], "2": [], "3": []}
},
"()": 3
}
#2
{
"particle": [[5, 1]],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [],
"particles": 2,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [], "1": []},
"past": {"0": [], "1": []}
}
}
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[5, 1]]]],
"edges": [],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"0": [0], "1": [1], "2": [2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
},
"()": 2
}
independent
fn independent(graph: &Hypergraph<usize>, rank: usize) -> Vec<BTreeSet<Label>> {
graph.independent(rank).collect()
}
#0
{
"rank": 1,
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
}
}
{"()": []}
#1
{
"rank": 3,
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [],
"particles": 2,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [], "1": []},
"past": {"0": [], "1": []}
}
}
{"()": []}
#2
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]]],
"edges": [],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"0": [0], "1": [1], "2": [2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
},
"rank": 2
}
{"()": [[0, 1], [0, 2], [1, 2]]}
#3
{
"rank": 2,
"graph": {
"_meta": {},
"nodes": [
[0, [[1, 1]]],
[1, [[2, 1]]],
[2, [[3, 1]]],
[3, [[4, 1]]],
[4, [[5, 1]]],
[5, [[6, 1]]]
],
"edges": [],
"particles": 6,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5},
"world": {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5},
"worlds": 6,
"united": {"0": [0, 1], "2": [2], "3": [3, 4, 5]},
"future": {"0": [], "1": [], "2": [], "3": [], "4": [], "5": []},
"past": {"0": [], "1": [], "2": [], "3": [], "4": [], "5": []}
}
}
{
"()": [
[0, 2],
[1, 2],
[0, 3],
[0, 4],
[0, 5],
[1, 3],
[1, 4],
[1, 5],
[2, 3],
[2, 4],
[2, 5]
]
}
#4
{
"rank": 3,
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]], [3, [[4, 1]]], [4, [[5, 1]]]],
"edges": [],
"particles": 5,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4},
"world": {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4},
"worlds": 5,
"united": {"0": [0, 1], "2": [2], "3": [3], "4": [4]},
"future": {"0": [], "1": [], "2": [], "3": [], "4": []},
"past": {"0": [], "1": [], "2": [], "3": [], "4": []}
}
}
{
"()": [[0, 2, 3], [1, 2, 3], [0, 2, 4], [1, 2, 4], [0, 3, 4], [1, 3, 4], [2, 3, 4]]
}
#5
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]]],
"edges": [],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"0": [0], "1": [1], "2": [2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
},
"rank": 1
}
{"()": [[0], [1], [2]]}
#6
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [],
"particles": 2,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [], "1": []},
"past": {"0": [], "1": []}
},
"rank": 0
}
{"()": [[]]}
infer
fn infer(graph: &mut Hypergraph<usize>, refractions: Related<Wave<usize>>) -> Inference {
utility::unwrap(graph.infer(refractions))
}
#0
{
"refractions": {"adjacency": []},
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
}
}
{"()": {"edges": []}}
#1
{
"refractions": {"adjacency": []},
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
}
}
{"()": {"edges": []}}
#2
{
"refractions": {"adjacency": [[[[[[1, 1]], 1]], [[[[[2, 1]], 1]]]]]},
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
}
}
{"()": {"edges": [2]}}
#3
{
"refractions": {"adjacency": [[[[[[5, 1]], 1]], [[[[[6, 1]], 1]]]]]},
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
}
}
{"()": {"edges": []}}
#4
{
"refractions": {"adjacency": [[[[[[1, 1]], 1]], [[[[[2, 1]], 1]]]]]},
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [],
"particles": 2,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [], "1": []},
"past": {"0": [], "1": []}
}
}
{"()": {"edges": [2]}}
#5
{
"refractions": {"adjacency": [[[[[[1, 1]], 1]], [[[[[2, 1]], 1]]]]]},
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[2, 1]]]],
"edges": [],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"0": [0], "1": [1], "2": [2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
}
}
{"()": {"edges": [3, 4]}}
isomorphics
fn isomorphics(graph: &Hypergraph<usize>, particle: &Particle<usize>) -> Vec<Label> {
graph.isomorphics(particle).collect()
}
#0
{
"particle": [[1, 1]],
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
}
}
{"()": []}
#1
{
"particle": [[5, 1]],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [],
"particles": 2,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [], "1": []},
"past": {"0": [], "1": []}
}
}
{"()": []}
#2
{
"particle": [[1, 1]],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [],
"particles": 2,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [], "1": []},
"past": {"0": [], "1": []}
}
}
{"()": [0]}
#3
{
"particle": [[1, 1]],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[1, 1]]], [2, [[1, 1]]], [3, [[2, 1]]]],
"edges": [],
"particles": 4,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3},
"world": {"0": 0, "1": 1, "2": 2, "3": 3},
"worlds": 4,
"united": {"0": [0], "1": [1], "2": [2], "3": [3]},
"future": {"0": [], "1": [], "2": [], "3": []},
"past": {"0": [], "1": [], "2": [], "3": []}
}
}
{"()": [0, 1, 2]}
node
fn node(graph: &Hypergraph<usize>, label: Label) -> Label {
utility::unwrap(graph.node(label)).label
}
#0
{
"label": 0,
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
}
}
{"()": 0}
#1
{
"label": 2,
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]]],
"edges": [],
"particles": 3,
"refractions": {"0": 0, "1": 1, "2": 2},
"world": {"0": 0, "1": 1, "2": 2},
"worlds": 3,
"united": {"0": [0], "1": [1], "2": [2]},
"future": {"0": [], "1": [], "2": []},
"past": {"0": [], "1": [], "2": []}
}
}
{"()": 2}
translate
fn translate(graph: &mut Hypergraph<usize>, source: BTreeSet<Label>, destinations: BTreeSet<Label>, relation: Relation<Wave<usize>>) -> Translation {
utility::unwrap(graph.translate(source, destinations, relation))
}
#0
{
"source": [0],
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [],
"particles": 2,
"refractions": {"0": 0, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"0": [0], "1": [1]},
"future": {"0": [], "1": []},
"past": {"0": [], "1": []}
},
"destinations": [1],
"relation": {"source": [[[[1, 1]], 1]], "sink": [[[[2, 1]], 1]]}
}
{
"()": {"New": 2},
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]]],
"edges": [
{
"label": 2,
"inference": {"source": [0], "sink": [1]},
"relation": {"source": [[[[1, 1]], 1]], "sink": [[[[2, 1]], 1]]}
}
],
"particles": 3,
"refractions": {"0": 1, "1": 1},
"world": {"0": 0, "1": 1},
"worlds": 2,
"united": {"1": [0, 1]},
"future": {"0": [2], "1": []},
"past": {"0": [], "1": [2]}
}
}
united
fn united(graph: &Hypergraph<usize>) -> Vec<Vec<Label>> {
graph
.united()
.map(Iterator::collect)
.collect()
}
#0
{
"graph": {
"_meta": {},
"nodes": [],
"edges": [],
"particles": 0,
"refractions": {},
"world": {},
"worlds": 0,
"united": {},
"future": {},
"past": {}
}
}
{"()": []}
#1
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]]],
"edges": [],
"particles": 1,
"refractions": {"0": 0},
"world": {"0": 0},
"worlds": 1,
"united": {"0": [0]},
"future": {"0": []},
"past": {"0": []}
}
}
{"()": [[0]]}
#2
{
"graph": {
"_meta": {},
"nodes": [[0, [[1, 1]]], [1, [[2, 1]]], [2, [[3, 1]]], [3, [[4, 1]]]],
"edges": [],
"particles": 4,
"refractions": {"0": 0, "1": 1, "2": 2, "3": 3},
"world": {"0": 0, "1": 1, "2": 2, "3": 3},
"worlds": 4,
"united": {"0": [0], "1": [1], "2": [2], "3": [3]},
"future": {"0": [], "1": [], "2": [], "3": []},
"past": {"0": [], "1": [], "2": [], "3": []}
}
}
{"()": [[0], [1], [2], [3]]}
particle.diverge
pub fn diverge(source: Particle<String>, basis: Particle<String>) -> Option<Particle<String>> {
source.diverge(&basis)
}
#0
{"basis": [["A", 1]], "source": [["A", 1], ["B", 1]]}
{"()": [["B", 1]]}
#1
{"source": [["A", 1]], "basis": [["B", 1]]}
{"()": [["A", 1]]}
#2
{"source": [["A", 1]], "basis": [["A", 1]]}
{"()": null}
particle.intersect
pub fn intersect(source: Particle<String>, basis: Particle<String>) -> Option<Particle<String>> {
source.intersect(&basis)
}
#0
{"basis": [["A", 1], ["C", 1]], "source": [["A", 1], ["B", 1]]}
{"()": [["A", 1]]}
#1
{"basis": [["B", 1]], "source": [["A", 1]]}
{"()": null}
#2
{"basis": [["A", 1], ["B", 1]], "source": [["A", 1], ["B", 1]]}
{"()": [["A", 1], ["B", 1]]}
particle.join
pub fn join(source: Particle<String>, basis: Particle<String>) -> Option<Particle<String>> {
source.join(&basis)
}
#0
{"basis": [["B", 1]], "source": [["A", 1]]}
{"()": [["A", 1], ["B", 1]]}
#1
{"basis": [["A", 1]], "source": [["A", 1]]}
{"()": [["A", 2]]}
#2
{"basis": [], "source": [["A", 1]]}
{"()": null}
wave.diverge
pub fn diverge(source: Wave<String>, basis: Wave<String>) -> Option<Wave<String>> {
source.diverge(&basis)
}
#0
{
"basis": [[[["A", 1]], 1]],
"source": [[[["A", 1]], 1], [[["B", 1]], 1]]
}
{"()": [[[["B", 1]], 1]]}
#1
{"basis": [[[["A", 1]], 1]], "source": [[[["A", 1]], 1]]}
{"()": null}
wave.intersect
pub fn intersect(source: Wave<String>, basis: Wave<String>) -> Option<Wave<String>> {
source.intersect(&basis)
}
#0
{
"basis": [[[["A", 1], ["C", 1]], 1]],
"source": [[[["A", 1], ["B", 1]], 1]]
}
{"()": [[[["A", 1]], 1]]}
#1
{"basis": [[[["B", 1]], 1]], "source": [[[["A", 1]], 1]]}
{"()": null}
wave.join
pub fn join(source: Wave<String>, basis: Wave<String>) -> Option<Wave<String>> {
source.join(&basis)
}
#0
{"source": [[[["A", 1]], 1]], "basis": [[[["B", 1]], 1]]}
{"()": [[[["A", 1]], 1], [[["B", 1]], 1]]}
#1
{"source": [[[["A", 1]], 1]], "basis": [[[["A", 1]], 1]]}
{"()": [[[["A", 1]], 2]]}
particle
fn particle(source: Particle<String>, basis: String) -> usize {
source.scale(&basis)
}
#0
{"basis": "A", "source": [["A", 3], ["B", 1]]}
{"()": 3}
#1
{"basis": "B", "source": [["A", 1]]}
{"()": 0}
#2
{"basis": "A", "source": []}
{"()": 0}
wave
fn wave(source: Wave<String>, basis: Particle<String>) -> usize {
source.scale(&basis)
}
#0
{"basis": [["A", 1]], "source": [[[["A", 1]], 2]]}
{"()": 2}
#1
{"basis": [["B", 1]], "source": [[[["A", 1]], 1]]}
{"()": 0}
#2
{"basis": [["A", 1]], "source": []}
{"()": 0}
identity
fn identity(value: usize) -> usize {
value
}
#0
{"value": 42}
{"()": 42}
hierarchy
fn hierarchy(scenario: usize) -> (usize, bool) {
let sink = Streamer::assembler(stream::predicate("test")).open();
match scenario {
0 => instrumented(),
1 => outer(),
_ => {
},
}
let captured = sink
.close()
.spans()
.collect::<Vec<_>>();
let roots = captured
.iter()
.filter(|s| matches!(s . lifecycle , Lifecycle :: Begin (_)))
.filter(|s| s
.id
.parent
.is_none())
.count();
let consistent = captured
.iter()
.filter(|s| matches!(s . lifecycle , Lifecycle :: Begin (_)))
.all(|s| s.id.trace != 0 && s.id.span != 0);
(roots, consistent)
}
#0
{"scenario": 0}
{"()": [1, true]}
#1
{"scenario": 1}
{"()": [1, true]}
identifier
fn identifier(mode: usize) -> (bool, bool, bool) {
let root = stream::Identifier::root(100, 1);
let child = stream::Identifier::child(100, 2, 1);
match mode {
0 => (root.parent.is_none(), root.trace == 100, root.span == 1),
1 => (child.parent == Some(1), child.trace == 100, child.span == 2),
_ => (false, false, false),
}
}
#0
{"mode": 0}
{"()": [true, true, true]}
#1
{"mode": 1}
{"()": [true, true, true]}
lifecycle
fn lifecycle(scenario: usize) -> (usize, usize, usize) {
let sink = Streamer::assembler(stream::predicate("test")).open();
match scenario {
0 => instrumented(),
1 => outer(),
_ => {
},
}
let captured = sink
.close()
.spans()
.collect::<Vec<_>>();
let begins = captured
.iter()
.filter(|s| matches!(s . lifecycle , Lifecycle :: Begin (_)))
.count();
let ends = captured
.iter()
.filter(|s| matches!(s . lifecycle , Lifecycle :: End (_)))
.count();
(captured.len(), begins, ends)
}
#0
{"scenario": 0}
{"()": [2, 1, 1]}
#1
{"scenario": 1}
{"()": [4, 2, 2]}
#2
{"scenario": 99}
{"()": [0, 0, 0]}
duplicate
fn duplicate(input: String) -> bool {
Channel::parse(&input).is_err()
}
#0
{"input": "core,trace"}
{"()": false}
#1
{"input": "core,core"}
{"()": true}
#2
{"input": "core:1,core:2"}
{"()": true}
matches
fn matches(channels: Vec<String>, filter: Vec<String>) -> bool {
let parsed: Vec<Channel> = channels
.into_iter()
.map(|name| Channel {
name,
weight: 1
})
.collect();
let refs: Vec<&str> = filter
.iter()
.map(String::as_str)
.collect();
Channel::matches(&parsed, &refs)
}
#0
{"channels": ["core", "trace"], "filter": ["core"]}
{"()": true}
#1
{"channels": ["core"], "filter": ["debug"]}
{"()": false}
#2
{"channels": [], "filter": ["core"]}
{"()": false}
#3
{"channels": ["core"], "filter": []}
{"()": false}
#4
{
"channels": ["core", "trace", "debug"],
"filter": ["trace", "info"]
}
{"()": true}
parse
fn parse(input: String) -> Vec<(String, u8)> {
match Channel::parse(&input) {
Ok(channels) => channels
.iter()
.map(|c| (c.name.clone(), c.weight))
.collect(),
Err(_) => vec!(),
}
}
#0
{"input": "core"}
{"()": [["core", 1]]}
#1
{"input": "core:5"}
{"()": [["core", 5]]}
#2
{"input": "core,debug,trace"}
{"()": [["core", 1], ["debug", 1], ["trace", 1]]}
#3
{"input": "core:3,trace:7"}
{"()": [["core", 3], ["trace", 7]]}
#4
{"input": ""}
{"()": []}
#5
{"input": " core , trace "}
{"()": [["core", 1], ["trace", 1]]}
serialize
fn serialize(channels: Vec<(String, u8)>) -> String {
let parsed: Vec<Channel> = channels
.into_iter()
.map(|(name, weight)| Channel {
name,
weight
})
.collect();
Channel::serialize(&parsed)
}
#0
{"channels": [["core", 1]]}
{"()": "core:1"}
#1
{"channels": [["core", 3], ["trace", 5]]}
{"()": "core:3,trace:5"}
#2
{"channels": []}
{"()": ""}
any
fn any(input: String) -> bool {
matches!(:: parse :: parse (& input) . unwrap () , Expression :: Any)
}
#0
{"input": ""}
{"()": true}
#1
{"input": " "}
{"()": true}
#2
{"input": "core"}
{"()": false}
evaluate
fn evaluate(input: String, channels: Vec<String>) -> bool {
let parsed = parse::parse(&input).unwrap();
let channels: Vec<Channel> = channels
.into_iter()
.map(|name| Channel {
name,
weight: 1
})
.collect();
parsed.channels(&channels)
}
#0
{"input": "core", "channels": ["core"]}
{"()": true}
#1
{"input": "core", "channels": ["http"]}
{"()": false}
#2
{"channels": ["core"], "input": "core,http"}
{"()": true}
#3
{"channels": ["http"], "input": "core,http"}
{"()": true}
#4
{"input": "core,http", "channels": ["debug"]}
{"()": false}
#5
{"input": "core.http", "channels": ["core", "http"]}
{"()": true}
#6
{"input": "core.http", "channels": ["core"]}
{"()": false}
#7
{"channels": ["core"], "input": "!debug"}
{"()": true}
#8
{"channels": ["debug"], "input": "!debug"}
{"()": false}
#9
{"channels": ["core"], "input": "(core,http).!debug"}
{"()": true}
#10
{"input": "(core,http).!debug", "channels": ["core", "debug"]}
{"()": false}
#11
{"channels": [], "input": "core"}
{"()": false}
#12
{"channels": ["core", "http", "debug"], "input": "core"}
{"()": true}
parse
fn parse(input: String) -> bool {
parse::parse(&input).is_ok()
}
#0
{"input": "core"}
{"()": true}
#1
{"input": "core,http"}
{"()": true}
#2
{"input": "core.http"}
{"()": true}
#3
{"input": "!debug"}
{"()": true}
#4
{"input": "(core,http).!debug"}
{"()": true}
#5
{"input": "!(core.http)"}
{"()": true}
reject
fn reject(input: String) -> bool {
parse::parse(&input).is_err()
}
#0
{"input": "(core"}
{"()": true}
#1
{"input": "core."}
{"()": true}
#2
{"input": "core,"}
{"()": true}
#3
{"input": "!"}
{"()": true}
#4
{"input": "core@http"}
{"()": true}
evaluate
fn evaluate(terms: HashMap<String, f64>, point: Vec<f64>) -> f64 {
let expression = utility::unwrap(Expression::parse(&terms));
expression.evaluate(&point)
}
#0
{"point": [], "terms": {"[]": 5.0}}
{"()": 5.0}
#1
{"point": [3.0], "terms": {"[1]": 2.0}}
{"()": 6.0}
#2
{"terms": {"[2]": 1.0, "[]": 1.0}, "point": [3.0]}
{"()": 10.0}
#3
{"terms": {"[1, 1]": 1.0}, "point": [2.0, 3.0]}
{"()": 6.0}
parse
fn parse(terms: HashMap<String, f64>) -> bool {
Expression::parse(&terms).is_ok()
}
#0
{"terms": {"[1]": 2.0, "[]": 1.0}}
{"()": true}
#1
{"terms": {"bad": 1.0}}
{"()": false}
add
fn add(a: [f32; 3], b: [f32; 3]) -> [f32; 3] {
(Vector::from(a) + Vector::from(b)).array()
}
#0
{"a": [1.0, 2.0, 3.0], "b": [4.0, 5.0, 6.0]}
{"()": [5.0, 7.0, 9.0]}
#1
{"a": [1.0, 2.0, 3.0], "b": [0.0, 0.0, 0.0]}
{"()": [1.0, 2.0, 3.0]}
cross
fn cross(a: [f32; 3], b: [f32; 3]) -> [f32; 3] {
Vector::from(a).cross(&Vector::from(b)).array()
}
#0
{"a": [1.0, 0.0, 0.0], "b": [0.0, 1.0, 0.0]}
{"()": [0.0, 0.0, 1.0]}
#1
{"a": [1.0, 0.0, 0.0], "b": [2.0, 0.0, 0.0]}
{"()": [0.0, 0.0, 0.0]}
dot
fn dot(a: [f32; 3], b: [f32; 3]) -> f32 {
Vector::from(a).dot(&Vector::from(b))
}
#0
{"b": [0.0, 1.0, 0.0], "a": [1.0, 0.0, 0.0]}
{"()": 0.0}
#1
{"b": [1.0, 0.0, 0.0], "a": [1.0, 0.0, 0.0]}
{"()": 1.0}
#2
{"b": [4.0, 5.0, 6.0], "a": [1.0, 2.0, 3.0]}
{"()": 32.0}
lerp
fn lerp(a: [f32; 3], b: [f32; 3], t: f32) -> [f32; 3] {
Vector::from(a).lerp(&Vector::from(b), t).array()
}
#0
{"t": 0.0, "a": [0.0, 0.0, 0.0], "b": [10.0, 10.0, 10.0]}
{"()": [0.0, 0.0, 0.0]}
#1
{"t": 1.0, "a": [0.0, 0.0, 0.0], "b": [10.0, 10.0, 10.0]}
{"()": [10.0, 10.0, 10.0]}
#2
{"t": 0.5, "a": [0.0, 0.0, 0.0], "b": [10.0, 10.0, 10.0]}
{"()": [5.0, 5.0, 5.0]}
magnitude
fn magnitude(a: [f32; 3]) -> f32 {
Vector::from(a).magnitude()
}
#0
{"a": [1.0, 0.0, 0.0]}
{"()": 1.0}
#1
{"a": [0.0, 0.0, 0.0]}
{"()": 0.0}
#2
{"a": [3.0, 4.0, 0.0]}
{"()": 5.0}
normalize
fn normalize(a: [f32; 3]) -> [f32; 3] {
Vector::from(a).normalize().array()
}
#0
{"a": [1.0, 0.0, 0.0]}
{"()": [1.0, 0.0, 0.0]}
#1
{"a": [0.0, 0.0, 5.0]}
{"()": [0.0, 0.0, 1.0]}
#2
{"a": [0.0, 0.0, 0.0]}
{"()": [0.0, 0.0, 0.0]}
conjugate
fn conjugate(input: [f32; 4]) -> [f32; 4] {
let q = Quaternion {
w: input[0],
x: input[1],
y: input[2],
z: input[3]
};
let c = q.conjugate();
[c.w, c.x, c.y, c.z]
}
#0
{"input": [1.0, 0.0, 0.0, 0.0]}
{"()": [1.0, 0.0, 0.0, 0.0]}
#1
{"input": [1.0, 2.0, 3.0, 4.0]}
{"()": [1.0, -2.0, -3.0, -4.0]}
identity
fn identity() -> [f32; 4] {
let q = Quaternion::identity();
[q.w, q.x, q.y, q.z]
}
#0
{}
{"()": [1.0, 0.0, 0.0, 0.0]}
magnitude
fn magnitude(input: [f32; 4]) -> f32 {
let q = Quaternion {
w: input[0],
x: input[1],
y: input[2],
z: input[3]
};
q.magnitude()
}
#0
{"input": [1.0, 0.0, 0.0, 0.0]}
{"()": 1.0}
#1
{"input": [0.0, 1.0, 0.0, 0.0]}
{"()": 1.0}
rotate
fn rotate(quaternion: [f32; 4], point: [f32; 3]) -> [f32; 3] {
let q = Quaternion {
w: quaternion[0],
x: quaternion[1],
y: quaternion[2],
z: quaternion[3]
};
q.rotate(Vector::from(point)).array()
}
#0
{"quaternion": [1.0, 0.0, 0.0, 0.0], "point": [1.0, 0.0, 0.0]}
{"()": [1.0, 0.0, 0.0]}
hex
fn hex(value: u32) -> [f32; 4] {
Color::hex(value).array()
}
#0
{"value": 4294967295}
{"()": [1.0, 1.0, 1.0, 1.0]}
#1
{"value": 255}
{"()": [0.0, 0.0, 0.0, 1.0]}
#2
{"value": 0}
{"()": [0.0, 0.0, 0.0, 0.0]}
lerp
fn lerp(a: [f32; 4], b: [f32; 4], t: f32) -> [f32; 4] {
Color::from(a).lerp(Color::from(b), t).array()
}
#0
{"b": [1.0, 1.0, 1.0, 1.0], "t": 0.5, "a": [0.0, 0.0, 0.0, 1.0]}
{"()": [0.5, 0.5, 0.5, 1.0]}
#1
{"t": 0.0, "b": [0.0, 1.0, 0.0, 1.0], "a": [1.0, 0.0, 0.0, 1.0]}
{"()": [1.0, 0.0, 0.0, 1.0]}
transparent
fn transparent() -> [f32; 4] {
Color::transparent().array()
}
#0
{}
{"()": [0.0, 0.0, 0.0, 0.0]}
midpoint
fn midpoint(k: i32) -> f64 {
half(k)
}
#0
{"k": 0}
{"()": 0.7861513777574233}
#1
{"k": 1}
{"()": 1.272019649514069}
phi
fn phi() -> f64 {
PHI
}
#0
{}
{"()": 1.618033988749895}
proportion
fn proportion(k: i32) -> f64 {
scale(k)
}
#0
{"k": 0}
{"()": 1.0}
#1
{"k": 1}
{"()": 1.618033988749895}
#2
{"k": 2}
{"()": 2.618033988749895}
#3
{"k": -1}
{"()": 0.6180339887498948}
slug
fn slug(text: String) -> String {
slugify(&text)
}
#0
{"text": "Hello World"}
{"()": "hello-world"}
#1
{"text": "What's New?"}
{"()": "what-s-new"}
#2
{"text": "Trailing ---"}
{"()": "trailing"}
#3
{"text": "Molten"}
{"()": "molten"}
#4
{"text": "Version 2.0"}
{"()": "version-2-0"}
textual
fn textual(elements: Vec<String>) -> String {
use element::Element;
let converted = elements
.into_iter()
.map(Element::Text)
.collect::<Vec<_>>();
render::textual(&converted)
}
#0
{"elements": ["Hello"]}
{"()": "Hello"}
#1
{"elements": ["Hello", " ", "World"]}
{"()": "Hello World"}
#2
{"elements": []}
{"()": ""}
ancestry
fn ancestry(depth: usize) -> Vec<bool> {
let sink = Streamer::assembler(stream::predicate("test")).open();
let _ = outer(depth);
let captured = sink
.close()
.spans()
.collect::<Vec<_>>();
captured
.iter()
.filter(|s| matches!(s . lifecycle , Lifecycle :: Begin (_)))
.enumerate()
.map(|(i, span)| {
if i == 0 {
span
.id
.parent
.is_none()
} else {
span
.id
.parent
.is_some()
}
})
.collect()
}
#0
{"depth": 0}
{"()": [true]}
#1
{"depth": 2}
{"()": [true, true, true]}
consistent
fn consistent(depth: usize) -> bool {
let sink = Streamer::assembler(stream::predicate("test")).open();
let _ = outer(depth);
let captured = sink
.close()
.spans()
.collect::<Vec<_>>();
let begins: Vec<_> = captured
.iter()
.filter(|s| matches!(s . lifecycle , Lifecycle :: Begin (_)))
.collect();
if begins.is_empty() {
return true;
}
let trace = begins[0].id.trace;
begins.iter().all(|s| s.id.trace == trace && s.id.span != 0)
}
#0
{"depth": 0}
{"()": true}
#1
{"depth": 4}
{"()": true}
nested
fn nested(depth: usize) -> (usize, usize) {
let sink = Streamer::assembler(stream::predicate("test")).open();
let _ = outer(depth);
let captured = sink
.close()
.spans()
.collect::<Vec<_>>();
let begins = captured
.iter()
.filter(|s| matches!(s . lifecycle , Lifecycle :: Begin (_)))
.count();
let parents = captured
.iter()
.filter(|s| matches!(s . lifecycle , Lifecycle :: Begin (_)))
.filter(|s| s
.id
.parent
.is_some())
.count();
(begins, parents)
}
#0
{"depth": 0}
{"()": [1, 0]}
#1
{"depth": 1}
{"()": [2, 1]}
#2
{"depth": 3}
{"()": [4, 3]}
excluded
fn excluded(filter: Vec<String>) -> usize {
let sink = Streamer::assembler(std::sync::Arc::new(move |channels: &[_]| {
!channels.iter().any(|c| filter.contains(&c.name))
})).open();
alpha();
beta();
combined();
sink.close().count()
}
#0
{"filter": ["alpha"]}
{"()": 2}
#1
{"filter": ["alpha", "beta"]}
{"()": 0}
included
fn included(filter: Vec<String>) -> usize {
let sink = Streamer::assembler(std::sync::Arc::new(move |channels: &[_]| {
channels.iter().any(|c| filter.contains(&c.name))
})).open();
alpha();
beta();
combined();
sink.close().count()
}
#0
{"filter": ["alpha"]}
{"()": 4}
#1
{"filter": ["beta"]}
{"()": 4}
#2
{"filter": ["alpha", "beta"]}
{"()": 6}
#3
{"filter": ["gamma"]}
{"()": 0}
parsed
fn parsed(specification: String) -> (usize, u8) {
let channels = Channel::parse(&specification).unwrap_or_default();
let weight = channels.first().map_or(0, |c| c.weight);
(channels.len(), weight)
}
#0
{"specification": "core"}
{"()": [1, 1]}
#1
{"specification": "core:5"}
{"()": [1, 5]}
serialized
fn serialized(names: Vec<String>, weights: Vec<u8>) -> String {
let channels: Vec<_> = names
.into_iter()
.zip(weights)
.map(|(name, weight)| Channel {
name,
weight
})
.collect();
Channel::serialize(&channels)
}
#0
{"weights": [1], "names": ["core"]}
{"()": "core:1"}
#1
{"weights": [1, 5], "names": ["alpha", "beta"]}
{"()": "alpha:1,beta:5"}
weighted
fn weighted(threshold: u8) -> usize {
let sink = Streamer::assembler(std::sync::Arc::new(move |channels: &[_]| {
channels.iter().any(|c| c.weight >= threshold)
})).open();
let low = tracing::info_span!("low" , channels = "test:1").entered();
let mid = tracing::info_span!("mid" , channels = "test:5").entered();
let high = tracing::info_span!("high" , channels = "test:10").entered();
drop(high);
drop(mid);
drop(low);
sink.close().count()
}
#0
{"threshold": 1}
{"()": 6}
#1
{"threshold": 5}
{"()": 4}
#2
{"threshold": 10}
{"()": 2}
address
fn address(input: String) -> String {
let url = Url::parse(&input).unwrap();
let peer = peer::Assembler::new().address(url).assemble();
peer.address().to_string()
}
#0
{"input": "grpc://127.0.0.1:50051"}
{"()": "grpc://127.0.0.1:50051"}
#1
{"input": "grpc://localhost:8080"}
{"()": "grpc://localhost:8080"}
assembler
fn assembler() -> bool {
let peer = peer::Assembler::new().assemble();
peer.connections().is_empty()
}
#0
{}
{"()": true}
capacity
fn capacity(value: usize) -> bool {
let peer = peer::Assembler::new().capacity(value).assemble();
peer.connections().is_empty()
}
#0
{"value": 1024}
{"()": true}
#1
{"value": 65536}
{"()": true}
default
fn default() -> bool {
let peer = peer::Assembler::default().assemble();
peer.connections().is_empty()
}
#0
{}
{"()": true}
add
fn add(a: i32, b: i32) -> i32 {
a + b
}
#0
{"a": 2, "b": 3}
{"()": 5}
#1
{"a": 10, "b": 15}
{"()": 25}
#2
{"a": -1, "b": 1}
{"()": 0}
#3
{"a": -5, "b": -3}
{"()": -8}
#4
{"a": 100, "b": 200}
{"()": 300}
math.operators.multiply
pub fn multiply(x: i32, y: i32) -> i32 {
x * y
}
#0
{"x": 3, "y": 4}
{"()": 12}
#1
{"x": -2, "y": 5}
{"()": -10}
math.operators.power
pub fn power(base: i32, exp: i32) -> i32 {
base.pow(u32::try_from(exp).unwrap_or(0))
}
#0
{"exp": 3, "base": 2}
{"()": 8}
#1
{"exp": 2, "base": 5}
{"()": 25}
average
fn average(person: &Person) -> f64 {
if person.scores.is_empty() {
0.0
} else {
let sum = person
.scores
.iter()
.sum::<i32>();
let count = u32::try_from(person.scores.len()).expect("score count overflow");
f64::from(sum) / f64::from(count)
}
}
#0
{"person": {"name": "Alice", "age": 25, "scores": [85, 90, 92, 88]}}
{"()": 88.75}
#1
{"person": {"name": "Bob", "age": 30, "scores": []}}
{"()": 0.0}
count_some
fn count_some(data: &HashMap<u32, Option<MyType<String>>>) -> usize {
data
.values()
.filter(|v| v.is_some())
.count()
}
#0
{
"data": {"1": {"value": "hello"}, "2": null, "3": {"value": "world"}}
}
{"()": 2}
distance
fn distance(point: &Point) -> f64 {
f64::from(point.x.pow(2) + point.y.pow(2)).sqrt()
}
#0
{"point": {"x": 5, "y": 12}}
{"()": 13}
#1
{"point": {"x": 0, "y": 0}}
{"()": 0.0}
geometry.rectangle_area
pub fn rectangle_area(top_left: &Point, bottom_right: &Point) -> i32 {
let width = (bottom_right.x - top_left.x).abs();
let height = (top_left.y - bottom_right.y).abs();
width * height
}
#0
{"top_left": {"x": 0, "y": 10}, "bottom_right": {"x": 5, "y": 0}}
{"()": 50}
#1
{"top_left": {"x": -2, "y": 3}, "bottom_right": {"x": 4, "y": -1}}
{"()": 24}
matrix_sum
fn matrix_sum(matrix: &Matrix<i32>) -> i32 {
matrix
.rows
.iter()
.flat_map(|row| row.iter())
.sum::<i32>() + matrix
.metadata
.values()
.sum::<i32>()
}
#0
{
"matrix": {
"rows": [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
"metadata": {"offset": 10, "scale": 2}
}
}
{"()": 57}
nested_optionals
fn nested_optionals(data: Option<Vec<Option<String>>>) -> Vec<String> {
data
.unwrap_or_default()
.into_iter()
.flatten()
.collect()
}
#0
{"data": ["hello", null, "world", null, "rust"]}
{"()": ["hello", "world", "rust"]}
nested_process
fn nested_process(data: &HashMap<String, Vec<HashMap<String, Vec<i32>>>>) -> i32 {
data
.values()
.flat_map(|vec| vec.iter())
.flat_map(|map| map.values())
.flat_map(|vec| vec.iter())
.sum()
}
#0
{
"data": {
"region_a": [{"store_1": [1, 2, 3], "store_2": [4, 5]}, {"store_3": [6, 7, 8, 9]}],
"region_b": [{"store_4": [10, 11], "store_5": [12, 13, 14]}],
"region_c": []
}
}
{"()": 105}
nested_sum
fn nested_sum(data: &std::collections::HashMap<String, std::collections::HashMap<String, i32>>) -> i32 {
data.get("a").map_or(0, |inner| inner.values().sum())
}
#0
{"data": {"a": {"b": 3, "c": 4}}}
{"()": 7}
optional_process
fn optional_process(name: Option<String>) -> String {
match name {
Some(n) => format!("Hello, {n}!"),
None => "Hello, stranger!".to_string(),
}
}
#0
{"name": "Alice"}
{"()": "Hello, Alice!"}
#1
{"name": null}
{"()": "Hello, stranger!"}
process_data
fn process_data(data: &HashMap<String, i32>) -> i32 {
data.values().sum()
}
#0
{"data": {"a": 10, "b": 20, "c": 30}}
{"()": 60}
process_status
fn process_status(status: &Status<i32>) -> String {
match status {
Status::Success(value) => format!("Success: {value}"),
Status::Warning(value, msg) => format!("Warning: {value} - {msg}"),
Status::Error(msg) => format!("Error: {msg}"),
}
}
#0
{"status": {"Success": 42}}
{"()": "Success: 42"}
#1
{"status": {"Warning": [100, "Low memory"]}}
{"()": "Warning: 100 - Low memory"}
#2
{"status": {"Error": "Network failure"}}
{"()": "Error: Network failure"}
sum_refs
fn sum_refs(x: &i32, y: &i32) -> i32 {
*x + *y
}
#0
{"x": 3, "y": 4}
{"()": 7}
#1
{"x": -2, "y": 5}
{"()": 3}
sum_vector
fn sum_vector(numbers: Vec<i32>) -> i32 {
numbers.iter().sum()
}
#0
{"numbers": [1, 2, 3, 4, 5]}
{"()": 15}
#1
{"numbers": []}
{"()": 0}
team_average
fn team_average(team: &Team) -> f64 {
if team.members.is_empty() {
0.0
} else {
let total_scores: Vec<i32> = team
.members
.iter()
.flat_map(|member| &member.scores)
.copied()
.collect();
if total_scores.is_empty() {
0.0
} else {
let sum = total_scores.iter().sum::<i32>();
let count = u32::try_from(total_scores.len()).expect("score count overflow");
f64::from(sum) / f64::from(count)
}
}
}
#0
{
"team": {
"name": "Engineering",
"budget": 100000,
"members": [
{"name": "Alice", "age": 25, "scores": [85, 90, 92]},
{"name": "Bob", "age": 30, "scores": [78, 82, 88, 95]}
]
}
}
{"()": 87.14285714285714}
#1
{"team": {"name": "Marketing", "budget": 75000, "members": []}}
{"()": 0.0}
#2
{
"team": {
"name": "Sales",
"budget": 80000,
"members": [
{"name": "Charlie", "age": 28, "scores": []},
{"name": "Diana", "age": 32, "scores": []}
]
}
}
{"()": 0.0}
two_level_process
fn two_level_process(data: Vec<HashMap<String, i32>>) -> i32 {
data
.iter()
.flat_map(|map| map.values())
.sum()
}
#0
{
"data": [
{"apples": 10, "oranges": 5, "bananas": 8},
{"apples": 3, "grapes": 12, "berries": 7},
{"oranges": 4, "mangoes": 6}
]
}
{"()": 55}
add_three
fn add_three(a: i32, b: i32, c: i32) -> i32 {
add(add(a, b), c)
}
#0
{"a": 1, "c": 3, "b": 2}
{"()": 6}
#1
{"a": 5, "c": 15, "b": 10}
{"()": 30}
#2
{"a": -1, "c": -3, "b": 2}
{"()": -2}
#3
{"b": 0, "c": 0, "a": 0}
{"()": 0}
double_in_place
fn double_in_place(x: &mut i32) -> i32 {
let prev = *x;
*x *= 2;
prev
}
#0
{"x": 4}
{"()": 4, "x": 8}
#1
{"x": -5}
{"()": -5, "x": -10}
increment
fn increment(x: &mut i32) -> i32 {
let prev = *x;
*x += 1;
prev
}
#0
{"x": 1}
{"x": 2, "()": 1}
#1
{"x": -3}
{"x": -2, "()": -3}
suggest
fn suggest(target: String, candidates: Vec<String>) -> Option<String> {
nearest(&target, &candidates)
}
#0
{"target": "hello", "candidates": ["hello", "world"]}
{"()": "
Maybe: "hello"?"}
#1
{"target": "helo", "candidates": ["hello", "world"]}
{"()": "
Maybe: "hello"?"}
#2
{"target": "xyz", "candidates": ["hello", "world"]}
{"()": null}
#3
{"target": "hello", "candidates": []}
{"()": null}
No tests match your query