lab - let rec addList (l:int list) = match l with...

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

View Full Document Right Arrow Icon
let add (x:int) (y:int) = x + y;; let mean (x:int) (y:int) = let sum = x + y in sum/2;; let rec fact (n:int) = if (n = 0) then 1 else n*fact(n-1);; let rec pow (x:int) (y:int) = if (y = 0) then 1 else if (y/2 = (y-1)/2) then x*(pow x (y-1)) else pow (x*x) (y/2);;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: let rec addList (l:int list) = match l with -> 0 | h::t -> h + addList(t);; let revList (l:int list) = let rec helper (l1:int list) (l2:int list) = match l1 with -> l2 | h::t -> helper t (h::l2) in helper l ;;...
View Full Document

This note was uploaded on 10/25/2009 for the course PHYS 2214 at Cornell University (Engineering School).

Ask a homework question - tutors are online