From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 07C217EE0C for ; Wed, 28 Nov 2012 17:42:10 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of oliver@first.in-berlin.de) identity=pra; client-ip=192.109.42.8; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="oliver@first.in-berlin.de"; x-sender="oliver@first.in-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of oliver@first.in-berlin.de) identity=mailfrom; client-ip=192.109.42.8; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="oliver@first.in-berlin.de"; x-sender="oliver@first.in-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@einhorn.in-berlin.de) identity=helo; client-ip=192.109.42.8; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="oliver@first.in-berlin.de"; x-sender="postmaster@einhorn.in-berlin.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiIBAPo9tlDAbSoIhWdsb2JhbABFgkmDYacwiToBiBloFg4BAQEKCwsbBCOCHgEBBAEjSwsFCwsOFx0CAkUSBhMSh2sDCQYECKwXiRgDiV6MP4MuMmEDkk+DMoEchE+DX4lr X-IronPort-AV: E=Sophos;i="4.84,179,1355094000"; d="scan'208,217";a="164108016" Received: from einhorn.in-berlin.de ([192.109.42.8]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 Nov 2012 17:42:09 +0100 X-Envelope-From: oliver@first.in-berlin.de Received: from [192.168.1.100] (e178037073.adsl.alicedsl.de [85.178.37.73]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id qASGg7Kg014359 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 28 Nov 2012 17:42:07 +0100 References: <50B595A4.50402@wwayneb.com> In-Reply-To: <50B595A4.50402@wwayneb.com> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: 7bit Content-Type: multipart/alternative; boundary=Apple-Mail-6F315BDE-9483-45BA-82CB-6FAC38CC42E9 Message-Id: <912CF782-0FD9-45D6-A6A5-2F9F50702567@first.in-berlin.de> Cc: OCAML X-Mailer: iPad Mail (10A523) From: Oliver Bandel Date: Wed, 28 Nov 2012 17:42:07 +0100 To: William Smith X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 Subject: Re: [Caml-list] List.fold_left vs. Hashtbl.fold --Apple-Mail-6F315BDE-9483-45BA-82CB-6FAC38CC42E9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable As both functions are working different, I,think from some reasoing about i= t, 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 argume= nt, 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 =C3=BCroblem there in the doc is, that the program structure is clutte= red 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 : > List.fold_left expects the List as the 3rd parameter with the second para= meter being the initial value. >=20 > Hashtbl.fold expects the Hasthbl as the second parameter with the 3rd par= ameter being the initial value... just the opposite of List.fold_left. >=20 > Is there a reason for this difference? I'm having trouble remembering w= hich 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. >=20 > Thanks, >=20 > Bill >=20 > --=20 > 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 --Apple-Mail-6F315BDE-9483-45BA-82CB-6FAC38CC42E9 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
As both functions are working different, I,think from some reasoin= g about it, it might become logical ....


Even there is explained how which functionsmlooks = like if implemented,
the re= ason is not obvious.
I thin= k there might be a logical explanation for this,
but to be honest I also have no handy rule of thumb f= or it.

But both functions look different in the a= pplication 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 =C3=BCroblem there in the doc is, that the program stru= cture is cluttered by type annotations.

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

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

B= ut from the different non-tail part of the functions I would think, it is p= ossible to find a reason.
A= fter you find it, you maybe dont want to have a unified API ;-)

Ciao,
 =  Oliver


Am 28.11.2012 = um 05:40 schrieb William Smith <bil= ls@wwayneb.com>:

List.fold_left expects the= List as the 3rd parameter with the second parameter being the initial valu= e.

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

Is there a r= eason 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 wh= ich.

Thanks,

Bill

--
Caml-list mai= ling list.  Subscription management and archives:
https://sympa.inria.fr/s= ympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_= beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
= --Apple-Mail-6F315BDE-9483-45BA-82CB-6FAC38CC42E9--