caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Zheng Li <zheng_li@users.sourceforge.net>
To: Dawid Toton <dawid.toton@uj.edu.pl>
Cc: caml-list@yquem.inria.fr
Subject: Re: 'Nondeterministic' evaluation wrt exceptions
Date: Fri, 25 Jul 2008 22:31:39 +0200	[thread overview]
Message-ID: <488A382B.6050303@users.sourceforge.net> (raw)
In-Reply-To: <488A2988.3070402@uj.edu.pl>

Hi,

Dawid Toton wrote:
> Thank you all for quick answers!
> 
> Let me show an example of what I exactly mean. I start with a code:
> 
> 1: let a = heavy 1
> 2: let b = heavy 2
> 3: let c = report (a + b)
> 4: let d = heavy 4
> 5: let e = heavy d
> 
> Then I want to translate it automatically so that three applications of
> heavy are evaluated (lines 1, 2, 4). The addition a + b won't be
> evaluated untill a and b are successfully returned.

I'm not clear about what you want. It seems that you're doing 
asynchronous parallel programming.

I have a Async library, which is not yet released (needs polish). It 
allows you express the logic like

<code>
let c = Future
   { let! a = heavy 1 in
     let! b = heavy 2 in
     return (a + b) }

let e = Future
   { let! d = heavy 4 in
     heavy d }
</code>

or

<code>
let c = Future
   { let! a = spawn heavy 1 in
     let! b = spawn heavy 2 in
     return (a + b) }

let e = Future
   { let! d = spawn heavy 4 in
     spawn heavy d }
</code>

if you intend to assign specific computing unit for some heavy computation.

I hope to release it in the summer, but don't hold your breath. If 
you're in a hurry, you should turn to other libraries instead. (There 
exist a few of them doing the similar thing, but I can't remember the 
accurate information.)

HTH.

--
Zheng Li
http://www.pps.jussieu.fr/~li


      parent reply	other threads:[~2008-07-25 20:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-25 15:29 Dawid Toton
2008-07-25 15:46 ` [Caml-list] " Gabriel Kerneis
2008-07-25 16:20 ` Xavier Leroy
2008-07-25 19:29   ` Dawid Toton
2008-07-25 20:10     ` Christophe TROESTLER
2008-07-25 20:31     ` Zheng Li [this message]

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=488A382B.6050303@users.sourceforge.net \
    --to=zheng_li@users.sourceforge.net \
    --cc=caml-list@yquem.inria.fr \
    --cc=dawid.toton@uj.edu.pl \
    /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).