I'm supposed to be writing, but...

Published 19 March 08 04:38 AM | llangit 

Apologies in advance to Don Syme here.  I'm weak, and easily distracted. F# is my muse.

let WriteChaptersAsync (x) =
     async { use someBrain = Brain.OpenAndThink(sprintf "getIt.tmp" x)
     let! ideas = someBrain.ReadAsync(thoughts)
     let  ideas' = TransformIntoParagraphs(pages,x)
     use outStream = Brain.OpenAndWrite(sprintf "gotIt.done" x)
     do! outStream.WriteAsync(ideas')  }

let WriteChaptersAsync ( ) =
     printfn "WriteChatpersAsync...";
     let tasks = [ for x in 1 ..numPages -> WriteChaptersAsync(x) ]

     //realistically using Async.Future here, or maybe Async.Spawn...
     Async.Run (Async.Parallel tasks) | > ignore
     printfn "WriteChaptersAsync finished!";

Don Syme on F# Async Workflows on Ch9

Don Syme's WebLog on F# and Other Research Projects : Introducing F# Asynchronous Workflows

Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# MSDN Blog Postings » I'm supposed to be writing, but... said on March 19, 2008 12:38 AM:

PingBack from http://msdnrss.thecoderblogs.com/2008/03/19/im-supposed-to-be-writing-but/

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

Search

This Blog

Syndication

Page view tracker