问题
The Clojure Prismatic/Plumbing library can be used in order to provide a declarative and explicit definition of an application or module functions' graph.
In short, it provides a means to specify each function as a node with a label, which is also the output label, the labeled inputs, and an implementation. It uses a custom keyword (fkn) defined in a macro for this purpose.
We have to develop a module in F# which performs relatively complex calculations in a hierarchical fashion that could benefit from Prismatic features, namely:
- A graph can be built easily from function map, just taking inputs as dependencies. This graph can be analyzed, checked and visualized with very little code. Also subgraphs could be written providing further flexibility (valuable in our domain).
- Function execution can be monitored. Not only performance but values in and out of each function.
- Testing and Mocking of the system is really easy.
More on these and other features on github and infoq presentation:
What would be the fsharpest way to program this declarative definition of functions in a map in order to get these features?
来源:https://stackoverflow.com/questions/24932086/specify-function-composition-through-declarative-maps-in-f