Hi David, Thank you for your answer.

> -----Original Message-----

> From: David Manura

> Nadim,

> This module looks neat. The way speadsheets automatically

> update data  on dependencies, like a continually running makefile,

> seem to  be their  main benefit, but they do have some limitations

> since the data in a  problem must be flattened onto a two-dimensional

> grid. Being a  programmer, I feel that the structure, size, and type of
the

> data gets  lost. For example, if cell C5 contains the average of cells

> B5:B10, and  then you append a new value to cell B11, you have to correct

> the formula  in C5 to cover the new range B5:B11. Software like Mathcad

> offers the best of both worlds by preserving the concept of data

> structures while  also having the spreadsheet-like data-update
dependencies.

> That makes me wonder whether something similar could be done in Perl,

> and if so how  useful it would be.



About your concerns,

> For example, if cell C5 contains the average of cells

> B5:B10, and then you append a new value to cell B11,

> you have to correct the formula in C5 to cover the new

> range B5:B11. Software like Mathcad ....

I don't know how MathCAD handles the problem you described (at the user
input level) so if you could flesh it up a bit, I'll try to see what is
possible. There is a way of doing something similar in S:P. If you name your
input range, you just need to update that lookup.

$ss->SetRangeName

(

'input_to_sum' => 'B1:B10'

, 'addresses' => ...

, 'ss_numbers' => ...

) ;

# as of 0.03, range and cell naming use different functions but I'll change
that tonight.

$ss{A1} = Formula($ss->Sum('input_to_sum') ;

I agree that a way of describing a range without naming one of the limits
should exist, I just don't know how to make it visually clear. What about
'B1:B*' 'B*:B10' 'B*:B*' ?

> ... but they do have some limitations since the data in a

> problem must be flattened onto a two-dimensional grid. Being a

> programmer, I feel that the structure, size, and type of the

> data gets lost.

I see this as a different problem and I do agree with you that we shouldn't
have to flatten and reconstruct structures.

SP has 'Fetch Functions'.

my $structure = ... something very complicated ...

$ss{A9} = NoCache() ; # don't use the cached value, call fetch function at
each access

$ss{A9} = FetchFunction(sub{$structure->{...}[...]{...}}) ;

There is a similar way to store data, this lets us manipulate data in place.

I can think about a neater syntax:

$ss{A9} = FetchFunction(sub->{$structure{...}[...]{...}}) ;

vs.

$ss{A9} = NoCache() ;

$ss{A9} = Ref($structure->{...}[...]{...}) ;

or

$ss{A9} = RefNoCache($structure->{...}[...]{...}) ;

You can still have a formula attached to the cell.

This takes me to another problem (that I thought I had decided over). The
formulas are executed in the Spreadsheet package not the callers. This is
IMO the neatest but we have to go through loops to get the data in to the
spreadsheet. Here is an example (all this is in working condition and open
to suggestions)

# as of 0.03

my $data ;

$ss{A1} = Formula($ss->Sum('$data') ; # error

my $data ;

sub MySub{}

$ss{A1} = Formula($ss->Sum('MySub()') ; # error

1/ It possible to use "Ref" and "DefineFunction" to make it work as intended

2/ It possible to make these two example work right away but I think it
opens doors to nasty debugging sessions

Please keep coming with your suggestions, the module is still small enough
to allow for drastic changes :-)

Cheers, Nadim.

PS. I hope the mail looks "normal" on your side. I still have problems
making "Outbreak (tm)" work as I want it it to.


Reply via email to