Browse thread
Functional design for a basic simulation pipe.
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | skaller <skaller@u...> |
| Subject: | Re: [Caml-list] Functional design for a basic simulation pipe. |
On Wed, 2007-10-10 at 08:39 +0100, Hugo Ferreira wrote: > # let exp = gen_events |> gen_states |> analyze_data |> check_stop ;; > val exp : '_a -> unit = <fun> > > And execute it so: > > # let start_state = () ;; > val start_state : unit = () > > # let _ = exp start_state ;; > - : unit = () > My question is: how can one design and implement such a "pull pipe" and > solve the problem I have of propagating state back to a previous > function. Assume f : state_t -> state_t option is your state transformer, then let rec go state = match f state with | Some state -> go state | None -> () will do it. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net