[HN Gopher] Ask HN: Would Spreadsheets with Lisps be much more p...
___________________________________________________________________
Ask HN: Would Spreadsheets with Lisps be much more powerful?
I'm a CS freshman who got obsessed with lisps after using Scheme in
my intro class. Tangentially, as a side project, I made a
spreadsheet to learn how their update mechanism worked[0]. For the
formula language, I implemented a basic lisp that does math
expressions. That got me wondering- would making a fully
functional lisp the formula language add substantial power to
spreadsheets? Of course, macros add power to anything, but I'm
wondering if there's specifically new interactions that would be
possible with sheets using a lisp as opposed to, say, JS. An
initial idea was being able to call (apply A1 B1) to apply a
procedure from one cell to another, but that's not the most
groundbreaking concept. Hence the question to those of you who
understand lisps more than I do. p.s: Not a pro. Go easy on me HN!
[0]: https://lispread.sarv.repl.co/
Author : sarvasvkulpati
Score : 44 points
Date : 2021-06-11 05:59 UTC (17 hours ago)
| klyrs wrote:
| Is lisp more powerful than JS? Not really; you can write lisp in
| JS. But that's a correct answer to a wrong question. Lisp is fun,
| but IMO it's wrapped in undeserved mythology. Maybe I'm just
| jaded, but if you move parens one word to the right and sprinkle
| commas between tokens, it's downright readable to a c programmer.
| That said, homoiconicity is powerful and spreadsheet-based
| metaprogramming could be super cool.
|
| What I haven't seen is a maturation of spreadsheet-based
| programming. Code and data are mingled in cells, and excel (and
| clones I've used) hide the code and display the data in an
| opinionated manner. That's a huge UI problem, IMO. But, mingling
| code and data can be very fun! Perhaps lisp could be cool for
| that, but I'd actually prefer a concatenative array language to
| really take advantage of the spreadsheet UI. So, go read up on
| Forth and APL, and bake their unholy offspring into a
| spreadsheet. Nothing bad can come of this.
| twobitshifter wrote:
| It would be cool if each cell is an s expression on its own. -
| but are cells the best way to show s expressions?
| planetree wrote:
| See Kenny Tilton's Cells project, which more or less does the
| inverse.
|
| https://github.com/kennytilton/cells
| zonethundery wrote:
| Cells is really neat. I last used it 10+ years ago but it was a
| delightful way to express ideas about market structure in a way
| that made sense to my excel-addled brain.
| igouy wrote:
| About 40 years ago --
|
| "An advanced object-oriented spreadsheet package for the
| Smalltalk-80 system
|
| Asp(tm) is an analytic spreadsheet package that provides access
| to the full power of the Smalltalk-80(tm) programming
| environment. Developed by Xerox Special Information Systems
| (XSIS) as part of The Analyst(tm) Workstation System, ASP is now
| available as a separate package for the Smalltalk-80 environment.
|
| Unlike other spreadsheet packages, ASP is designed for the
| analysis of more than just numbers and labels. Vectors, points,
| collections of data, text, charts, files, and images are just a
| few types of objects that ASP can manipulate and display.
|
| While ASP provides a large array of predefined functions, it is
| also extensible. By adding new methods to the Smalltalk-80
| environment, ASP can be instantly expanded to match user needs,
| without requiring extensive knowledge of either ASP or the
| Smalltalk-80 system."
|
| http://www.bitsavers.org/pdf/xerox/xsis/XSIS_Smalltalk_Produ...
|
| "Object-oriented spreadsheets: the analytic spreadsheet package"
|
| https://dl.acm.org/doi/abs/10.1145/960112.28737
| davidscolgan wrote:
| Dear sarvasvkulpati,
|
| I appreciate your question! It demonstrates a curiosity about the
| nature of computing itself. Some will surely say that this idea
| is unreasonable or not practical. But, if this is an idea that
| speaks to you, I encourage you to try your hand at making a
| prototype of your idea! This is the hacker way. And being in
| college you have time, peers who are equally enthusiastic,
| energy, and the help of professors. Regardless of the
| practicality, all interesting progress comes from people who ask
| questions like this, and see what comes of trying to make
| something interesting.
|
| In college I had a peer who convinced us to all use Gentoo Linux
| because it was the most hardcore Linux. I bricked my computer
| three times trying to use it and ultimately switched away from
| using Gentoo but learned a ton about Linux that I use to this day
| on a less hardcore distro. I still use Vim even though it's more
| complicated than other editors. I also went through a period
| where I tried learning every programming language I could find to
| see which one was "the best". I ultimately found a few I liked
| the most. None of these were efficient at first, but eventually
| led to highly cool results.
|
| Ask for help if you get stuck. I bet something interesting will
| come of it, even if you just learn what doesn't work.
|
| Something something "The reasonable man adapts himself to the
| world: the unreasonable one persists in trying to adapt the world
| to himself. Therefore all progress depends on the unreasonable
| man."
|
| Your idea is really cool. Stay hungry and awesome. Cheers to you.
| simplify wrote:
| Perhaps even more powerful would be spreadsheets + Prolog. Since
| Prolog's main strength is finding answers _for_ you, I imagine
| putting that on grid would have very interesting results.
| layer8 wrote:
| That sounds like a more powerful variation of Excel's Goal Seek
| function. The latter however uses an iterative approximation
| approach. Given the non-exact nature of floating point, it
| would be interesting to see if numeric approximation can be
| combined with a Prolog-like resolution algorithm.
| ashton314 wrote:
| Once you have a lisp, implementing microKanren is straight-
| forward. Just as the lisp and you get the Prolog for free!
| ALittleLight wrote:
| Interesting idea. I like spreadsheets and a new way to program
| them would be interesting.
|
| In your sample it seems like problematic entries cause the sheet
| to crash or become non-responsive. Probably a good idea to handle
| errors gracefully. If you can't evaluate, just give an error
| message.
| treebog wrote:
| I haven't used it myself, but I believe Simple Emacs Spreadsheets
| lets you write formulas in emacs lisp.
|
| https://www.gnu.org/software/emacs/manual/html_node/ses/inde...
| Jtsummers wrote:
| It does. And while I like SES, it doesn't scale terribly well
| (in contrast to proper spreadsheet software). I did have a nice
| little stock dashboard using Yahoo!'s API about a decade ago
| paired with my purchases and such. I also made a nice little
| tax calculator and a few other things, I found it very useful
| (and used emacs lisp) for those kinds of programs. But the kind
| of scale that I've often seen Excel used for in businesses were
| a poor fit for it. Plus, good luck convincing non-technical
| managers (here I mean all kinds including financial managers
| and such) to use Emacs as a daily use tool. It's happened
| before, but it's not an easy sell.
| throwawayboise wrote:
| Org-mode allows it as well.
|
| https://orgmode.org/worg/org-tutorials/org-spreadsheet-lisp-...
|
| I've only dabbled with it, I am guessing for anything really
| substantial it would be quite slow compared to e.g. Excel.
| xj9 wrote:
| i've sometimes thought that APL could mesh really well with
| spreadsheets.
|
| https://www.youtube.com/watch?v=v7Mt0GYHU9A
| https://www.youtube.com/watch?v=UltnvW83_CQ
| zem wrote:
| from the other side, check out 'cells' for an interesting
| implementation of spreadsheet-like reactive updates within common
| lisp https://github.com/kennytilton/cells/wiki
| laumars wrote:
| Excel formulas are already functional. They're just composed with
| Sexpressions. I'm not convinced semantics of one is any better
| than the semantics of another. Ultimately that boils down to
| personal preference.
| moomin wrote:
| More powerful? Yeah, sure. But honestly, many companies have made
| more powerful versions of Excel over the years and most of them
| have gone to the wall.
|
| If you think of power in a different way, that of empowering
| users who typically have little or no technology experience,
| things get a bit more interesting. Anything you come up with has
| to be instantly obviously more useful in at least one way. Google
| Docs and Zoho are still viable products despite from a CS
| perspective being significantly less powerful.
|
| Like many answers you've received, it comes down to the
| difference between technology, product design and commercial
| concerns.
|
| The only product to ever supplant a world-wide dominant
| spreadsheet is... Excel.
| beforeolives wrote:
| Mark your post as "Show HN". There's no way I will comment on
| your side project after I was tricked into reading about it.
| quickthrower2 wrote:
| Harsh
| sarvasvkulpati wrote:
| Apologies if you felt tricked into reading it.
|
| I only spoke about the project as context for the question in
| the title, but I see how I could have been clearer, and how I
| didn't necessarily need to include the title.
|
| If you're experienced in Lisp, I'm still curious about the
| question: is adding a lisp to a sheet more powerful than
| adding, say JS, and if so, how?
| Scarbutt wrote:
| _If you 're experienced in Lisp, I'm still curious about the
| question: is adding a lisp to a sheet more powerful than
| adding, say JS, and if so, how?_
|
| No, it won't be more powerful
| xupybd wrote:
| From the HN guidelines: "Be kind. Don't be snarky. Have curious
| conversation; don't cross-examine. Please don't fulminate.
| Please don't sneer, including at the rest of the community."
| jkingsbery wrote:
| If you're interested in this topic, you should look into emacs (a
| text editor that uses a Lisp-like language for customization) and
| it's accompanying org-mode (something that helps you take notes
| in emacs, and also has a built in spreadsheet), which allows for
| using emacs lisp for defining functions:
| https://orgmode.org/worg/org-tutorials/org-spreadsheet-lisp-...
|
| Good luck!
| mamcx wrote:
| I'm building a language (https://tablam.org) that, hopefully,
| could become the base for excel/access alternative.
|
| lisp is _not_ the better fir for excel, to see why, check this:
| "The memory models that underlie programming languages"
|
| http://canonical.org/~kragen/memory-models/
|
| Among them, array/relational could be a better fit (semantic and
| operational). Of course you also need to add some form of
| reactivity (or actors?) to mimic the immediacy of excel formulas.
|
| ---
|
| To confirm this intuition, check how much pandas/numpy/R
| lang/apl/Julia/Sql people intersect with the usage of excel.
|
| This means that languages/tools are closer in spirit than lisp.
|
| Also, syntax wise, concatenative langs/array langs/forth
| langs/sql like is more nice for the terseness of excel usage.
| moomin wrote:
| Honestly, Pandas and R are actual Excel killers. At least in
| certain areas.
| [deleted]
| taneq wrote:
| Good question! Smartass answer: No, because spreadsheets in
| programs like Excel are Turing-complete, which means any program
| you could write in a Lispy spreadsheet, you can write in Excel.
|
| Useful answer: In practical terms, probably, for a very small
| subset of users. The kinds of users who are into programming and
| also Lisp, and also use spreadsheets a lot. For these four users,
| adding their favourite programming paradigm would help them to
| implement cooler things than they would otherwise do.
| Scarbutt wrote:
| As someone who is into programming and lisps, I would prefer a
| declarative language (a la SQL and the relational model) which
| is just simply superior at manipulating data over some FP
| language (OOP langs are much worse of course). But then, many
| already use SQL instead of spreadsheets.
| default-kramer wrote:
| If the native language is Lisp, you could use it to build a
| declarative DSL pretty easily. If the native language is
| something like SQL, your options are much more limited.
| acchow wrote:
| > Smartass answer: No, because spreadsheets in programs like
| Excel are Turing-complete
|
| There is a difference in expressivity between programming
| languages despite the fact that they may both be Turing-
| complete. Just look at how languages add more language features
| over time...
| echelon wrote:
| _looks at C++_
| dahart wrote:
| Excel has a new function called LAMBDA, which makes Excel Turing-
| Complete. (https://www.microsoft.com/en-us/research/blog/lambda-
| the-ult...) If you haven't gotten there yet in your CS classes,
| Turing-Complete means you can compute anything that is
| computable, so provably as powerful as any other language.
|
| Turing-Complete doesn't say anything about convenience though,
| there are always reasons to play with embedding your favorite
| language into your other environments, so don't let prior work
| stop you from playing and exploring! You will earn yourself many
| benefits by trying to do it yourself.
|
| Excel, BTW, was fairly powerful as a programming environment even
| before the LAMBDA function, there have been multiple examples of
| crazy applications written in an Excel spreadsheet, video
| playback, games, ray tracing, etc. Here's a ray tracing example:
| https://news.ycombinator.com/item?id=20764825
| ska wrote:
| > Turing-Complete doesn't say anything about convenience
| though,
|
| e.g. c++ template mechanism, also Turing complete.
| junon wrote:
| CSS is also turing complete (given some assumptions).
| hanche wrote:
| Excel's lambda is still only avaiable in beta versions, I
| think? At least, I haven't seen it yet, and I have been
| looking.
| throwaway4good wrote:
| For a syntax in a spreadsheet you would want something that is
| short and familiar but you can certainly toy with idea.
|
| I remember when the geeky engineers had their calculators in
| reverse Polish notation:
|
| https://en.m.wikipedia.org/wiki/Reverse_Polish_notation
| kinghajj wrote:
| I unironically have an RPN calculator app on my phone. I find
| it easier to use than a regular calculator.
| taneq wrote:
| _checks my top drawer_ What do you mean 'remember when'?! :P
| Now if only I could remember how to use the damn thing...
| Jtsummers wrote:
| Numbers, enter, numbers, operation. That's about it, nice and
| simple. Programming in RPL was a lot of fun, sadly my HP-48G
| was lost to water damage (lost a bunch of things from that
| leaky roof). I still have my 32SII from college when a class
| required non-programmable calculators. Of course, it is
| programmable but they didn't know that (and I didn't use it)
| but it was easier to slip that out and stick with RPN than
| get used to a TI scientific calculator again.
| [deleted]
| mschaef wrote:
| You may find SIAG (Scheme in a grid) interesting. It explores
| some of the same ideas: https://siag.nu/siag/
|
| There's also been some work along these lines in Excel itself,
| although using the Excel formula language rather than Scheme.
| Excel now has both let and lambda, as well as a way to work with
| composite data structures in cells.
|
| https://www.microsoft.com/en-us/research/blog/lambda-the-ult...
|
| https://support.microsoft.com/en-us/office/let-function-3484...
|
| https://exceljet.net/dynamic-array-formulas-in-excel
|
| In general, I think your idea is sound. Almost since the
| beginning, Spreadsheets have had two major ways of operating on
| data - the formula language, which is automatic, declarative, and
| functional in nature, and commands (like on a menu), which are
| generally imperative and have to be explicitly invoked (or
| invoked through a separate macro language). Both have their
| places, but the functional language of formulas is nice for the
| same reason functional languages in general are appealing.
| There's also an easier ramp for users new to programming to
| progress from "=A1+B1" to more advanced sorts of operations
| (lookupus, etc.) without having to switch to a formal
| "programming language".
|
| However, aside from additional standard functions, the formula
| language half (in Excel, at least) was largely static since the
| 1980s - limited essentially to scalar data types, and no internal
| way for creating abstractions. This severely limited the range of
| what you could do with formulas, when compared to more complete
| programming languages, and forced a lot of functionality to be
| done in (more brittle) macros.
|
| So the direction you're going - broadening the power of what can
| be done with a spreadsheet language - is a useful one, and
| there's prior art to justify that the idea makes sense.
| giardini wrote:
| Yes, just as "sharks with frikin lasers" are much more powerful.
|
| But seriously, no. It is cult cargo thinking" to believe that
| merely juxtaposing two things will lead to something "more
| powerful. OTOH it is often the first step toward a new and useful
| idea. So all the magic is in the "how" of combining things.
| premium-komodo wrote:
| Well, I don't think "more powerful" is a good way to think about
| it. A spreadsheet is essentially a functional programming
| paradigm. One programming thingie is not going to be "more
| powerful" than another. That said, one could be cooler or more
| interesting than another one, at least to you.
|
| My feeling is that it doesn't have to make sense, and you don't
| really need to have any justification. If you want to make a
| spreadsheet system with Lisp, I'd definitely do it. You learn the
| most when you do your own projects, and _interest_ is the fuel.
|
| Also, we're bad at determining beforehand what actually _is_
| important, so maybe you work on something as a toy, but later it
| (or some piece of knowledge developed while working on it) is
| crucial for something else later.
| dTal wrote:
| When people speak of "power" in a programming language, they
| generally mean expressive power. It's true that all (Turing-
| complete) programming languages can theoretically encode the
| same programs - but they do _not_ all take the same time to
| implement. Lisp is more powerful than C; C is more powerful
| than x86 assembly; x86 assembly is more powerful than
| Brainfuck.
|
| It's reasonable to ask if a given approach to language design
| results in more "power". It's not just a question of taste.
| quickthrower2 wrote:
| One interesting thing with lisp and spreadsheets would be that
| a you can transform data in the sheet into a program with a
| macro, so rather than just values one cell could turn other
| parts of the workbook into a dsl. Could be some interesting
| shenanigans you can get up to.
| sarvasvkulpati wrote:
| Thank you! This makes a lot of sense!
|
| If I can run any arbitrary lisp program in a cell (assuming the
| env is global), I was wondering if this was just a 2d text
| editor for a lisp. But that's awfully reductionist.
|
| But you're right I'm assuming I'll discover interesting things
| if I keep tinkering with it!
| gumby wrote:
| One advantage of using lisp is it would make it easier to develop
| complex routines. You could even import external code, so you
| could write/debug some hairy algos externally and then use them
| in the spreadsheet. Imagine having the power of macsyma and doing
| pdes in your spreadsheet. Or being able to do advanced vector
| operations on columns.
|
| Though I am not as fond of them a stack language like forth or
| postscript could also be the computing paradigm of your
| spreadsheet.
|
| Or if you are feeling more perverse, there's always TECO
___________________________________________________________________
(page generated 2021-06-11 23:01 UTC)