Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•concept•jargon

// functional programming jargon: “to cons x onto y” informally means to construct a new container instance by putting the element x at the start of this new container, followed by the container y.
//Vec<T> is a better choice to use. Other, more complex recursive data types are useful in various situations, but by starting with the cons list, we can explore how boxes let us define a recursive data type without much distraction.
enum List {
    Cons(i32, List),
    Nil,
}

fn main() {}
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
2+9 =