From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 EB261BC37 for ; Wed, 9 Dec 2009 19:24:30 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvYCAEt6H0tV2gB5h2dsb2JhbACEJpRdgl0BAQEKCwgHFasjkCOBL4IqUwSDF4YA X-IronPort-AV: E=Sophos;i="4.47,369,1257116400"; d="scan'208";a="51813534" Received: from emailfrontal2.citycable.ch ([85.218.0.121]) by mail4-smtp-sop.national.inria.fr with SMTP; 09 Dec 2009 19:24:30 +0100 Received: from [192.168.0.12] (unknown [85.218.92.99]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal2.citycable.ch (Postfix) with ESMTPA id D2526B1044F; Wed, 9 Dec 2009 19:24:06 +0100 (CET) Message-ID: <4B1FEB40.5050801@citycable.ch> Date: Wed, 09 Dec 2009 19:24:00 +0100 From: Guillaume Yziquel Reply-To: guillaume.yziquel@citycable.ch User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707) MIME-Version: 1.0 To: =?UTF-8?B?RGFuaWVsIELDvG56bGk=?= Cc: OCaml List Subject: Re: Recursion on React.events. References: <4B1F0E3A.3040907@citycable.ch> <91a3da520912082353m5c75f307j6f9542877d84841f@mail.gmail.com> In-Reply-To: <91a3da520912082353m5c75f307j6f9542877d84841f@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; guillaume:01 guillaume:01 recursion:01 semantics:01 combinators:01 notations:01 semantics:01 val:01 typing:01 define:02 define:02 confusing:02 dependence:03 module:03 module:03 Daniel B=C3=BCnzli a =C3=A9crit : >> Daniel B=C3=BCnzli's module is great, but sometimes a bit rough >> to get by, specifically on examples such as this one. >=20 > I would just like to point out that this has nothing to do with the > module per se but understanding frp in general and this is the reason > why I went to great length to document the semantics for each of the > combinators I provide --- something most frp libraries won't bother to > do, leaving you with testing or looking into the implementation for > understanding things when tricky simulateneity issues arise. I appreciate the documentation effort you put up. Really. > Thus to understand why your event didn't work you could have done the > following. Provided you understand the notations given here : >=20 > http://erratique.ch/software/react/doc/React#sem I do. I've done quite a lot of maths after all, and this doesn't=20 frighten me. > Since we have [schedule st]_st =3D Some (), by the semantics of E.map w= e > have [ee]_st =3D Some ev. Thus we are in the second case of the semanti= cs > of E.switch (see doc) and the semantics of the switch reduces to the > semantics of ev, i.e. Maybe I was looking in the wrong place, but I haven't found "the second=20 case of the semantics of E.switch" on your website. In fact, the way I=20 learned about React.E.switch was from the .mli-style webpage on your=20 website, and by trial and error. > Pure equational reasoning, it's not that hard, or is it ? Less than semi-algebraic geometry. More seriously, the point was not understanding why it failed. I came to=20 the same conclusions from empirical evidence. The point was how to=20 overcome it. And while I do not doubt that your documentation is rather explicit, I=20 was nevertheless confused by your fixed point operators, and thus rather=20 reluctant to use them. The example on your website: > let history ?(eq =3D ( =3D )) s =3D=20 > let push v =3D function=20 > | [] -> [ v ]=20 > | v' :: _ as l when eq v v' -> l > | l -> v :: l =20 > in > let define h =3D=20 > let h' =3D S.l2 push s h in=20 > h', h' > in > S.fix [] define One thing that really troubles me, is that I do not understand why=20 define returns a couple of two identical element. And the typing of=20 E.fix is rather confusing: > val fix : ('a React.event -> 'a React.event * 'b) -> 'b Why do we return a 'b type with E.fix? While the webpage mentions this dependence on the value at t-dt, it's=20 quite hard to infer from the use of the fix point operator in the=20 example how it's really supposed to behave and to be called. Clarifying these issues would be welcome. All the best, --=20 Guillaume Yziquel http://yziquel.homelinux.org/