From: Vincenzo Ciancia <vincenzo_mlRE.MOVE@yahoo.it>
To: caml-list@inria.fr
Cc: bcpierce@cis.upenn.edu
Subject: Re: [Caml-list] Re: Functional Reactive Programming in OCaml?
Date: Tue, 30 Nov 2004 18:33:30 +0100 [thread overview]
Message-ID: <200411301833.31143.vincenzo_mlRE.MOVE@yahoo.it> (raw)
In-Reply-To: <13110.1101783772@dsl-207-245-69-66.cust.oldcity.dca.net>
On Tuesday 30 November 2004 04:02, Benjamin Pierce wrote:
> The common idea in these systems is to introduce an abstraction of
> "signals" -- roughly, functions from time to "values", where the
> values can be anything from real numbers (conventional
> signal-processing-type signals) to two- or three-dimensional
> pictures, to booleans (representing events). What's special is that
> time is represented as a continuous, real-number quantity. They do
> all kinds of work behind the scenes to actually compute with
> behaviors, but what shows through in the API is a very simple,
> elegant, and powerful set of primitives that can be combined in
> straightforward ways to achieve very complex effects.
I am surely not an expert on the subject, but I tried this at home in a
student project at university. I wrote a library for composition of
monomorphic signal functions. It was just a simple attempt but I found
two things:
1. arrow composition in haskell can be very efficient - you usually
implement your actions in terms of IO actions, and IO actions
composition is _I suppose_ optimized somewhat by the compiler, e.g.
inlining functions as needed to form a bigger code block. However you
can compose as many arrows as you want without degrading performance.
Parallel or sequential arrow composition in ocaml will certainly involve
- as in the haskell implementation - something "like" function
composition, and this will result in efficiency proportional to the
number of functions involved, which is unwanted. The performance gap
between an event-based loop and "fran-like" code is discouraging for
this reason. But you could generate bytecode at runtime and avoid this
problem (and even beat haskell to please your language envy :)). I
would seriously consider the second alternative if I had the time to
work on it.
2. you are sometimes constrained to reveal implementation of your arrows
when implementing composition, due to the value restriction - you
certainly know this better than me, and I couldn't explain this
anymore, the search function on the mailing list archives is not
working or else I'd find an example I posted years ago and forgot
about :) If you are interest I'll download the raw archives and find
it.
Hope this helps - I would be interested in an implementation of FRAN for
ocaml even if I am not so sure that I might be of any help.
Vincenzo
next prev parent reply other threads:[~2004-11-30 17:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-29 0:44 Benjamin Pierce
2004-11-29 18:02 ` [Caml-list] " james woodyatt
2004-11-30 3:02 ` Benjamin Pierce
2004-11-30 17:33 ` Vincenzo Ciancia [this message]
2004-12-01 17:14 ` [Caml-list] " Florian Hars
2004-12-02 8:04 ` Vincenzo Ciancia
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=200411301833.31143.vincenzo_mlRE.MOVE@yahoo.it \
--to=vincenzo_mlre.move@yahoo.it \
--cc=bcpierce@cis.upenn.edu \
--cc=caml-list@inria.fr \
/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).