lec01 - match lst with -> | h :: t ->...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
let rec sumsq (n:int) : int = if n=0 then 0 else n*n + sumsq(n-1) let rec sumsq (n) = if n=0 then 0 else n*n + sumsq(n-1) let rec sumop (f,n) = if n=0 then 0 else f n + sumop(f,(n-1)) sumop((function x -> x*x*x), 5) let rec reverse (lst:'a list): ' list =
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: match lst with -> | h :: t -> reverse t @ [h] let pythagoras (x, y, z) = let square n = n*n in square z = square x + square y pythagoras (1, 2, 3) pythagoras (3, 4, 5)...
View Full Document

Ask a homework question - tutors are online