POV-Ray : Newsgroups : povray.off-topic : Apparently it didn't catch on : Re: Apparently it didn't catch on Server Time
28 Jul 2024 20:20:47 EDT (-0400)
  Re: Apparently it didn't catch on  
From: bart
Date: 25 Feb 2013 07:53:32
Message: <512b5ecc@news.povray.org>
>When you start to look at a spreadsheet as a program,
 >you realise that as a programming language,
 >it's pretty damned weak.
 >In particular, it is impossible to define new data types,
 >and it has impossible to define subroutines.

The lack of subroutines is the main concern of the paper,
but a new data types (structures) can be simulated easily in Excel.
Just put all the fields in the block of cells - and you have it.
The one can access it by a reference.

 >Trouble is... Well, actually there's a whole *host*
 >of problems. Problem
 >#1 is that your new function might be called twenty billion times.
 >You're not going to display twenty billion worksheet tabs!
 >The solution
 >they came up with as that only one "instance"
 >of each function sheet can
 >be visible at once.

It would be probably better to call it not an instance,
but a function definition.
The user's concern would be only to copy a working code
to the function sheet and somehow indicate the locations
of the parameters and the result.
The extension (could be in a form of xll) should then
take care of some kind of translation of the algorithm,
derived from the function sheet, into, say,
a sequence of calls and store it in the memory.
The biggest problem is to make Excel to recognize
the names of the new functions.
But just for the working demonstration they could use a single
function, say, ufun("function-sheet-name",params) which return a matrix.

 >Problem #2 is "how do we support recursion?" They chose the solution
 >"you don't". Which seems reasonable; how many people actually want to
 >use that feature? Do we really want to complicate the interface further
 >just to make those guys happy?

The function definition can use the standard Excel =IF(,,) function
to make a conditional result to stop the recursion.
The rest would be provided by the standard mechanism of function calls.

 >
 >Problem #3 is how to support functions that take *ranges* of cells as
 >input. Their solution was to make a cell matrix a first-class value,
 >so  that a single cell can contain an entire matrix.
 >And since a matrix is made up of cells,
 >matrices can be nested arbitrarily deep.

This is not a big problem after all:
Excel functions do support ranges
(and expressions that operate on ranges)
as their arguments.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.