Post Reply 
newRPL - build 1255 released! [updated to 1299]
12-20-2019, 10:36 PM
Post: #628
RE: newRPL - build 1255 released! [updated to 1299]
(12-20-2019 09:42 PM)The Shadow Wrote:  
(12-19-2019 11:43 PM)Claudio L. Wrote:  * New command MMAP, similar to MAP but for matrices/vectors. It takes a program or a symbolic and applies it to all elements. It defines variables i,j for the program to know the position of wach item, as well as Aij for the symbolic to know the existing element.


Oh my goodness this is nice! I actually wouldn't mind seeing 'i' and 'Ai' added to regular old MAP - though I suppose one could always do AXL << foo bar >> MMAP AXL. (It would act weird for lists of lists, but you're basically asking for it at that point!)

Yes, one of the reasons I decided to split the matrix functionality from MAP is because lists are more complicated, they can be nested within each other, and may contain absolutely any object.
With a vector/matrix object, having a pair of (i,j) is actually useful, and using a symbolic in place of a program is an idea I (cough) stole (cough) from MAKEMAT() on the Prime.
Since MMAP works on an existing matrix, you'd have to create one with CON then apply MMAP to get the equivalent of MAKEMAT().

I don't see why I couldn't add a local variable tracking an index for the regular MAP (other than slowing down the entire process, it doesn't cause any problems), much like the NSUB/ENDSUB commands do for DOSUBS. The variable 'Ai' wouldn't make sense, since MAP does not accept a symbolic, only a program, and the program receives the element in the stack. Same thing with MMAP, Aij does not exist when you use a program, only for symbolics.

(12-20-2019 09:42 PM)The Shadow Wrote:  I like the changes, but I'm still dubious of having variables be 'possibly infinite' by default. My gut says it makes more sense for them to be finite by default, but no doubt there may be something I'm missing, as so often in the past.

Is this something worth having a flag for?

The way I saw it originally is that simplifying for example A*0 with 0 is completely wrong unless you have certain knowledge about the variable A (in this case, you know A cannot be infinite). So the system should act on the safe side and leave it alone unless the user explicitly provides that knowledge.
On the other hand, when actually using it, it quickly gets annoying that all these trivial things don't get simplified: A/A, 0*A, A^0, etc. so I'd say a flag controlling the default assumptions is completely warranted (and I hate flags):
Flags for default assumptions:
* Force REAL: All variables assumed real (when no hint is given) regardless of Complex mode enabled or not. The default is variables assumed complex in complex mode, real otherwise.
* Force COMPLEX: All variables assumed complex (when no hint is given) regardless of Complex mode.
* Force FINITE: All variables assumed finite
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL - build 1001 released! - pier4r - 12-16-2017, 08:03 AM
newRPL - on Hp 39gs - Martin Hepperle - 06-05-2019, 06:51 AM
RE: newRPL - build 1001 released! - pier4r - 12-23-2017, 10:16 AM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 09:42 AM
t - Claudio L. - 01-01-2018, 03:06 PM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 03:41 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 04:54 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 06:58 PM
newRPL - brickviking - 10-05-2018, 06:01 AM
How to participate? - erazor - 12-13-2019, 07:12 AM
RE: newRPL - build 1255 released! [updated to 1299] - Claudio L. - 12-20-2019 10:36 PM



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