As both functions are working different, I,think from some reasoing about it, it might become logical ....

http://www.cs.cornell.edu/courses/cs3110/2011sp/recitations/rec05.htm

Even there is explained how which functionsmlooks like if implemented,
the reason is not obvious.
I think there might be a logical explanation for this,
but to be honest I also have no handy rule of thumb for it.

But both functions look different in the application of the non-tail argument,
so I think this is  the reason for it (if not by accident;-))

If you find an easy way to remember it from the above mentioned doc, please let me know.
athe üroblem there in the doc is, that the program structure is cluttered by type annotations.

But maybe writng down how an application would look like,
applying the function by hand, would offer the mysteries.

I just was to lazy for this until now, and just accepted the order.
So I also need to look up the order in the manual.

But from the different non-tail part of the functions I would think, it is possible to find a reason.
After you find it, you maybe dont want to have a unified API ;-)

Ciao,
   Oliver


Am 28.11.2012 um 05:40 schrieb William Smith <bills@wwayneb.com>:

List.fold_left expects the List as the 3rd parameter with the second parameter being the initial value.

Hashtbl.fold expects the Hasthbl as the second parameter with the 3rd parameter being the initial value... just the opposite of List.fold_left.

Is there a reason for this difference?   I'm having trouble remembering which goes which way.   If it's not a historical accident, I'd like to have a understanding of why they are different to help me know which is which.

Thanks,

Bill

--
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs