Specify function composition through declarative maps in F#

久未见 提交于 2019-11-30 19:01:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!