I'm supposed to be writing, but...
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's WebLog on F# and Other Research Projects : Introducing F# Asynchronous Workflows
Comments
- Anonymous
March 18, 2008
PingBack from http://msdnrss.thecoderblogs.com/2008/03/19/im-supposed-to-be-writing-but/