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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 261F4BBAF for ; Thu, 24 Sep 2009 10:05:59 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjYCAIPFukpV2gB4nGdsb2JhbACbAAEBAQEBCAsICRO6fIQbBQ X-IronPort-AV: E=Sophos;i="4.44,444,1249250400"; d="scan'208";a="36716892" Received: from emailfrontal1.citycable.ch ([85.218.0.120]) by mail1-smtp-roc.national.inria.fr with SMTP; 24 Sep 2009 10:05:58 +0200 Received: from [130.223.248.40] (wlb-248-40.unil.ch [130.223.248.40]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal1.citycable.ch (Postfix) with ESMTPA id EF70612C38E; Thu, 24 Sep 2009 10:05:45 +0200 (CEST) Message-ID: <4ABB2753.3090303@citycable.ch> Date: Thu, 24 Sep 2009 10:01:23 +0200 From: Guillaume Yziquel Reply-To: guillaume.yziquel@citycable.ch User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: =?UTF-8?B?RGFuaWVsIELDvG56bGk=?= Cc: caml-list@inria.fr Subject: Re: React.E.switch issue. References: <4ABB2264.1090409@citycable.ch> In-Reply-To: <4ABB2264.1090409@citycable.ch> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; guillaume:01 guillaume:01 bug:01 parsed:01 parsed:01 accu:02 accu:02 match:02 chunk:02 chunk:02 parse:02 output:02 let:03 let:03 fold:06 Guillaume Yziquel a =C3=A9crit : > Hello. Hi again. > Here is a piece of code that I am having issue. I'm trying to use React= =20 > to parse reactively a server output. I have the following event definit= ion: >=20 >> let event_starting_at str =3D React.E.fold begin fun accu chunk ->=20 >> accu^chunk end str received_event in let=20 >> to_be_parsed_event_of_event, set_to_be_parsed_event_of_event =3D=20 >> React.E.create () in >> let to_be_parsed_event =3D React.E.switch (event_starting_at "")=20 >> to_be_parsed_event_of_event in >> let reinitialise_with unparsed_text =3D=20 >> 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=20 now works... > let event_starting_at ?drop:(drop =3D false) str =3D React.E.fold beg= in fun accu chunk -> accu^chunk end str > begin match drop with | false -> received_event | true -> React.E.d= rop_once received_event end in=20 > let to_be_parsed_event_of_event, set_to_be_parsed_event_of_event =3D = React.E.create () in > let to_be_parsed_event =3D React.E.switch (event_starting_at "") to_b= e_parsed_event_of_event in > let reinitialise_with unparsed_text =3D set_to_be_parsed_event_of_eve= nt > (event_starting_at ~drop: true unparsed_text) in Now, is this a bug or a feature? All the best, Guillaume Yziquel. --=20 Guillaume Yziquel http://yziquel.homelinux.org/