This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: case lst of => | fst::rest => if f fst then fst::(filter (f,rest)) else filter (f,rest) fun is_even v = (v mod 2 = 0) fun get_all_even lst = filter(is_even,lst) fun get_all_even_snd lst = filter((fn (_,v) => is_even v), lst) val get_all_even_snd2 = fn lst => filter((fn (s,v) => v mod 2 = 0), lst) fun double_or_triple f = if f 7 then fn x => 2*x else fn x => 3*x datatype exp = Constant of int | Negate of exp | Add of exp * exp fun true_of_all_constants(f,e) = case e of Constant i => f i | Negate e1 => true_of_all_constants(f,e1) | Add(e1,e2) => true_of_all_constants(f,e1) andalso true_of_all_constants(f,e2) fun all_even e = true_of_all_constants(is_even,e)...
View Full Document
This note was uploaded on 10/12/2009 for the course CSE 341 taught by Professor Staff during the Spring '08 term at University of Washington.
- Spring '08