microsoft / angara.flow Goto Github PK
View Code? Open in Web Editor NEWA .NET framework for composing, evaluating, inspecting and persisting computational experiments which are represented as a dataflow.
License: Other
A .NET framework for composing, evaluating, inspecting and persisting computational experiments which are represented as a dataflow.
License: Other
let ``Extend and continue work using computation expression``() =
let w1 = work {
let! x = makeValue 1 |> name "one"
let! y = inc x
let! z = inc x
let! w = add(x,y) |> name "sum"
()
}
let eng,names,annotations,_ = startFrom_x w1 (createDefaultSuffix)
let wrk = Execution.EngineAPI.AwaitCompletion eng |> Async.RunSynchronously
eng.Dispose()
Trace.WriteLine("\n\n\nContinues...")
let snapshot = wrk, names, annotations
let w2 = work {
let! y = snapshot |> take<int> "out one"
let! w = snapshot |> take<int> "out sum"
let! z = inc y
return z
}
let (g,_,_) = build w2
Assert.AreEqual(4, g.Structure.Vertices.Count)
match eval w2 |> Async.RunSynchronously with
| EvaluationResult.Failed _ -> failwith "Work failed"
| EvaluationResult.Success z ->
z =? 3
There are important files that Microsoft projects should all have that are not present in this repository. A pull request has been opened to add the missing file(s). When the pr is merged this issue will be closed automatically.
Microsoft teams can learn more about this effort and share feedback within the open source guidance available internally.
let ``Use resumable iterative method in a 'work' monad``() =
let g = work {
let! func = makeValue (fun (x:float) -> x*x - 4.*x + 2.)
let! settings= makeValue (3.0, 0.1, 0.001)
let! root = root (func, settings)
return! incf root
}
match eval(g) |> Async.RunSynchronously with
| EvaluationResult.Failed _ -> Assert.Fail("Failed to execute a work")
| EvaluationResult.Success(v) -> Assert.AreEqual(1. + (2. + sqrt(2.)), v, 0.01, "Incorrect root")
let ``Adding two arrays of different length``() =
let w = flow {
let! a = makeValue [| 1; 2; 4 |]
let! b = makeValue [| 3; 1 |]
let! s = foreach2(a, b, fun (a,b) -> flow {
let! sum = add a b
return sum
})
return! sum s
}
let s = run w
Assert.Fail("work succeeded")
let ``Building compound method with 2 outputs from work expression``() =
let incsum (x: ArtefactExpression<int>) (y: ArtefactExpression<int>) : FlowExpression<ArtefactExpression<int>*ArtefactExpression<int>> =
flow {
let! a = inc x
let! b = sum (collect[| a; y |])
return a,b
}
let makeIncsum = decl incsum "incsum values" |> carg "x" |>carg "y" |> cresult ["a";"b"]
let contract = Angara.Contracts.getContract makeIncsum
let w = work{
let! a,b = makeIncsum (value 2) (value 5)
return a,b
}
match eval2 w |> Async.RunSynchronously with
| EvaluationResult.Success (a,b) ->
(3,8) =? (a,b)
| EvaluationResult.Failed _ -> Assert.Fail("Work failed")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.