Post Reply 
(50g) USER key ": division" a) decimal into (pi) fractions b) no limits
01-07-2021, 09:39 PM
Post: #11
RE: HP50G USER key ": division" a) decimal into (pi) fractions b) no limits
(01-07-2021 08:01 PM)Gil Wrote:  Please note that
<<6 5 >
DROP
IFT >>

is not possible with DROP, as DROP is not an object.
That's not even the actual problem, it's that DROP isn't self-pushing. You need DROP to be on the stack when IFT is about to be eval'ed, and simply writing a command (or object, for that matter) doesn't do the trick unless it's self-pushing.
For UserRPL commands that are self-pushing, I only know of NOVAL which is used as a placeholder in some user interfaces and not really useful otherwise. In SysRPL there are TRUE and FALSE as well, which are generally much more useful, but that's irrelevant here since they are SysRPL. Many object types are also self-pushing, like all kinds of numbers, strings, etc. Some aren't though (like programs, global and local vars), which is important because otherwise you couldn't ever run anything. Wink
The simplest UserRPL way I know of to get any command on the stack would be to embed it into a list (which is a type of self-pushing object), then explode the list right after that. (If there is a simpler way, anybody is welcome to correct me. I'm more of a SysRPL person.) In the case of IFT, it seems you can actually skip the exploding step since it's a command that will just evaluate the content of a list as if it was a program instead.

All of those things considered, a working example for IFT with DROP would be:
Code:
\<<
  6. 5. >
  { DROP }
  IFT
\>>
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP50G USER key ": division" a) decimal into (pi) fractions b) no limits - 3298 - 01-07-2021 09:39 PM



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