Based on interest from the J in 5 minutes thread, I threw together a small
example of a JHS based spreadsheet. It's crude but works. I wanted to just
get the concept out there.

I will likely enhance it further. I can also make it so there is only one
grid and the J expression is edited by once the cell has focus (like in
Excel).

The video was done in only 2 takes and about 10 minutes of preparation...
more so of a demo for this group, not for a broader audience..

http://www.youtube.com/watch?v=BPEGDNIkh0A&feature=youtu.be

The code is kind of rough and will need some refinements:

https://gist.github.com/joebo/b34b7ac65ee6334b98eb


I think these few lines are very powerful as the spreadsheet function. It
can probably even be combined into a 1 liner.

calc=: 3 : 0
r=:(".) :: (]) L:0 r
)

ret=:calc^:_ r

It calculates each cell until the grid converges.  It executes (".) :: (])
 which returns the evaluated cell or an the cell if the evaluation is an
error. It's a try. catch.. essentially. I started with the try. catch. and
shortened it to this.


It may be useful to define a different variable, not r and maybe even have
a locale for it and somehow define functions so we can reference A1 B1 A_
(for the entire row) etc...

Please share any feedback and comments. Thanks!
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to