Bug#327211: Wrong order in Map.fold
Package: ocaml-nox
Version: 3.08.3-7
Severity: normal
File: /usr/bin/ocamlc
falk@juist:/tmp% cat test.ml
module IntMap = Map.Make(struct type t = int let compare = compare end);;
let make_set = List.fold_left (fun s x -> IntMap.add x 0 s) IntMap.empty;;
let () =
let s = make_set [23; 17; 616]
in
IntMap.fold (fun x _ () -> Printf.printf "%d\n" x) s ()
;;
falk@juist:/tmp% ocamlc test.ml && ./a.out
616
23
17
However, the manual says (and I would expect) that keys are enumerated
in *increasing* order. Map.iter is correct in this regard.
Falk
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: alpha
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11.3
Locale: LANG=C, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)
Versions of packages ocaml-nox depends on:
ii emacsen-common 1.4.16 Common facilities for all emacsen
ii libncurses5-dev 5.4-9 Developer's libraries and docs for
ii ocaml-base-nox [ocaml-base-no 3.08.3-7 Runtime system for ocaml bytecode
ii ocaml-interp [ocaml-interp-3. 3.08.3-7 Ocaml interpreter and standard lib
Versions of packages ocaml-nox recommends:
ii file 4.12-1 Determines file type using "magic"
pn ledit <none> (no description available)
-- no debconf information
Reply to: