From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 32F297EE0D for ; Wed, 28 Nov 2012 17:21:07 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dhouse@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of dhouse@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.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@tot-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="postmaster@tot-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjIBAB85tlAmacjlmWdsb2JhbABFrVqSMx4OAQEBAQEICwsHFCeCHgEBBUABASwLAQ8LCwMKDSEiEgEFAQoSBhMICodrAw8DCaApinSEOQEFhUwDiVgGjD+EQZYEgRyILoUaFimEEQ X-IronPort-AV: E=Sophos;i="4.84,179,1355094000"; d="scan'208";a="164105528" Received: from mx5.janestreet.com (HELO tot-dmz-mxout1.janestreet.com) ([38.105.200.229]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 Nov 2012 17:21:06 +0100 Received: from tot-smtp.delacy.com ([172.27.22.35] helo=tot-is-smtp) by tot-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1TdkNh-0007xp-Bo for caml-list@inria.fr; Wed, 28 Nov 2012 11:21:01 -0500 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-is-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1TdkNh-0004fp-95 for caml-list@inria.fr; Wed, 28 Nov 2012 11:21:01 -0500 Received: from mail-wg0-f70.google.com ([74.125.82.70]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1TdkNh-0008Cm-5K for caml-list@inria.fr; Wed, 28 Nov 2012 11:21:01 -0500 Received: by mail-wg0-f70.google.com with SMTP id ds1so10280634wgb.9 for ; Wed, 28 Nov 2012 08:21:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=609BNGxF6Z06wcwWvrddLxoRx0ujeOByKJwgwWYtpWU=; b=Ls+pOBH9/ZQfVDQMNDbRc6SA/FtxTbDZYMV2biijpiSbcZPW7aTucp5eymUcTo5eIq BP7n3hYoYML6eUcwd1Ph7ExGaQ8gG2wAI4Ab5Cu5jdL5mUaBDRHkODynQ/HPYPBDUT2p aJ3AnoQQFMfZTiPkAld8FgH8mOHBvnv0BjPyY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=609BNGxF6Z06wcwWvrddLxoRx0ujeOByKJwgwWYtpWU=; b=gZ9OBYIdLeGBCeLgQdGyMGoH+9GzG9P+kxkxuNF/wN9wmjQ4nkvGf2cSP1h2/neMzj NnAbD9XztexwE+gMMM3nrMMtmgAk6zoDXdFHc3rjM5fagl9voip5Lt3xLgJW/mYqaDyB cN20sCB9STBw44PfpDSEgRch0k7JY5e2Y1bcbK4ghH7hjv5H18iZPZU4hl4/q3eh2vWS c02z4r7tms3r7NlbIFyX6ziLtW4CnUSmCSfqKYs7KU97CDUIbhD4miilhUXRAHU13+H9 U9CjNrLrSTvpsOTqgMtCoKu64mDTI8kQSbc5mUVDy1U13yKhFwGfnE8fOb6oiCE6fYY1 X2nA== Received: by 10.204.147.25 with SMTP id j25mr5808529bkv.36.1354119660497; Wed, 28 Nov 2012 08:21:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.147.25 with SMTP id j25mr5808522bkv.36.1354119660334; Wed, 28 Nov 2012 08:21:00 -0800 (PST) Received: by 10.205.96.68 with HTTP; Wed, 28 Nov 2012 08:21:00 -0800 (PST) In-Reply-To: <50B595A4.50402@wwayneb.com> References: <50B595A4.50402@wwayneb.com> Date: Wed, 28 Nov 2012 16:21:00 +0000 Message-ID: From: David House To: William Smith Cc: OCAML Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkLXoIeu4cvg8cEiyZNNlQeFtQMvr6kUfHhpxeXXyFYFUKZaqT5i60ZIMUBqjfBoTBty8YHbJnFQkhX6Ro0FaL0JV1GWzyB2uXEXZwNIOe6/BLNv8LEC2udG7iPXRgaJ13OYJHImUnC5A4GklRTdlHE8tNLwA== Subject: Re: [Caml-list] List.fold_left vs. Hashtbl.fold This is a perfect example of why we wrote the core library: https://bitbucket.org/yminsky/ocaml-core/wiki/Home In core, most of the iteration functions take their closure argument as a labelled ~f. So you can say List.fold_left my_list ~f:my_func, or List.fold_left ~f:my_func my_list. This tiny syntactic cost allows you lay out code much more logically: sometime you have a big long list, so you don't want the name of the function lost somewhere, way down the page. Sometimes it's the other way round, and you have a bit lambda that you're folding with, but you don't want the name of the list to be some anonymous bit of text a very long way away from the word "fold". On Wed, Nov 28, 2012 at 4: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