Post Reply 
Free42 question - SIGN
09-10-2021, 08:40 AM (This post was last modified: 09-10-2021 12:09 PM by Werner.)
Post: #1
Free42 question - SIGN
Hello Thomas,
About the new 'list' type: what will SIGN produce?
Up until now, SIGN could be executed on ANY object in X.
Can't remember where, but I have made explicit use of that fact in the past.
It would seem logical that it performs SIGN on all its elements, so:
Will all the commands that work on matrices also work on a list (ie on all its elements)?
SIN, IP, FP, SIGN, ...

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
09-10-2021, 11:38 AM
Post: #2
RE: Free42 question - SIGN
On the HP-41C, SIGN was used to detect strings: it returns 0 for strings (and 1 for 0, unlike SIGN in BASIC, which returns 0 for 0).
On the HP-42S, there are specific functions for detecting types: REAL?, CPX?, MAT?, and STR?... and in that spirit, I added LIST? as well.

As for making all built-in functions work on lists in an element-wise fashion... Hmm, yes, that is a possibility. I'll have to think a bit about the details. I see RPL does this, but not recursively, so you can do, say, { 2 3 } SQ, but not { 2 3 { 5 7 } } SQ.
Visit this user's website Find all posts by this user
Quote this message in a reply
09-10-2021, 12:20 PM
Post: #3
RE: Free42 question - SIGN
Not all functions work on a matrix (well you know, of course), eg
5 x
works, but
5 MOD
does not, for some reason..
Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
09-10-2021, 06:20 PM
Post: #4
RE: Free42 question - SIGN
(09-10-2021 11:38 AM)Thomas Okken Wrote:  As for making all built-in functions work on lists in an element-wise fashion... Hmm, yes, that is a possibility. I'll have to think a bit about the details. I see RPL does this, but not recursively, so you can do, say, { 2 3 } SQ, but not { 2 3 { 5 7 } } SQ.

I believe that NewRPL functions are recursively listable however.
Find all posts by this user
Quote this message in a reply
Post Reply 




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