전체 글 썸네일형 리스트형 Ocaml Quiz 2009 240040 Topics on Compiler Construction Quiz #1 Name : 박용준 1. Define the test whether a list is empty. # let empty = function [] -> true | _ -> false;; val empty : 'a list -> bool = # empty [1; 2; 3];; - : bool = false # empty [];; - : bool = true 2. Define a function sum that takes an integer list and returns the sum of all elements from it. # let rec sum l = match l with [] -> 0 | h::t -> h + s.. 더보기 이전 1 ··· 38 39 40 41 42 43 44 ··· 100 다음