Post Reply 
HP49-50G : test IF THEN 'Instruction1' END ≠ test 'Instruction1' IFT
04-11-2021, 10:32 PM
Post: #7
RE: HP49-50G : test IF THEN 'Instruction1' END ≠ test 'Instruction1' IFT
(04-07-2021 03:02 AM)Han Wrote:  
(04-06-2021 11:44 PM)Gil Wrote:  The correct way is to use {} in that case.

So <<
5 6 < { 's<?s.0'} IFT
>> works perfectly and has a similar structure with

<< 5 6 < { SWAP} IFT >>.

That depends on what you mean by "correct way." The "correct way" according to the manual would have you use << blah >> for a program that you want to evaluate or ' blah ' for a formula you want to evaluate. When a program that is already running evaluates an object delimited by << >> (or by ' ', or { }), it will push the contents with those delimiters onto the stack (including the delimiters). This is necessary if you wish for IFT to evaluate a sequence of commands rather than just branch to an atomic object.

Since you wish for IFT's evaluation to push a formula to the stack, it needs to be done within a program. Hence << 'formula-to-push' >> would be the "correct way" because it is not possible to create an algebraic object whose evaluation pushes another algebraic object in User-RPL. A program is necessary for such a goal, and typically programs are delimited by << and >>.

The allowance for the use of { } in place of << >> has to do with how User-RPL was designed to evaluate composite objects. For composite objects, it simply just treats the contents as if it were a program during evaluation. Incidentally, algebraic objects are actually stored in the exact same manner as lists and programs (they are displayed differently, though) because they too are composite objects. The evaluation simply evaluates each object in the order that they appear (internally) in the list (left-to-right). So in theory (and in practices, as you have shown) you could simply create your programs (that you wish to push to the stack) using lists.

The advanced user's manual says that the last argument of IFT is any object.

Oops Blush I didn't see this post by you Blush You essentially say ( with more elaboration ) what I mentioned in my reply to your previous post Smile

Regards,

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP49-50G : test IF THEN 'Instruction1' END ≠ test 'Instruction1' IFT - Jonathan Busby - 04-11-2021 10:32 PM



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