CSC448: Type Checking Revisited: Example Program [117/133] Previous pageContentsNext page

An example program that uses take at two different types:

let take = 
  fun f i => 
    fun g xs => 
      if (is_zero (i)) then
        []
      else
        cons (head (xs)) (f (i - 1) (tail (xs)))
in
  (length (take 2 ["a", "b", "c"])) + (length (take 1 [1, 2, 3]))
        

Previous pageContentsNext page