Skip to content

test_41_struct_and_more

David Pollak edited this page Mar 11, 2013 · 4 revisions

Structs and More

Can we parse a Struct and then test some functions and methods associated with the structs



struct List a = Cons(hd: a, next: List a) | Nil

/*

cons a lst = Cons a lst

head lst = #hd lst
head2 lst = lst.hd 
res2 = #=hd 2 lst
res3 = lst.=hd 2
res4 = res2 == res3
res = cons 1 Nil
*/