Post Reply 
newRPL: all results mode?
01-22-2016, 01:41 PM
Post: #8
RE: newRPL: all results mode?
(01-22-2016 09:13 AM)Nigel (UK) Wrote:  I have a question: if 4 √ returns {2 -2} and 9 √ returns {3 -3}, then 4 √ 9 √ + would return {5 -5} if list addition acts element-by-element. However, there are four possible answers: {5 1 -1 -5}.
Is it intended that {a b} {c d} + returns { {a+c a+d} {b+c b+d} }?

You found a big hole in my all-solutions idea. In order for this to work, the +,*,^ operators (any binary operator, actually) should distribute the operation throughout the solutions, rather than work element by element. That would mean breaking the list processing operations when the "all-solutions" flag is enabled.
Not difficult to implement, but if you need to do any list processing (likely when you just received a list of results), you'd have to disable the all solutions mode before doing so.
This also means that using different names rather than a flag has to be discarded. A flag is the only way those binary operators can change behavior transparently.
Big question is: is it worth going there?

(01-22-2016 10:44 AM)emece67 Wrote:  And 4 √ 9 √ * would return {6 6}, 6, {6 -6} or even {{6 -6} {-6 6}}?
I guess that this interesting construct can give rise to many traps.

The ideal behavior should be:
  • Flattened list of results: { a b } { c d } + --> { a+c b+c a+d b+d }
  • No automatic collapsing of paths: Your example would return { 6 -6 -6 6 }
The first is self explanatory: if there's 4 results, they should all be treated equally, dealing with nested lists is a pain. A complicated expression could end up with numbers nested very deeply otherwise.
The second is more debatable: you could argue that if the results are the same, then it is not a separate solution path at all. But I think it's reassuring for the user to know that all paths were explored, even if they produce the same result.
This means 4 √ SQ --> { 4 4 }
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
newRPL: all results mode? - Claudio L. - 01-21-2016, 12:59 PM
RE: newRPL: all results mode? - rprosperi - 01-21-2016, 02:52 PM
RE: newRPL: all results mode? - Nigel (UK) - 01-21-2016, 04:14 PM
RE: newRPL: all results mode? - Claudio L. - 01-21-2016, 06:59 PM
RE: newRPL: all results mode? - rprosperi - 01-21-2016, 07:21 PM
RE: newRPL: all results mode? - Nigel (UK) - 01-22-2016, 09:13 AM
RE: newRPL: all results mode? - emece67 - 01-22-2016, 10:44 AM
RE: newRPL: all results mode? - Claudio L. - 01-22-2016 01:41 PM
RE: newRPL: all results mode? - Claudio L. - 01-22-2016, 02:08 PM
RE: newRPL: all results mode? - Nigel (UK) - 01-24-2016, 07:08 PM
RE: newRPL: all results mode? - Claudio L. - 01-25-2016, 02:31 PM
RE: newRPL: all results mode? - Nigel (UK) - 01-26-2016, 09:37 PM



User(s) browsing this thread: 1 Guest(s)