khemir nadim wrote:

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*' ?

'*' might be ambiguous. Does it mean infinity? Does it mean the last defined value in the column? The latter seems more useful, so if you state B1:B* and the only defined cells in the B column are B1:B10, then you could infer B1:B* to mean B1:B10. What then if the only defined values in the B column are B1:B10 and B20:B30? Would B5:B* mean B5:B10 and B25:B* mean B25:B30? I don't know if Excel supports such functionality (I've looked before.)


One thing I noticed is that the OO interface can be long-winded:

$ss{A3} = Spreadsheet::Perl::Formula('$ss->AddOne("A5") + $ss{A5}') ;

With some reimplementation work and some string parsing, this might be simplified to

$ss{A3} = '=AddOne(A5) + A5';

at the expense of some generality. Of course, you then have to be careful when you want to literally store the string '=AddOne(A5) + A5' rather than the formula 'AddOne(A5) + A5'. Maybe,

$ss->set_formula('A3', 'AddOne(A5) + A5');

Just a few ideas. (I also just noticed the method names are the of the style GetFormulaText rather than of the more Perlish get_formula_text.)

For a module with similar functionality but which does not flatten the problem onto a 2D grid, the psuedo-code for its usage might look like

  my $total = $subtotal * 1.05 + 5;
  my $subtotal = &sum(@v) + 100;
  my @v = (1..8);
  print $total;  # prints (&sum(1..8) + 100) * 1.05 +  5
  push @v, 9;
  print $total;  # prints (&sum(1..9) + 100) * 1.05 +  5

Of course, there's a variety of ways that might achive a workable syntax for that--tied variables, OO, source filtering, tricks with operator overloading, callback functions, or writing a full parser/interpreter.

-davidm



Reply via email to