MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / create_named_tuple

Method create_named_tuple

ciphercore-base/src/graphs.rs:2785–2793  ·  view source on GitHub ↗

Adds a node that creates a named tuple from several (possibly, zero) elements. # Arguments `elements` - vector of pairs (node name, node) # Returns New node creating a named tuple # Example ``` # use ciphercore_base::graphs::create_context; # use ciphercore_base::data_types::{INT32, array_type}; let c = create_context().unwrap(); let g = c.create_graph().unwrap(); let t1 = array_type(vec![3,

(&self, elements: Vec<(String, Node)>)

Source from the content-addressed store, hash-verified

2783 /// let n3 = g.create_named_tuple(vec![("node1".to_owned(), n1), ("node2".to_owned(), n2)]).unwrap();
2784 /// ```
2785 pub fn create_named_tuple(&self, elements: Vec<(String, Node)>) -> Result<Node> {
2786 let mut nodes = vec![];
2787 let mut names = vec![];
2788 for (name, node) in elements {
2789 nodes.push(node);
2790 names.push(name);
2791 }
2792 self.add_node(nodes, vec![], Operation::CreateNamedTuple(names))
2793 }
2794
2795 /// Adds a node that extracts an element of a tuple.
2796 ///

Callers 15

test_wellformed_casesFunction · 0.45
instantiateMethod · 0.45
test_helperFunction · 0.45
compute_naive_aucFunction · 0.45
sum_named_columnsFunction · 0.45
random_pad_columnsFunction · 0.45
get_select_graphFunction · 0.45
into_nodeMethod · 0.45
instantiateMethod · 0.45

Calls 2

add_nodeMethod · 0.80
pushMethod · 0.45

Tested by 10

test_wellformed_casesFunction · 0.36
test_helperFunction · 0.36
test_permutationFunction · 0.36
test_duplicationFunction · 0.36
test_sortFunction · 0.36