13.07.2015 Views

Basic types, Lists, Trees, Higher-order functions

Basic types, Lists, Trees, Higher-order functions

Basic types, Lists, Trees, Higher-order functions

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

AppendThe infix operator @ (called ‘append’) joins two lists:Properties[x 1 ,x 2 , . . . ,x m ] @ [y 1 ,y 2 , . . . ,y n ]= [x 1 ,x 2 , . . . ,x m ,y 1 ,y 2 , . . . ,y n ][] @ ys = ys[x 1 ,x 2 , . . . ,x m ] @ ys = x 1 ::([x 2 , . . . ,x m ] @ ys)Declarationinfixr 5 @ (* right associativefun [] @ ys = ys| (x::xs) @ ys = x::(xs @ ys);c○Michael R. Hansen, Spring 2005 – p.19/59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!