<div dir="ltr">ASCII examples (view in monospaced font):<div><br></div><div><div><font face="monospace">NormalSheet</font></div><div><font face="monospace">-------------------------</font></div><div><font face="monospace">  | A               | B |</font></div><div><font face="monospace">-------------------------</font></div><div><font face="monospace">1 | 1               |   |</font></div><div><font face="monospace">-------------------------</font></div><div><font face="monospace">2 | 2               |   |</font></div><div><font face="monospace">--------------------------</font></div><div><font face="monospace">3 | 3               |   |</font></div><div><font face="monospace">--------------------------</font></div><div><font face="monospace">4 | 4               |   |</font></div><div><font face="monospace">-------------------------</font></div><div><font face="monospace">5 | =SUM(A1:A4)     |   | (answer is 10)</font></div><div><font face="monospace">-------------------------</font></div><div><font face="monospace">6 | =myFunction(A5) |   |</font></div><div><font face="monospace">-------------------------</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">==================================</font></div><div><font face="monospace">A new sheet</font></div><div><font face="monospace">==================================</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">myFunction (it has the "function sheet" property)</font></div><div><font face="monospace">----------------------------</font></div><div><font face="monospace">  |  A                 | B |</font></div><div><font face="monospace">----------------------------</font></div><div><font face="monospace">1 | =PARAMETER(double) |   |</font></div><div><font face="monospace">----------------------------</font></div><div><font face="monospace">2 | = A1 * A1          |   |</font></div><div><font face="monospace">----------------------------</font></div><div><font face="monospace">3 | =RETURN(A2)        |   |</font></div><div><font face="monospace">----------------------------</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">Copy to CSV</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">NormalSheet</font></div><div><font face="monospace"><br></font></div><div><font face="monospace"><div>1</div><div>2</div><div>3</div><div>4</div><div>5</div><div>=SUM(A1:A5)</div><div><br></div><div>=MY_FUNCTION(A6)</div><div><br></div><div>Copy second sheet to CSV</div><div><br></div><div>MY_FUNCTION (a function sheet)</div><div><br></div><div><div>=PARAMETER(double)</div><div><br></div><div>=A1*A1</div><div><br></div><div>=RETURN(A3)</div></div></font></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Nov 19, 2017 at 12:05 AM trent shipley <<a href="mailto:trent.shipley@gmail.com">trent.shipley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I have a vision for a spreadsheet that is programmable as a spreadsheet itself. (Excel, for example, is programmable in VBA, but VBA requires switching modes to the VBA environment and using a non-spreadsheet idiom. Excel is not self-programmable as a spreadsheet.)</div><div><br></div><div>First there one function in a cell or array can reference other cells and arrays, including those that contain functions themselves. Second, IF(boolean,then,else) functions provide for selection. </div><div><br></div><div>Third, the Function local scope property for a sheet in a workbook, the PARAMETER() function, and the RETURN() function allow the spreadsheet programmer to write new functions, including recursive functions.</div><div><br></div><div>* Is a spreadsheet you can program from the spreadsheet a reasonable goal?</div><div>* Has it been done?</div><div>(I don't have the academic CS chops to know what keywords to use, and how search CS publications in English.)</div><div><br></div><div>I have written a 30 page essay on Scriptsheets, but the essence boils down to the above. (If you, for some inexplicable reason, actually want the draft of the essay I'd be more than happy to share it with the understanding that you would provide feedback).  I call the proposal Scriptsheets.</div><div><br></div><div>So the plan is to take something like GNUmeric or LibreOffice Calc and graft on a primitive function sheet interpreter.</div><div><br></div><div>It would be natural to use C++, but the astute will note that a spreadsheet basically does not rewrite cells (unless you use a circular reference), so I'd also like to use a functional language, maybe Haskel.</div><div><br></div><div>* Would using a functional language as a basic language of the project save effort and intellectual load?</div><div><br></div><div>In the longer term I'd like as much of the spreadsheet programmable as a spreadsheet to be written to run on the JVM.</div><div><br></div><div>As near as I can tell near future Java and typed functional languages, include the following options:</div><div><br></div><div>Eta,</div><div>Frege,</div><div>Kotlin and,</div><div>Scala.</div><div><br></div><div>Note that a spreadsheet needs to give the satisfaction of immediate results, or failing immediate results, the sensation of actively working, so if the language could be interpreted that would be a huge help.</div><div><br></div><div>* Which combination of typed, compiled, interpreted, FOSS functional language that runs on the JVM, JAVA, Haskell, C++, C, used in that order of preference, makes the most sense for the Java compatible functional language at the top of the preference hierarchy? </div><div><br></div><div>Note also, that I have only the equivalent of an AA degree from a CIS, not a CS, perspective, so the odds are the whole idea is vaporware, unless I can determine feasibility and desirability, then sweet talk real developers to help out.</div><div><br></div><div><a href="mailto:trent1967.48@outlook.com" target="_blank">trent1967.48@outlook.com</a> (junk email address)</div><div><br></div><div>See also the spreadsheet at <a href="http://orgmode.org/" target="_blank">http://orgmode.org/</a>  it's cool.</div></div></blockquote></div></div></div>