Guillaume Yziquel a écrit :
Hello.
Hi again.
Here is a piece of code that I am having issue. I'm trying to use React
to parse reactively a server output. I have the following event definition:
let event_starting_at str = React.E.fold begin fun accu chunk ->
accu^chunk end str received_event in let
to_be_parsed_event_of_event, set_to_be_parsed_event_of_event =
React.E.create () in
let to_be_parsed_event = React.E.switch (event_starting_at "")
to_be_parsed_event_of_event in
let reinitialise_with unparsed_text =
set_to_be_parsed_event_of_event (event_starting_at unparsed_text) in
I've replaced the previous code by the following piece of code, and it
now works...
let event_starting_at ?drop:(drop = false) str = React.E.fold begin fun accu
chunk -> accu^chunk end str
begin match drop with | false -> received_event | true -> React.E.drop_once received_event end in
let to_be_parsed_event_of_event, set_to_be_parsed_event_of_event = React.E.create () in
let to_be_parsed_event = React.E.switch (event_starting_at "")
to_be_parsed_event_of_event in
let reinitialise_with unparsed_text = set_to_be_parsed_event_of_event
(event_starting_at ~drop: true unparsed_text) in
Now, is this a bug or a feature?
All the best,
Guillaume Yziquel.
--
Guillaume Yziquel
http://yziquel.homelinux.org/
_______________________________________________
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