Post Reply 
DOSUBS with binary operations
05-15-2022, 06:27 PM (This post was last modified: 05-15-2022 06:29 PM by John Keith.)
Post: #4
RE: DOSUBS with binary operations
(05-15-2022 11:56 AM)Thomas Klemm Wrote:  Addendum:

It also works for more than two arguments as long as they are declared:
Code:
{ 1 2 3 4 5 }
\<< \-> u v w \<< u v + w * \>> \>>
DOSUBS

The result is:
Code:
{ 9 20 35 }

It appears to work with DOLIST as well, which is nice.
However, while it works with \<< * \>> it doesn't work with :: *.

We get:

DOLIST Error:
Bad Argument Type


Yes, another amusing inconsistency between DOSUBS and DOLIST. DOSUBS allows null-tags but DOLIST does not. You can however use :: * DTAG DOLIST which has a slight speed advantage at the cost of obscurity.

The HP49/50 libraries ListExt and GoferLists can use programs, lists or null-tags for (AFAIK) all higher-order functions, and lists and null-tags make programs smaller in bytes and almost always faster. One can wish that DOLIST, DOSUBS and STREAM would be able to use all three forms but unfortunately we're stuck with what we have, especially for the 48G.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: DOSUBS with binary operations - John Keith - 05-15-2022 06:27 PM



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