FPSheet:使用Haskell作为脚本语言的Spreadsheet程序

网友投稿 704 2022-10-22

FPSheet:使用Haskell作为脚本语言的Spreadsheet程序

FPSheet:使用Haskell作为脚本语言的Spreadsheet程序

FPSheet

A Spreadsheet program with Haskell as the scripting language

The prototype was written in C, it can be tried out in the c-prototype branch. I am currently rewriting the tool in Haskell, which I am doing in this master branch.

FPSheet is a spreadsheet program, where the scripting language for computing cell's values from formulas runs Haskell internally. This arguably provides a more uniform experience than what is provided by the scripting languages of standard spreadsheet programs. Note: this README currently assumes some familiarity from the reader with ghc's ghci tool.

Currently the tool starts a ghci session in the background. When a cell is defined or edited, a unique variable is defined or redefined inside this ghci session. For example, if cell abd124 is edited to: "45", FPSheet sends the following to the ghci session: "let abd124 = 45". Similarly, if cell a4 is edited to: "a5 * 10", FPSheet sends the following to the ghci session: "let a4 = a5 * 10".

Interestingly, since Haskell is lazily evaluated, and since Haskell regards function values as first class citizens, any custom function can be defined inside a cell. Any other cell can then apply this function simply by referring to the cell.

Installation

Run: stack install

Usage

Run: stack exec FPSheet-exe

The program has vim-like modes:

normal mode for moving aroundedit mode for editing the definition of a cell

While in normal mode, press:

:q to exit.:w to write the sheet to disk:r to read a sheet from disk:i to import an .xlsx file (imports from cell values):I to import an .xlsx file (imports from cell formulas if set, falls back to cell values for cells that do not have a formula definition set): to jump to column,row (e.g. a10, azzz4050, etc.) to interrupt the ghci backend (useful for when you accidentally defined a cell that cannot finish evaluation)

TODOs

Figure out a way to get something like [a1..a4] to evaluate to [a1,a2,a3,a4]Copy pasting cells (properly handling loose and stuck cell references)Exporting to excell savefilesUndo & redoMany many more vital features (aka: TODO: write these out)

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Sharp Gem是一个.NET Core控制台应用程序
下一篇:android:获取手机号码和姓名实现通讯录
相关文章

 发表评论

暂时没有评论,来抢沙发吧~