Post Reply 
User-defined functions in Free42
01-25-2021, 08:32 PM
Post: #41
RE: User-defined functions in Free42
Hmmm. Func does actually create variables "X" ... "L", but they are private and can't be accessed using RCL. The idea of making them private was to avoid cluttering up the regular variables namespace, and also to keep the way the backups are stored an implementation detail, so I can tinker with it and make it more efficient or whatnot.
Visit this user's website Find all posts by this user
Quote this message in a reply
02-23-2021, 07:26 PM
Post: #42
RE: User-defined functions in Free42
First I want to say that I love the FUNC functionality! It has made my code so much better.

It would be even better if it could optionally restore other global resources like the alpha register, indexed matrix state, flags, & registers.
Find all posts by this user
Quote this message in a reply
02-24-2021, 03:59 AM
Post: #43
RE: User-defined functions in Free42
One extension that would be useful in the infinite stack mode would be to immediately RTNERR after FUNC if the stack has too few arguments for the function.
Find all posts by this user
Quote this message in a reply
11-21-2022, 02:32 AM (This post was last modified: 11-21-2022 04:17 AM by kostrse.)
Post: #44
RE: User-defined functions in Free42
Sorry, I cannot find FUN in the catalog. How to enter it in program mode?

UPDATE: Found in the Catalog -> PRGM submenu,
Find all posts by this user
Quote this message in a reply
11-21-2022, 10:25 AM (This post was last modified: 11-21-2022 10:26 AM by Thomas Okken.)
Post: #45
RE: User-defined functions in Free42
(02-23-2021 07:26 PM)richmit Wrote:  First I want to say that I love the FUNC functionality! It has made my code so much better.

It would be even better if it could optionally restore other global resources like the alpha register, indexed matrix state, flags, & registers.

Indexed matrix state is already saved and restored automatically when needed; specifically, when the currently indexed matrix is hidden by LSTO, or when a local matrix is indexed.

You can use local registers simply by creating a local REGS using LSTO: size 1 NEWMAT LSTO "REGS".

As for a local alpha register and local flags: I agree those would be nice to have, and they are on my to-do list. They are a bit tricky to implement because this will require new state types on the RTN stack an new logic in RTN, and this is going to collide with some other substantial work I want to do on FUNC. So, it is in the pipeline, but don't expect it soon.

(02-24-2021 03:59 AM)richmit Wrote:  One extension that would be useful in the infinite stack mode would be to immediately RTNERR after FUNC if the stack has too few arguments for the function.

It should do that already. If not, please let me know, that would be a bug.

UPDATE: What, those questions were posted nearly two years ago? My apologies, somehow I never noticed them until now.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: