(Comp.sys.handhelds) Item: 3649 by colbach at nessie.cs.id.ethz.ch Author: [Philippe Colbach] Subj: CUT Program [also see STRIP on this disk. -jkh-] Date: Tue Jul 09 1991 Hi! The following programs cuts all unnecessary RPL structure elements! The programs become 10% shorter and quicker. But it will be difficult to change cut programs in the editor (you have to put cut elements back, otherwise the editor doesn't except the program structure ... ; I never wrote a program to do so ...). CUT program calls OUT-> and ->PRG (contained in the HACKIT library f.e.) It cuts: 1. [IF] THEN ELSE END 2. DO [UNTIL] END 3. Program markers << and >> 4. Nullprograms Example: << IF THEN DO UNTIL END ELSE END >> --CUT--> THEN DO END ELSE END --------- Resp: 1 of 1 by bson at wheat-chex.ai.mit.edu Author: [Jan Brittenson] Date: Tue Jul 09 1991 In a posting of [8 Jul 91 07:15:57 GMT] colbach@nessie.cs.id.ethz.ch (Philippe Colbach) writes: > It cuts: 1. [IF] THEN ELSE END > 2. DO [UNTIL] END > 3. Program markers << and >> This looks fine. Except if you cut IF, UNTIL, <<, and >>, your programs may cease to be interruptable with the ON key. > 4. Nullprograms Don't remove empty programs. They are likely there for a reason (like resetting some of the LAST data if evaluated), or may be used as templates by programs that build programs. Removing empty programs is comparable to removing empty lists - not a very good thing to do. While you're at it, you might consider: o Applying COLCT to all algebraics (is this wise?) o Reducing the size of all binary integers to their minimum o Replacing #xxxxx SYSEVAL with the address xxxxx; doesn't Joe Horn's PACK program do this? o Apply UNQT to all strings and names o If the value of a name is a pointer to ROM (< 70000), replace the name with the pointer; this would allow system RPL loops and constructs to be entered from the keyboard o Applying ASCI-> to names that start with percent; e.g. '%CA4B1' becomes SIN o Applying CUT recursively on programs and lists Happy hacking, -- Jan Brittenson bson@ai.mit.edu