caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hugo Ferreira <hmf@inescporto.pt>
To: Vincent Aravantinos <vincent.aravantinos@yahoo.fr>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Functional design for a basic simulation pipe.
Date: Wed, 10 Oct 2007 11:56:02 +0100	[thread overview]
Message-ID: <470CAFC2.2020406@inescporto.pt> (raw)
In-Reply-To: <3EDA3D93-DE9A-4336-B65E-03593A3B9723@yahoo.fr>

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
> 
> 


  reply	other threads:[~2007-10-10 10:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-10  7:39 Hugo Ferreira
2007-10-10  8:34 ` [Caml-list] " skaller
2007-10-10 10:08   ` Hugo Ferreira
2007-10-10 10:31     ` Vincent Aravantinos
2007-10-10 10:56       ` Hugo Ferreira [this message]
2007-10-11 12:01         ` Pietro Abate
2007-10-11 13:52           ` Hugo Ferreira
2007-10-11 14:20             ` Pietro Abate
2007-10-10 15:00     ` skaller
2007-10-10 15:56       ` skaller
2007-10-11  6:57         ` Hugo Ferreira
2007-10-11  8:09           ` skaller
2007-10-11  9:54             ` Hugo Ferreira
2007-10-11 13:47               ` skaller
2007-10-11 11:17 ` Zheng Li
2007-10-11 13:48   ` [Caml-list] " Hugo Ferreira
2007-10-15 23:04     ` Zheng Li
2007-10-22  7:48       ` [Caml-list] " Hugo Ferreira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=470CAFC2.2020406@inescporto.pt \
    --to=hmf@inescporto.pt \
    --cc=caml-list@yquem.inria.fr \
    --cc=vincent.aravantinos@yahoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).