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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 672D9BC37 for ; Thu, 10 Dec 2009 05:16:52 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiEBAAoFIEvRVdvWkGdsb2JhbACEJZcAPwEBAQEJCQwHEwOpCIFZhU+IaQECAwWBKoIqUwSCfIgqgXs X-IronPort-AV: E=Sophos;i="4.47,372,1257116400"; d="scan'208";a="38329845" Received: from mail-ew0-f214.google.com ([209.85.219.214]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Dec 2009 05:16:52 +0100 Received: by ewy6 with SMTP id 6so2737057ewy.9 for ; Wed, 09 Dec 2009 20:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=Y1hblm/Wt4jgs0b0smFloJe3YCVq98hXOOmnni8PJfo=; b=s9k6N5+HP670n/6HqwB3qb0EmquWVO+WiGYS30OcZElaajLFA22CQg03F6V03S/6uP w0iI1ZXb8pP9HpEwri8mCb51/2dMZ3OjUadQEbxEVVsk5rfgFF0SYoyWSikl0OCS9v93 LWAVNwmcJD0zKUgKeollJNgtWwycAWWzngT4g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=BheiT0i6b+yDSZWFfIebTMmoirmF9dT7MSlqmQdp6hum3NYw1t88FvNSh3ZliEUiFJ IQ46slAOLqJV8iFZnl35h9lx38ayZVqLX9gQNabb4+vVyQgC8rHs8/4Jt8bQDKM2lM5C 1qzg4dpTj6AccvtONpkKc4RdNzgWyKK/ZAP3A= MIME-Version: 1.0 Sender: daniel.c.buenzli@gmail.com Received: by 10.213.0.139 with SMTP id 11mr2021863ebb.36.1260418611764; Wed, 09 Dec 2009 20:16:51 -0800 (PST) In-Reply-To: References: <91a3da520912090843n451b5592x27105b353ef7c65b@mail.gmail.com> Date: Thu, 10 Dec 2009 12:16:51 +0800 X-Google-Sender-Auth: 44f26959b6ee0c4c Message-ID: <91a3da520912092016g58f320as79561ae722b3fb61@mail.gmail.com> Subject: Re: more on frp (was Re: [Caml-list] Re: Recursion on React.events) From: =?UTF-8?Q?Daniel_B=C3=BCnzli?= To: Aaron Bohannon Cc: Richard Jones , OCaml List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; recursion:01 buenzli:01 occurences:01 'o':01 'n':01 occurences:01 semantics:01 occurence:01 semantics:01 programmi:98 caml-list:01 'g':01 'g':01 represented:02 primitive:02 > Your example perfectly illustrates what makes understanding FRP hard: > when I type the string "programming", should I expect to get a signal > with a value of "programming" or "programing"? Note, you don't get any signal here, we are talking about an _event_. So the sequence of event occurences you will see is 'p', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g'. Now if you fold over these occurences as I suggested to make a string signal, the sequence of changes in the signal you will see is "", "p", "pr", "pro", "prog", "progr", "progra", "program", "programm", "programmi", "programmin", "programming" (you could have chosen a shorter word, that was painful to write). > Signals without events have an semantics that seems straightforward > (to me). =C2=A0But I have very little intuition for events, as represente= d > by a type such as "time -> 'a option", and their conversion to and > from signals. I'm not sure but maybe your problem is just a terminology thing. Because in frp what is called an event confusignly represents many events, it represents event occurences of a kind of event (e.g. the keystrokes of a keyboard). So the function time -> 'a option returns a value if there's an occurence of the event at that time (e.g. if the user pressed a key at that time) and None otherwise. > Also, I like the idea of making different choices for what "time" is, > but doesn't the semantics of FRP depend on time being continuous? I wouldn't say it "depends", it makes you believe, that's the way you should think about when you program. But in the programming world everything is eventually discrete and your primitive input is giving the pace. Have a read at the section "Continuity" there : http://erratique.ch/software/react/doc/React#sigsem Best, Daniel