Loading ...
Sorry, an error occurred while loading the content.

2315set_map

Expand Messages
  • dvanhorn_at_uvm
    Jul 1, 2004
    • 0 Attachment
      Could someone tell what is wrong with this code. I would expect the
      result to be [2]. Thanks -- David

      module IntSet =
      Set.Make(struct type t = int let compare = compare end)
      open IntSet
      let set_map f = fold (fun x s -> (add (f x) s)) empty

      elements (set_map ((+) 1) (singleton 1))
      - : IntSet.elt list = [1]
    • Show all 3 messages in this topic