I post the draft OSS for a kind of auto clear of a $var
from a string.
Any help or hint is welcome. No, I don't like a OOP orientation.
#!/usr/bin/perl -w*SKIP*
my $c; # incógnita*SKIP*
"1" => "$E = $m*$c**2", # El objetivo es poner
my $s = qr/[\=|\*|\+|\-|\/]/;
What this task requires are: first, parser; then algebra will emerge naturally. Instead you merge parser and algebra together and press them against scalar that is awfully similar to Perl (IOW, only perl can parse Perl, not gonna work!).
El 18/6/21 a las 14:38, Eric Pozharski escribió:*SKIP*
What this task requires are: first, parser; then algebra will emerge
naturally. Instead you merge parser and algebra together and press
them against scalar
Yes, there are parsers in symbolic math modules that could produce
trees. But AFAIK there isn't the option to clear a variable, so I
guess that that modules could be bridged to do the task. Or telling
the story otherwise, I don't know how that trees could simplify the algorithm.
with <saj8m6$unh$1@gioia.aioe.org> gamo wrote:
El 18/6/21 a las 14:38, Eric Pozharski escribió:
*SKIP*What this task requires are: first, parser; then algebra will emerge
naturally. Instead you merge parser and algebra together and press
them against scalar
Yes, there are parsers in symbolic math modules that could produce
trees. But AFAIK there isn't the option to clear a variable, so I
guess that that modules could be bridged to do the task. Or telling
the story otherwise, I don't know how that trees could simplify the
algorithm.
You're underestimating yourself. Of course you don't see algebra
emerging, but solely because you don't have the tree yet. Also, it
should be mentioned clearly -- that's you who will do all footwork, but that's curse of the conduct.
*CUT*
El 19/6/21 a las 15:22, Eric Pozharski escribió:
with <saj8m6$unh$1@gioia.aioe.org> gamo wrote:
El 18/6/21 a las 14:38, Eric Pozharski escribió:
Yes, you might be right. In particular, I don't sense the need forYou're underestimating yourself. Of course you don't see algebraWhat this task requires are: first, parser; then algebra willYes, there are parsers in symbolic math modules that could produce
emerge naturally. Instead you merge parser and algebra together
and press them against scalar
trees. But AFAIK there isn't the option to clear a variable, so I
guess that that modules could be bridged to do the task. Or telling
the story otherwise, I don't know how that trees could simplify the
algorithm.
emerging, but solely because you don't have the tree yet. Also, it
should be mentioned clearly -- that's you who will do all footwork,
but that's curse of the conduct.
parsing depth parentesees structures, but all these complicated work
is already done and you have to not to reinvent the wheel.
Yes, you might be right. In particular, I don't sense the need for
parsing depth parentesees structures, but all these complicated work
is already done and you have to not to reinvent the wheel.
Correct! But "work already done" are modules and, most probably,
classes. And this contradicts the conduct. Thus we arrive at the show-stopper, aka -- Cost of Opportunity.
I suggest to push this somewhat deeper on a todo list, doing something
else, and call it a night.
El 20/6/21 a las 14:08, Eric Pozharski escribió:*SKIP*
Yes, you might be right. In particular, I don't sense the need for
parsing depth parentesees structures, but all these complicated work
is already done and you have to not to reinvent the wheel.
I suggest to push this somewhat deeper on a todo list, doing
something else, and call it a night.
With simple test a lot of concerns arise:*SKIP*
Result:
m * (c ^ 2) (Math::Symbolic::Operator)
The result is good because it detects that * is the main pivot
operator.
I have to reconstruct the mental problem to adapt to this particular structure. Don't know it it fits, and I'm scared about parsing
parenthesees.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 286 |
Nodes: | 16 (2 / 14) |
Uptime: | 89:22:34 |
Calls: | 6,496 |
Calls today: | 7 |
Files: | 12,100 |
Messages: | 5,277,442 |