Monday, November 30, 2015

F# {m}brace cloud and parallel

F# programming language have introduced some important concepts to .NET ecosystem,
such as Generics and Async. Now, it is adding "Cloud" and "Parallel."
With MBrace library there is a "Cloud" command that can submit computing to "Cloud"
and continue with results!

Crunching through big data with MBrace, Azure and F# | fsharp + ML |> MVP Summit 2015 | Channel 9

MBrace - Scripting Compute and Data Jobs in the Cloud Made Simple
"MBrace.Core is a simple programming model for scalable cloud data scripting and programming with F# and C#. With MBrace.Azure, you can script Azure for large-scale compute and data processing, directly from your favourite editor."
Part 1 - Distributed computations and Big Data with F# cloud monads

let maxContentLength = cloud {
    let lengthsJob = [| "https://github.com";"http://www.microsoft.com/"|]
       |> Array.map (getContentLength >> Cloud.OfAsync)
       let! lengths = Cloud.Parallel lengthsJob
    return Array.max lengths
}

let getContentLength (url : string) = async {
    let request = HttpWebRequest.Create(url)
    let! response = request.AsyncGetResponse()  
    return response.ContentLength
}


No comments: