News for hackers. Stuff that matters.
Re:Ask HN: Language compiled to Excel spreadsheets? by gus_massa on Friday July 24, 2015 @07:52AM (#9941292)
I think that the advantage of Excel for non programmers is that it's less abstract and you can see all the intermediate results instead of having a mental model in your head. Also it makes some bugs show faster, because you see the immediate result.

Perhaps an alternative is to make something between Excel and "text" programming. Usually a big spreadsheet has many almost independent blocks. Make some mini-spreadsheets with names and clear title rows/columns. Allow the mini-spreadsheets to be positioned easily and connected by formulas.

(Disclaimer: I use a lot of Excel instead of small scripts, the main problem is that you cant's nest 3 for loops.)

[In a related way, I saw some physicist program small calculations in Mathematica because it's more interactive than Fortran and it's easier to make graphs and find the errors.]

[There are some similar attempts. For example in Racket you can use #lang frtime to get a "reactive" program thatauto updates the values. http://docs.racket-lang.org/frtime/ It's a pity that the docs don't have an easy example.]

Re:Ask HN: Language compiled to Excel spreadsheets? by dang on Friday July 24, 2015 @02:46PM (#9944268)
> the main problem is that you cant's nest 3 for loops

I'm curious what you mean by this. Care to explain?

Re:Ask HN: Language compiled to Excel spreadsheets? by gus_massa on Friday July 24, 2015 @07:09PM (#9945778)
The problem is that the spreadsheets are 2D, so you iterate easily over two variables, the row and the column.

If you need to "program" this in an Excel spreadsheet

  For i = 1 to 5
    For j = 1 to 5
      If 2 * i + j = i * j then
        Print i, j, "*"
      End If
    Next
  Next
You can "write" this in a 6x6 block with the values

    1  2  3  4  5
  1 =If(2*B$1+$A2=B$1*$A2, "*", "")
  2
  3
  4
  5 
And copy the formula from B2 to all the cells, so you get

    1  2  3  4  5
  1 
  2
  3       *
  4    *
  5
Re:Ask HN: Language compiled to Excel spreadsheets? by dang on Saturday July 25, 2015 @01:30AM (#9946664)
Ah, that's what I thought you might mean. Can you talk about why you use spreadsheets in the first place, then? You're dealing with nontrivial problems if you hit this limitation, and you could write programs in a general-purpose language if you wanted to. So what do you get from Excel?

(I care about this, btw, because my real job is making a new spreadsheet.)

Re:Ask HN: Language compiled to Excel spreadsheets? by bradleyland on Friday July 24, 2015 @03:02PM (#9944370)
I don't know what the limit for `for` loops is, but Excel has some limits to nesting of flow control structures like `if`. For example, you cannot nest `if` statements more than seven deep. I suspect the parent poster is referring to a limitation similar to this, but for nesting `for` loops.