From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 27E06BBAF for ; Sat, 20 Dec 2008 11:53:57 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.36,254,1228086000"; d="scan'208";a="20642454" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 20 Dec 2008 11:53:56 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id mBKArtfq009719 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 20 Dec 2008 11:53:56 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AocBANNdTEnUGyoblGdsb2JhbACTZgEBAQEJCwgJEQOoC1iQboME X-IronPort-AV: E=Sophos;i="4.36,254,1228086000"; d="scan'208";a="20642446" Received: from smtp1-g19.free.fr ([212.27.42.27]) by mail3-smtp-sop.national.inria.fr with ESMTP; 20 Dec 2008 11:53:26 +0100 Received: from smtp1-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp1-g19.free.fr (Postfix) with ESMTP id 85E5B1AB2C5; Sat, 20 Dec 2008 11:53:25 +0100 (CET) Received: from [192.168.17.1] (ivr94-8-88-162-26-239.fbx.proxad.net [88.162.26.239]) by smtp1-g19.free.fr (Postfix) with ESMTP id ACF641AB2CE; Sat, 20 Dec 2008 11:53:24 +0100 (CET) Message-ID: <494CCEBE.2020900@users.sourceforge.net> Date: Sat, 20 Dec 2008 11:53:50 +0100 From: Zheng Li User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: Alexy Khrabrov Cc: =?ISO-8859-1?Q?Mikkel_Fahn=F8e_J=F8rgensen?= , OCaml Subject: Re: prelude.ml as another standard extension to Pervasives? References: <1229719052.494c060c9d36d@webmail.in-berlin.de> <20081219212747.GA30594@annexia.org> <3a360f590812191403g504f1a5fk815cce99a4bb1101@mail.gmail.com> <20081219224750.GB350@annexia.org> <80E84DC1-2AA5-4011-9528-D3BCA2DC88F9@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 494CCEC3.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; pervasives:01 parallelism:01 low-level:01 toplevel:01 val:01 combinators:01 idioms:01 pervasives:01 haskell's:01 lib:01 haskell:01 combinators:01 no-brainer:98 shorthand:98 sourceforge:01 Hi, Alexy Khrabrov wrote: > I agree its solution to parallelism via a simple forking map/reduce is > not universal, but in fact I am wondering about having other functional coThreads is comparatively low-level. You might be able to write your own schedule on top of it. A no-brainer pmap can be defined as follows: Toplevel trace: ---- # :load unix.cma;; # :path +process;; # :load cothreads.cma;; # let pmap f a = let ea = Array.map (Cothread.spawn f) a in Array.map Event.sync ea;; val pmap : ('a -> 'b) -> 'a array -> 'b array = # pmap ((+) 1) (Array.init 10 (fun i -> i));; - : int array = [|1; 2; 3; 4; 5; 6; 7; 8; 9; 10|] ---- > combinators available in shorthand. Prelude.ml is a > superb crash course in FP, and in fact I catch myself reinventing these > idioms ad hoc quite often. I'm very tempted to just include it always, > making it my own Pervasives. Maybe you should also look at some of Haskell's standard lib. Pros: Haskell guys are really good at naming; Cons: costs are always hidden and combinators composition can be terse. Just my 2 cents. -- Zheng