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 8F2BE7EE0C for ; Wed, 28 Nov 2012 18:37:40 +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: AiABANRKtlBKfVK2kGdsb2JhbABFwA4IFg4BAQEBCQkNBxQEI4IeAQEFQAEbHQEDDAYFCw0uIQEBEQEFARwGEwiHdAEDD6A6jDOCeoUCChknDVmIdQEFDItKaYRBA5JPgV2BVYlKgWqDMBYphBI X-IronPort-AV: E=Sophos;i="4.84,179,1355094000"; d="scan'208";a="183675931" 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 18:37:40 +0100 Received: by mail-we0-f182.google.com with SMTP id u54so7753988wey.27 for ; Wed, 28 Nov 2012 09:37:40 -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=7DvCPI99VRRd/XkenWUAHLHQKsh45q7QbDkG9Oz/jB4=; b=zmVjEjQtZY0MLXPNjYIt09eWhC/6e6RAZF2A/e5LCwZsSTO8HcDhSgGPky3TRbv/uh E+HZXXgVLFFqFjqN9qQNzyIxwnbhzFk6ENoUGjbKs+0Zh1wzlmbZZ/SIEGa4LrfWXvWW TkpksAja7UXUIiAsA/OCl6YJixCueIQ0qxFidAdKr7c+n2OabxSN/DfHADOguXtnBRXP in/uPxuJ4ZIfxJrPa4Sh58RjZDN9ki07M77VKELq+dilqv4RxY+avoZJ8Osd9hI8lMjS 7jhUCZDRAVtrP7Qi/4jQiPaPc9GZifQy7JdEVVGiZQQF1Wi1N6AqKd2Myh1aTumwxx0S FKIg== Received: by 10.180.109.132 with SMTP id hs4mr30877293wib.1.1354124260068; Wed, 28 Nov 2012 09:37:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.113.73 with HTTP; Wed, 28 Nov 2012 09:37:19 -0800 (PST) In-Reply-To: References: <50B595A4.50402@wwayneb.com> From: Lukasz Stafiniak Date: Wed, 28 Nov 2012 18:37:19 +0100 Message-ID: To: Gabriel Scherer Cc: caml users Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] List.fold_left vs. Hashtbl.fold On Wed, Nov 28, 2012 at 6:25 PM, Gabriel Scherer wrote: > > This means that fold_left may not exist for arbitrary data structure > (think of binary trees), while fold_right is rather universal. Other > folding functions in the standard library (in Set and Map in > particular, but in Hashtbl as well) have therefore taken inspiration > from the fold_right structure, rather than fold_left. This is right, you get my "upvote". But Set and Map do not intend to expose the structure of the underlying data structure to the folding computation. The folds of Set and Map traverse the elements in a sequential order. They could be a deforested variant of List.fold_left composed with Set.elements.