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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 05FDD7EE0C for ; Wed, 28 Nov 2012 17:17:51 +0100 (CET) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of lukstafi@gmail.com) identity=pra; client-ip=74.125.82.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="lukstafi@gmail.com"; x-sender="lukstafi@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of lukstafi@gmail.com designates 74.125.82.182 as permitted sender) identity=mailfrom; client-ip=74.125.82.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="lukstafi@gmail.com"; x-sender="lukstafi@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-we0-f182.google.com) identity=helo; client-ip=74.125.82.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="lukstafi@gmail.com"; x-sender="postmaster@mail-we0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiABALU4tlBKfVK2kGdsb2JhbABFwA0IFg4BAQEBCQkNBxQEI4IeAQEFQAEbHQEDDAYFCwMKLiIBEQEFARwGEwiHdAEDD6A6jDOCeoUIChknDVmIdQEFDIwzhEEDlgGJSoUaFimEEg X-IronPort-AV: E=Sophos;i="4.84,179,1355094000"; d="scan'208";a="183662348" Received: from mail-we0-f182.google.com ([74.125.82.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 28 Nov 2012 17:17:29 +0100 Received: by mail-we0-f182.google.com with SMTP id u54so7694948wey.27 for ; Wed, 28 Nov 2012 08:17:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=25Dk8a2QUQjL5KehK23L8JEbAutBEpZVYrxzcVADBBs=; b=MY+N98CO5TPb9WbzKYmstZxL8C/q91BQwwC99wmpPROox8rdb0WIxgtFUKZUYp8y4o UDH3fiUOboGppLjGr7VNzec6aJ31X0Um1CmYA5PEdt7qXJQpk5Qz7R7rGFdZEvyqH6bz Xg/JHQdnZFr27j9Ln34WfVGT2tA1Rp5pQp0+k0DFAYqvzFd+gUOBKcSdssW8Q15EDeA3 sSpZ+3RHzfrThY/xVyvu4W8tKg3z2OU/tMFU+Pm3YgMCCfKnag+MoIbOUBmgpZ/3BCvE CYiMj1tuErBMScohdkGoxve/kVUkDNJna5zTYBLymL2C5d1251Z7hTwCFWiSrMWG1yYq s4wA== Received: by 10.180.93.40 with SMTP id cr8mr33792450wib.15.1354119449055; Wed, 28 Nov 2012 08:17:29 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.113.73 with HTTP; Wed, 28 Nov 2012 08:17:08 -0800 (PST) In-Reply-To: <50B595A4.50402@wwayneb.com> References: <50B595A4.50402@wwayneb.com> From: Lukasz Stafiniak Date: Wed, 28 Nov 2012 17:17:08 +0100 Message-ID: To: William Smith Cc: OCAML Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] List.fold_left vs. Hashtbl.fold 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