caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Aaron Bohannon <bohannon@seas.upenn.edu>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: Richard Jones <rich@annexia.org>, OCaml List <caml-list@inria.fr>
Subject: Re: more on frp (was Re: [Caml-list] Re: Recursion on React.events)
Date: Wed, 9 Dec 2009 13:33:03 -0500	[thread overview]
Message-ID: <c413fcb70912091033x43d771afl252801eceac0d272@mail.gmail.com> (raw)
In-Reply-To: <91a3da520912090843n451b5592x27105b353ef7c65b@mail.gmail.com>

On Wed, Dec 9, 2009 at 11:43 AM, Daniel Bünzli
<daniel.buenzli@erratique.ch> wrote:
>> Personally I've yet to read any comprehensible introduction to FRP.

> In fact events and signals are duals. One can be implemented in terms
> of the other (signals can be seen as the event occurences of its value changes),
> However it makes sense to keep the two concepts separate (code
> clarity, efficiency issues, semantic details with comparison).

> Suppose we want to remember the last keysym that was issued. That's a
> signal, it is defined at any point in time. For that the S.hold
> combinator can be used, it remembers the last occurence of an event :
>
>  let last_keysym = S.hold null_keysym keydown
>
> Each time keydown gets an occurence S.hold updates the signal with the
> new occurence value. null_keysym is used to initalize the signal (it
> needs a value at the time it is created and the keydown event may not
> give us one at that time).
>
> Now we would like to concatenate the stream of keychar occurences into
> a string.

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"?

Signals without events have an semantics that seems straightforward
(to me).  But I have very little intuition for events, as represented
by a type such as "time -> 'a option", and their conversion to and
from signals.

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?

 - Aaron


  reply	other threads:[~2009-12-09 18:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09 16:43 Daniel Bünzli
2009-12-09 18:33 ` Aaron Bohannon [this message]
2009-12-10  4:16   ` Daniel Bünzli
2009-12-10  5:01     ` Aaron Bohannon
2009-12-12 15:04 ` Rich Neswold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c413fcb70912091033x43d771afl252801eceac0d272@mail.gmail.com \
    --to=bohannon@seas.upenn.edu \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    --cc=rich@annexia.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).