А⚙
Size: a a a
А⚙
ML
А⚙
AK
AZ
List
определён в IdrisG
С
G
AK
AZ
AI
ML
AK
AI
AZ
trait Node<T> {}
#[derive(Debug)]
struct Nil;
impl<T> Node<T> for Nil {}
#[derive(Debug)]
struct LinkedList<T, U: Node<T>> {
head: T,
tail: U,
}
fn nil() -> Nil {
Nil {}
}
fn cons<T, U: Node<T>>(head: T, tail: U) -> LinkedList<T, U> {
LinkedList {
head,
tail
}
}
impl<T, U: Node<T>> Node<T> for LinkedList<T, U> {}
fn main() {
let list = cons(10, cons(20, nil()));
println!("{:?}", list);
}
AZ
А⚙
AI
AI
RP