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 1D18D7EE0C for ; Wed, 28 Nov 2012 17:25:48 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of mmatalka@gmail.com) identity=pra; client-ip=74.125.83.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of mmatalka@gmail.com designates 74.125.83.54 as permitted sender) identity=mailfrom; client-ip=74.125.83.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ee0-f54.google.com) identity=helo; client-ip=74.125.83.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="postmaster@mail-ee0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlgBAD46tlBKfVM2kGdsb2JhbABFrVqJOgGIeQgWDgEBAQEJCQ0HFAQjgh4BAQQBQAEbEgsBAwELBgUEBwMKDSEhAQERAQUBChIGExKHagEDCQYMoC6MM4J6hQgKGScDClmIdQEFDItKaYRBA5QsgVWBHIgugWqDMBYphBI X-IronPort-AV: E=Sophos;i="4.84,179,1355094000"; d="scan'208";a="164105939" Received: from mail-ee0-f54.google.com ([74.125.83.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 28 Nov 2012 17:25:47 +0100 Received: by mail-ee0-f54.google.com with SMTP id c13so11801641eek.27 for ; Wed, 28 Nov 2012 08:25:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=GCajE9rD1YTdJKdUaKWu9mIFRL85TK/lXxSjCELs4GA=; b=cS/L1lyw3RYzf/b9HMasO4JthWfrxI6AmCfhKHLgYJbaK5cVpPhLD+i2rUEoqvNvCH KT8DxBcOw9B4GtxG/IWeDKezjx3I5/wiH28zXYgSj/7PhfT8wl7M3FKKU8dZIu2YTLkf Y/hWVCImaw4wJFEQJ/R0u4pSD1HCfqGcC1umjAqExSjymq2fVdjeBZ74SOROIv7bR/bB WYrxULG27OSbppkqAkd3wCqa9WGRbCkMkvHO8TeX3nOlITW2cI3DcLuCujt6oOZWlOK8 Ui8i6xT1GtVU3B+2Wxvnxt52hd8slZsT6zi+sXa5I7lUzofjFTm4iObrbEKhr86tDvcC vSPQ== MIME-Version: 1.0 Received: by 10.14.215.194 with SMTP id e42mr38584023eep.32.1354119946758; Wed, 28 Nov 2012 08:25:46 -0800 (PST) Received: by 10.223.74.204 with HTTP; Wed, 28 Nov 2012 08:25:46 -0800 (PST) Received: by 10.223.74.204 with HTTP; Wed, 28 Nov 2012 08:25:46 -0800 (PST) In-Reply-To: References: <50B595A4.50402@wwayneb.com> Date: Wed, 28 Nov 2012 17:25:46 +0100 Message-ID: From: Malcolm Matalka To: Lukasz Stafiniak Cc: OCAML , William Smith Content-Type: multipart/alternative; boundary=e89a8f923f5068e8fb04cf909e26 Subject: Re: [Caml-list] List.fold_left vs. Hashtbl.fold --e89a8f923f5068e8fb04cf909e26 Content-Type: text/plain; charset=ISO-8859-1 Jane St Core uses labeled arguments to avoid this issue, worth considering if you can. On Nov 28, 2012 5:18 PM, "Lukasz Stafiniak" wrote: > I have this problem too. Look _very closely_ at List.fold_left and > List.fold_right. Hashtbl.fold should pretend to be like > List.fold_left, because it is not supposed to preserve the structure > of the underlying data structure in its computation, and it should be > tail-recursive. > > On Wed, Nov 28, 2012 at 5:40 AM, William Smith wrote: > > 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 > --e89a8f923f5068e8fb04cf909e26 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Jane St Core uses labeled arguments to avoid this issue, worth consideri= ng if you can.

On Nov 28, 2012 5:18 PM, "Lukasz Stafiniak&= quot; <lukstafi@gmail.com> = wrote:
I have this problem too. Look _very closely_ at List.fold_left and
List.fold_right. Hashtbl.fold should pretend to be like
List.fold_left, because it is not supposed to preserve the structure
of the underlying data structure in its computation, and it should be
tail-recursive.

On Wed, Nov 28, 2012 at 5:40 AM, William Smith <bills@wwayneb.com> wrote:
> 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<= br> > parameter being the initial value... just the opposite of List.fold_le= ft.
>
> Is there a reason for this difference? =A0 I'm having trouble reme= mbering
> which goes which way. =A0 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 whi= ch.
>
> Thanks,
>
> Bill

--
Caml-list mailing list. =A0Subscription management and archives:
ht= tps://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
--e89a8f923f5068e8fb04cf909e26--