Dear all
Is Queue.fold going over items in the wrong order? It says "equivalent to
List.fold_left" but I would expect the behaviour to be, when inserting items 1,
then 2, then 3 a fold would be given items in that order?
Is there a good reason for this? Could be have a rev_fold for the opposite
order please?
Thanks
Tom
# ocaml
Objective Caml version 3.10.2
# open Queue;;
# let q = Queue.create ();;
val q : '_a Queue.t = <abstr>
# Queue.add 1 q;;
- : unit = ()
# Queue.add 2 q;;
- : unit = ()
# Queue.add 3 q;;
- : unit = ()
# Queue.fold (fun acc a -> a::acc) [] q;;
- : int list = [3; 2; 1]
# Queue.iter (fun a -> print_endline (string_of_int a)) q;;
1
2
3
- : unit = ()
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs