Browse thread
Re: [Caml-list] Queue.fold give wrong order?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2010-01-19 (15:53) |
From: | |
Subject: | Re: [Caml-list] Queue.fold give wrong order? |
Hi, From: Tom Wilkie <tom@acunu.com> Date: Tue, 19 Jan 2010 15:10:43 +0000 > 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? It's already the case. > # Queue.fold (fun acc a -> a::acc) [] q;; > - : int list = [3; 2; 1] Your (fun acc a -> a::acc) is first called with args [] and 1, and yields a next value for accu of [1]; and so on. HTH, Bruno.