1. 17
  1.  

  2. 1

    Its funny how the entire post and code make no mention of the 2d cell structure of a spreadsheet. For example, in a spreadsheet you can take the sum of a rectangle with =sum(A1:D3).

    This implementation of invalidate is pretty interesting. It effectively avoid re-invalidating the observers of a cell more than once and doesn’t immediately re-evaluate the invalidated cells. It makes them lazily evaluated again.

    I’ve tried implementing something similar and this feels more efficient than the different strategies I’ve tried.

    Its too bad they didn’t discuss this aspect of their design. I almost missed it if it weren’t for me trying to write this comment (where I first was first going to stated that their invalidation is inefficient). I wonder what other design decisions and trade-off went into this.

    1. 0

      how one can suppose that giving code in haskell will be understandable for layman programmer

      1. 4

        Neel is a PLT researcher and is writing for other PLT people.

        Also, that’s ML, not Haskell.

        1. 3

          This Ocaml is much more readable than the Haskell I’ve tried to pick through - there’s only one funky character operator (the monad’s bind operator); where I’ve found similar themed posts in Haskell get more operator-soup-tastic.

          1. 1

            I don’t think the audience of this post is for programmers who are unfamiliar with functional programming. The typical audience of NeelK’s blog would be comfortable writing interpreters and describing the spreadsheet language as a monadic DSL is a useful shorthand for many of these readers.

            On the algorithm side nothing fancy is happening, but if you are unfamiliar with functional programming this can be more challenging to read than it necessarily needs to be.

            1. 1

              That’s pretty much it. I think it’s quite pleasant to see how little code it takes to implement such an engine.

              As others noted it’s ML/Ocaml, although it can appear to be very similar to Haskell. But even a layman can see that indeed, whatever language this is, it requires very little code to implement something quite complex. This observation is what inspired me to study SML. Although it was valuable time spent for my own edification, I’ve never used it in a project.

              1. 1

                Little code can be a bad mesure more code is preferable if it is complex to understand. I really don’t get why it is useful in this post to introduce monadic operator except to stay on his ivory tower.

            Stories with similar links:

            1. How to implement a spreadsheet via zem 4 years ago | 7 points | 1 comment