Subject: Re: HP48 contest
Date: Sun, 11 Aug 96 22:53:00 +0100
From: gilles.martinoty@genesis8.frmug.fr.net (GILLES MARTINOTY)
Organization: Genesis, the 8bit generation
Newsgroups: comp.sys.hp48

[Note: Do you ever use IFT or IFTE because they use less memory than
 IF THEN END or IF THEN ELSE END?  Then check out this nifty trick.
 -jkh-]

John H Meyers wrote:

JHM>> Also for IF THEN END and IF THEN ELSE END the arguments are collected
JHM>> into secondaries, if more than one object [or no object]. Thus
JHM>>
JHM>> { TrueToDo }
JHM>> { FalseToDo } IFTE is a better choise than using IF THEN ELSE END.

JHM>Well, it depends ...    E.g.:

JHM>IF ... THEN SWAP ELSE ROT END      ( 6 * 2.5 = 15   bytes ) *shorter*
JHM>          { SWAP }  { ROT } IFTE   ( 7 * 2.5 = 17.5 bytes )

True, but a trick exists: try the "empty tag" method i.e.
               ::SWAP  ::ROT IFTE      (6+6+2.5 = 14.5 bytes ) *shorter*

JHM>IF ... THEN 'X' RCL ELSE 'Y' STO END  ( 44   bytes ) *shorter*
JHM>  << 'X' RCL >> << 'Y' STO >> IFTE    ( 51.5 bytes )

JHM>Note that if you attempt to type in { 'X' RCL }, the HP48
JHM>interprets that as { X RCL }, which is not what you wanted!

Again, the "empty tag" method provides a nice workaround: simply use:
{ ::X RCL } {::Y STO } IFTE  ( 33.5  bytes ) *shorter*

Now, it's high time you rewrote all your programs that are using IFTE
loop :-))

Gilles.

 * SLMR 2.1a * Leftists are among the first to speak of their rights.
