mjul / docjure

Read and write Office documents from Clojure
MIT License
622 stars 129 forks source link

cell-fn Excel to Clojure Bridge #42

Closed trieloff closed 8 years ago

trieloff commented 8 years ago

This pull request will provide a new function, cell-fn which will take a list of cells from a spreadsheet and and return a function. The returned function will always return the value of the first cell passed, but before doing so, it will update the spreadsheet with the values provided for the other cells that have been used as arguments to cell-fn and recalculate the formula for the result cell.

This allows treating the spreadsheet itself as a Clojure function, effectively allowing business users to use Microsoft Excel as a crude, but familiar domain specific language, to specify formulas/functions.

The base implementation does not optimize performance in any way, so before building mission-critical real-time apps based on Excel formulas, you might want to sprinkle some memoize magic on top.

The pull request also contains a fix for an issue where setting the value of a cell that contains a formula would not correctly update the cell value, only the cached output of the formula calculation. See https://github.com/mjul/docjure/commit/adeaf5efe919ca25c0155da05d24d5c6e7810786 for the exact diff.

mjul commented 8 years ago

Hi Lars, It looks good, I am short for time to review it in detail right now, but I expect it to be good for merge. Thanks, Martin

trieloff commented 8 years ago

Hi Martin, thank you. Please let me know if there is anything I can do to help this one get merged.

mjul commented 8 years ago

Hi Lars, thank you for the contribution.