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

2316Re: set_map

Expand Messages
  • dvanhorn_at_uvm
    Jul 1, 2004
    • 0 Attachment
      --- In ocaml_beginners@yahoogroups.com, "dvanhorn_at_uvm" <david@v...>
      wrote:
      > 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]

      Dumb question. Sorry for the noise. I had the order of parameters to
      fold switched up.

      David
    • Show all 3 messages in this topic