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.2 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id E88E4BC6B for ; Wed, 10 Oct 2007 12:56:52 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAIhMDEfAI/YBnWdsb2JhbACBWoxuAgEBCw8I X-IronPort-AV: E=Sophos;i="4.21,254,1188770400"; d="scan'208";a="17793418" Received: from ns.inescn.pt (HELO animal.inescn.pt) ([192.35.246.1]) by mail4-smtp-sop.national.inria.fr with ESMTP; 10 Oct 2007 12:56:56 +0200 Received: from localhost (localhost [127.0.0.1]) by animal.inescn.pt (8.13.8/8.13.6/9) with ESMTP id l9AAunFc028787; Wed, 10 Oct 2007 11:56:49 +0100 (WEST) X-Virus-Scanned: amavisd-new at inescporto.pt Received: from animal.inescn.pt ([127.0.0.1]) by localhost (animal.inescn.pt [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5SqMO9SeiRmp; Wed, 10 Oct 2007 11:56:15 +0100 (WEST) Received: from [194.117.30.94] (morfina.inescn.pt [194.117.30.94]) by animal.inescn.pt (8.13.8/8.13.8/26) with ESMTP id l9AAu2rG028716; Wed, 10 Oct 2007 11:56:03 +0100 (WEST) Message-ID: <470CAFC2.2020406@inescporto.pt> Date: Wed, 10 Oct 2007 11:56:02 +0100 From: Hugo Ferreira User-Agent: Thunderbird 2.0.0.6 (X11/20070806) MIME-Version: 1.0 To: Vincent Aravantinos Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Functional design for a basic simulation pipe. References: <470C8199.4080708@inescporto.pt> <1192005274.6285.4.camel@rosella.wigram> <470CA488.1070804@inescporto.pt> <3EDA3D93-DE9A-4336-B65E-03593A3B9723@yahoo.fr> In-Reply-To: <3EDA3D93-DE9A-4336-B65E-03593A3B9723@yahoo.fr> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; beginner's:01 ocaml:01 bug:01 beginners:01 wrote:01 caml-list:01 caml-list:01 functions:01 termination:01 bin:01 data:02 data:02 caml:02 caml:02 exp:02 Hello, Vincent Aravantinos wrote: > > Le 10 oct. 07 à 12:08, Hugo Ferreira a écrit : > >> Apologies for being so obtuse but I cannot to see how this solves my >> problem. Please note that I am not well versed in functional programming >> so that what I am asking may not be possible. Lets say I have a small >> pipe of 3 actions: >> >> let exp = a |> b |> c >> >> a: requires the input of a state and outputs an event >> b: requires input of a state and the event generated at that state and >> outputs processed data >> c: consumes n number elements of processed data and stops when it >> requires no more such data >> >> Note that "c" will "pull in" for example 10 states and check for >> termination, "b" will therefore need "pull in" 10 events. Each time it >> pulls in an event it generates a state. This last state must be made >> available to "a" so that it may generate its next event. >> >> The issue here is how can I implement this so that I can flexibly >> configure experiments by "constructing" a chain of actions but still be >> able to pass back the state to one of those actions. Something like: >> >> let exp = a |> b (output 1 back to a) |> c > > Just to be sure I understood well, here is a diagram: > > --> a --> b -+-------------------------------------------------> output1 > | > +--state1-> a --> b -+----------------------------> output2 > | > +-state2-> a --> b -+--------> output3 > | > ... > -> outputn > > | > | > | > V > > c > > > Do you agree with this ? (n beeing a variable of course...) Not quite. More like: (_,s0) -> a-> s0,e1 -> b -+--------------------------------------> s1 | +--s1-> a -> s1,e2 -> b-+--------------> s2 | ... -> sn | | | V c Note that "a" doesn't generates states "sn" it just passes it on. It only generates events "en". "b" simple takes a state "sn-1" and the events "en" and generates a new state "sn". > Shall c also take the states ? > Yes. But the idea is to add other functions to the "pipe" that will change states to other data types for further processing. Note also that only the last function actually knows how much data is required. > (I believe in good drawings to help finding an answer...) Well it certainly easier to express the flow of the data. > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >