Version française
Home     About     Download     Resources     Contact us    
Browse thread
'Nondeterministic' evaluation wrt exceptions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Zheng Li <zheng_li@u...>
Subject: Re: 'Nondeterministic' evaluation wrt exceptions
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