HP 50g System RPL Reference the calculator’s internal language · 3,260 supported entries with addresses and stack diagrams

System RPL is the unchecked, internal layer User RPL sits on — the language the ROM itself is written in. Page 1 is a working introduction: the toolchain on the calculator, source format, bints, argument dispatch, locals, tests, loops and errors. The index lists every supported entry from Programming in System RPL (2nd ed.) by the book’s own chapters, each with its 49/50 ROM address and stack diagram. Hover an entry for the full description. The safe, documented layer lives on the HP 50g RPL sheet.

All entries are commands at fixed ROM addresses · ˆname = flash pointer · # means bint
Colour keythe machineentry, stack & displayprogrammingmathematicsdata objectssymbolic, solvers & financevariables & memoryinput, output & interfaceplotting & graphicsreference & system

System RPL Programmer's Guide

the internal layer — how to write it on the calculator itself

Anatomy four things that stay opaque until somebody draws them

Bints

A bint is not a number the way a % real is a number — it is a whole object, ten nibbles of memory. The first five are a prologue: the address of the ROM routine that knows how to handle this type. The last five are the value — twenty bits, 0 to 1,048,575. That is the entire type. Twenty bits is exactly one Saturn address, which is why every count, index, keycode and pixel coordinate on this sheet is a #: the machine has no cheaper number.

one bint object — 10 nibbles = 5 bytesprologuevaluewhat type this is20 bits of number
0x00013 = 190000000000000001001100013

Writing # 13 in your source compiles that whole ten-nibble object into the program. Writing BINT19 compiles one five-nibble address — 2.5 bytes — pointing at a bint that already exists in ROM. The ROM keeps 132 of them, BINT0 at 33107 and each next one exactly ten nibbles on, so FIFTYSIX (BINT56, the smiley’s starting x) sits at 33337. That is the whole reason ROM listings are full of named constants instead of literals.

Shown above as you would write it. How those five nibbles actually lie in memory is the next panel. Not to be confused with the user-level # binaries you type on the calculator — those are hex strings (chapter 7), a different object.

Secondaries & the runstream

A secondary is not compiled code. It is a list of addresses: :: is DOCOL, everything up to ; (SEMI) is one five-nibble pointer per word, and the interpreter’s runstream pointer walks them left to right. Almost every odd corner of the language falls out of that one fact.

the runstream walks this way  →::LAM yDUPBINT1#<ITE:: … ;:: … ;;DOCOL5 nibbles eachtaken by #<ITESEMI

A word costs 2.5 bytes because it is one address. ' ob tells the interpreter to push the next address instead of jumping to it — that is all quoting is. And when ITE or #<ITE is said to “take the next two objects”, it literally reads two cells out of the runstream and steps over them, which is why a bare #10+ is a complete branch: one word is one cell.

Nibble order

Multi-nibble fields are stored least significant nibble first. Nothing in the source hints at it; you either know it or the data comes out as noise.

memory order, as printed in the listing  →31000lowhigh

So the smiley grob’s height field, which appears in the listing as 31000, is read backwards as 000130x13, nineteen. Same five nibbles, and the difference between a 19-pixel sprite and a 200,704-pixel one. This is why the walkthrough at the foot of this page can say the sprite is 19 × 19 when the listing appears to say something else entirely.

Grobs — bits to pixels

A grob row is padded up to a whole byte, and inside each nibble the low bit is the leftmost pixel. So 19 pixels occupy three bytes with 5 bits of slack, and the bit you would write first is the one you read last.

240120010000100000100001000000byte 0byte 1byte 2
19 pixelspad

That is row 6 of the smiley — its eyes. Read the nibbles left to right as printed; inside each one, bit 0 is the leftmost pixel. Equivalently: each printed pair of nibbles is one byte stored low-nibble-first. Get that backwards and the face comes out mirrored in four-pixel blocks, which is exactly what a first attempt looks like.

What System RPL is

System RPL is the language the calculator’s own ROM is written in — the layer under User RPL. Same threaded interpreter, same stack, but no seatbelts: entries are called directly, nothing checks your arguments, numeric arguments are bints (20-bit system binaries) rather than reals, and a mistake corrupts memory instead of raising a polite error. In exchange a typical program runs 3–10× faster than its User RPL twin (the book’s circle-area example: 1.9 ms vs 15.6 ms).

Programs are built from supported entries — ROM addresses HP promised would stay put, each with a name in the community entry table. This sheet indexes 3,260 of them with their HP 49/50 addresses and stack diagrams. Names beginning ˆ are flash pointers (FPTR); six-digit addresses are rompointers/flash — MASD resolves all of them by name when extable is installed. Addresses are for the 49G/49g+/50g line; the HP 48 uses the same names at different addresses.

Getting started on the 50g

256 ATTACHattach the built-in Development Library: SYSEVAL-style tools, disassembler, and the compiler’s front endextable (library 258)the entry-point table — install it from hpcalc.org; with it on board, library 256 attaches itself and MASD knows every name in this sheetMASD (library 257)the on-board compiler/assembler; reached through ASM once 256 is attached"source" ASMcompile a source string (or the edited program) to an objectwarmstart holding B C D“smart mode”: forces library 256 attached and RPN default'STARTUP' STOa HOME variable run at every warmstart — reattach libraries, restore user keysCRLIB · SREV · DISASMbuild a library from source · ROM revision · disassemble any object — the built-in way to learn from ROM codeDebug4x + Emu48 (PC)the classic cross-development IDE; or your x50ng — crash the emulator, not the calculator

Back up first, always: a wrong entry ends in “Try To Recover Memory?”. Develop in the emulator, run on hardware when it works.

Source format & directives

!NO CODE @ MASD directives: allow SysRPL!RPL @ source in the text editor:: ( DOCOL — begin secondary ) CK1NOLASTWD ( one argument, please ) CK&DISPATCH1 real :: ( if it is a real… ) %2 %^ %PI %* ( πr² ) ;; ( SEMI — end )

Everything in ( ) is a comment; * in column 1 comments a line; System RPL is case-sensitive. Literals: # 3A a bint (hex), % 1.5 a real, $ "text" a string, ' ob quotes the next object to the stack. Assembly goes between CODE … ENDCODE. The example above is the book’s: 25 bytes, eight times faster than « SQ π * →NUM ».

Objects, bints and stack-diagram codes

Diagram shorthand used throughout the index: ob any object · # bint · % real · %% extended (15-digit) real · C%/%%C complex · $ string · CHR character · HXS hex string · Z zint · id/lam names · seco secondary · {} list · arry array · grob graphic · T/F/flag the TRUE/FALSE objects · meta = obs + count.

Bints are the workhorse: every count, index and coordinate. BINT0BINT255 and friends push constants from ROM at 2.5 bytes each; #+ #- #* #/ do arithmetic; R~SB/SB~B (library 256) convert on the command line. Extended reals (%%) carry 15 digits for accurate intermediates — %>%% and back. Meta objects are n objects plus their count on the stack — the CAS lives on them.

Argument checking & dispatch

A command begins by checking its arguments once — then runs unchecked. CK0NOLASTWDCK5NOLASTWD demand n arguments (CKn alone also saves the command name for error reports); CK&DISPATCH0/CK&DISPATCH1 branch on types (the 1-variant retries after stripping tags and turning zints to reals); CKn&Dispatch combines both.

:: CK2NOLASTWD CK&DISPATCH1 # 00011 :: ( %% : two reals ) … ; # 00005 :: ( list in 1 ) … ;;

Type digits, level 5→1 (from ch. 29): 0 any · 1 real · 2 cmp · 3 $ · 4 arry · 5 list · 6 id · 7 lam · 8 seco · 9 symb · B hxs · C grob · D tagged · E unit · two-digit codes 1F bint · 3F %% · 6F chr · FF zint … MASD also accepts the words real, cmp, str, lst, idnt, sym, grob for single arguments.

Local variables — temporary environments

{{ LAM x LAM y }} BINDtake two stack objects into named locals (top → last)LAM xrecall · ' LAM x STOLAM storesABNDabandon the environment — every BIND needs one1GETLAM … 22GETLAMpositional recall — fastest; 1GETLAM is the most recent1PUTLAM … 1GETABNDpositional store · fetch-and-abandon combinationsDOBIND bind n objects with names from the stackCACHE / DUMPsave a meta into a hidden environment and restore it

Named LAMs read clearest; numbered GETLAMs are what the ROM itself uses in hot paths. Nothing checks that an environment exists — an unmatched ABND is a crash.

Tests & conditionals

TRUE FALSE · flagreal objects on the stack, not numbers#= #< #> OB= EQ %<comparisons for bints, objects (contents vs pointer), realsIT obif TRUE, evaluate the next objectITE ob1 ob2if/else on the following two objects?SEMI ?SKIPreturn from the secondary / skip next if TRUECOLA obevaluate next object, then return — tail callSysITE / case wordscase, casedrop, ?CaseKeyDef … — the case family runs its clause and exits the secondaryAND OR XOR NOTon flags; ROT#=casedrop-style fused words do test+branch+cleanup in one entry

Loops & the runstream

# n ZERO_DO … LOOPDO-loop from 0 to n−1 (count on the stack first)DO … +LOOPexplicit start/stop, custom stepINDEX@ JINDEX@current (and outer) loop counterISTOP-INDEXstop and index of the innermost loopBEGIN … UNTIL / WHILE … REPEATindefinite loops on flags'R >R R>the runstream: grab the next object unevaluated, push/pull the return stack — how combinators like COLA and IT are built

Errors & safety

ERRSET ob ERRTRAP handlerthe IFERR of System RPL: run ob; on error run handlerERRJMPre-raise the current error# msg ERROROUTraise a numbered error (JstGETTHEMSG for its text)ABORT ATTNFLGCLRabort to the loop · clear the Cancel keyAtUserStack ClrDA1IsStathousekeeping entries around user-visible state

Errors thrown between BIND and ABND leak the environment unless the trap abandons it; the ROM idiom is ERRSET … ERRTRAP :: ABND ERRJMP ;.

Where to go deeper

This sheet is the reference half. The tutorial half is the book it was generated from: Programming in System RPL, 2nd ed. (Kalinowski & Dominik, 640 pp., free on hpcalc.org) — read chapters 1–3, 17–22 and 29 and you can write real programs. HP’s original RPLMAN (48-era) and the built-in disassembler (DISASM on any ROM word) fill in the rest. The User RPL layer, the menus and every user command are on the HP 50g RPL sheet; DB48X reimplements this whole world in modern C++.

Entries are named as extable names them; ˆ marks flash pointers. Addresses are 49G-series; they are what SYSEVAL wants (#3188h SYSEVAL is DUP).

Supported Entries

3,260 entries · grouped by the book’s chapters · hover for details

Binary Integers (BINTS)

136

Pushing Several BINTs

ZEROZERO( → #0 #0 )
#ZERO#ONE( → #0 #1 )
#ZERO#SEVEN( → #0 #7 )
ONEONE( → #1 #1 ) — aka: ONEDUP
#ONE#27( → #1 #27d )
#TWO#ONE( → #2 #1 )
#TWO#TWO( → #2 #2 )
#TWO#FOUR( → #2 #4 )
#THREE#FOUR( → #3 #4 )
#FIVE#FOUR( → #5 #4 )
ZEROZEROZERO( → #0 #0 #0 )
ZEROZEROONE( → #0 #0 #1 )
ZEROZEROTWO( → #0 #0 #2 )
DROPZERO( ob → #0 )
2DROP00( ob ob → #0 #0 )
DROPONE( ob → #1 )
DUPZERO( ob → ob ob #0 )
DUPONE( ob → ob ob #1 )
DUPTWO( ob → ob ob #2 )
SWAPONE( ob ob' → ob' ob #1 ) — . Name Description
ZEROSWAP( ob → #0 ob )
ZEROOVER( ob → ob #0 ob )
ZEROFALSE( → #0 F )
ONESWAP( ob → #1 ob )
ONEFALSE( → #1 F )

Conversion

COERCE( % → # )
COERCEDUP( % → # # )
COERCESWAP( ob % → # ob )
COERCE2( % %' → # #' )
%ABSCOERCE( % → # )
(COERCE&CKSGN)( % → # flag ) — TRUE if real is greater 0, else FALSE.
C%>#( C% → # #' )
HXS>#( hxs → # )
2HXSLIST?( { hxs hxs' } → # #' ) — Converts list of two hxs to two bints. Gener- ates "Bad Argument Value" for invalid input.
CHR>#( chr → # )
ˆZ2BIN( Z → # ) — Convert Z to bint. Returns FFFFF for over- flows. Returns 0 for negative numbers.
ˆZ>#( z → # ) — Coerces Z to #, overflow error if Z<0 or Z>9999. 10000 is used to insure that the #*6 can be represented in BCD on a 5 nibbles field.
ˆCOERCE2Z( z2 z1 → #2 #1 ) — Converts 2 zints to bints.

Arithmetic Functions

#+( # #' → #+#' )
#1+( # → #+1 )
#2+( # → #+2 )
#3+( # → #+3 )
#4+( # → #+4 )
#5+( # → #+5 )
#6+( # → #+6 )
#7+( # → #+7 )
#8+( # → #+8 )
#9+( # → #+9 )
#10+( # → #+10 )
#12+( # → #+12 )
#-( # #' → #-#' )
(CK#-)( # #' → #'' ) — If #' is greater than #, returns #0, otherwise re- turns #-#'.
#1-( # → #-1 )
#2-( # → #-2 )
#3-( # → #-3 )
#4-( # → #-4 )
#5-( # → #-5 )
#6-( # → #-6 )
#*( # #' → #*#' )
#*OVF( # #' → #*#' ) — 0 ≤ result ≤ FFFFF
#2*( # → #*2 )
#6*( # → #*6 )
#8*( # → #*8 )
#10*( # → #*10 )
#/( # #' → #r #q )
#2/( # → #/2 ) — Rounded down.
#1-( # #' → #-#'+1 ) — aka: #-+1
#1-+( # #' → #+#'-1 ) — $1-+ is a typo in EXTABLE. aka: #+-1, $1-+ . Name Description
#-#2/( # #' → (#-#')/2 )
#+DUP( # #' → #+#' #+#' )
#+SWAP( ob # #' → #+#' ob )
#+OVER( ob # #' → ob #+#' ob )
#-DUP( # #' → #-#' #-#' )
#-SWAP( ob # #' → #-#' ob )
#-OVER( ob # #' → ob #-#' ob )
#1+DUP( # → #+1 #+1 )
#1+SWAP( ob # → #+1 ob )
#1+ROT( ob ob' # → ob' #+1 ob )
#1-DUP( # → #-1 #-1 )
#1-SWAP( ob # → #-1 ob ) — aka: pull
#1-ROT( ob ob' # → ob' #-1 ob )
#1-UNROT( ob ob' # → #-1 ob ob' )
#1-1SWAP( # → 1 #-1 ) — Returns the bint ONE and the result.
DUP#1+( # → # #+1 )
DUP#2+( # → # #+2 )
DUP#1-( # → # #-1 )
2DUP#+( # #' → # #' #+#' ) — aka: DUP3PICK#+
DROP#1-( # ob → #-1 )
SWAP#-( # #' → #'-# )
SWAP#1+( # ob → ob #+1 ) — aka: SWP1+
('RSWAP#1+)( # → nob #+1 ) — nob is the next object in the runstream.
SWAP#1+SWAP( # ob → #+1 ob )
SWAP#1-( # ob → ob #-1 )
SWAP#1-SWAP( # ob → #-1 ob )
(SWAPDROP#1-)( ob # → #-1 )
SWAPOVER#-( # #' → #' #-#' )
OVER#+( # #' → # #'+# )
OVER#-( # #' → # #'-# )
ROT#+( # ob #' → ob #'+# )
ROT#-( # ob #' → ob #'-# )
ROT#1+( # ob ob' → ob ob' #+1 )
ROT#1+UNROT( # ob ob' → #+1 ob ob' )
ROT#+SWAP( # ob #' → #'+# ob ) — aka: ROT+SWAP
3PICK#+( # ob #' → # ob #'+# )
4PICK#+( # ob1 ob2 #' → # ob1 ob2 #'+# )
4PICK#+SWAP( # ob1 ob2 #' → # ob1 #'+# ob2 ) — aka: 4PICK+SWAP
#MIN( # #' → #'' )
#MAX( # #' → #'' )
#AND( # #' → #'' ) — Bitwise AND.

Tests

#=( # → flag )
#<>( # → flag )
#<( # → flag )
#>( # → flag )
#0<>( # → flag )
#0=( # → flag )
#1<>( # → flag )
#1=( # → flag )
#2<>( # → flag )
#2=( # → flag )
#3=( # → flag )
#5=( # → flag )
#<3( # → flag )
#>1( # → flag ) — aka: ONE#>
2DUP#<( # #' → # #' flag )
2DUP#>( # #' → # #' flag )
ONE_EQ( # → flag ) — Uses EQ test.
OVER#=( # #' → # flag )
2DUP#=( # #' → # #' flag )
OVER#0=( # #' → # #' flag )
DUP#0=( # → # flag )
OVER#<( # #' → # flag ) — . Name Description
DUP#1=( # → # flag )
OVER#>( # #' → # flag )
DUP#0<>( # → # flag )
DUP#<7( # → # flag ) — Returns TRUE if the argument is smaller then #7.
2#0=OR( # # → flag ) — Returns TRUE if either argument is zero.

Real Numbers

139

Built-in Real Numbers

1REV( → 6.28318530718 ) — ( → 360. ) ( → 400. ) Returns the angle of a full circle, corresponding to the current angular mode.

Stack Manipulation Combined with Reals

(DROP%0)( ob → %0 )

Conversion

%>%%( % → %% )
%>%%SWAP( ob % → %% ob )
%%>%( %% → % )
2%>%%( % % → %% %% )
2%%>%( %% %%' → % %' )
UNCOERCE( # → % )
UNCOERCE2( # # → % % )
UNCOERCE%%( # → %% )
HXS>%( hxs → % )
C%>%( C% → %re %im )
%IP>#( % → #IP(ABS(%)) ) — Does ABS too.
ˆZ>R( Z → % ) — Converts zint to real.
ˆZ2%%( Z → %% ) — Converts integer to long real.
ˆOBJ2REAL( z/% → % ) — Transforms ob in real.

Real Functions

%+( % %' → %+%' )
%+SWAP( ob % %' → %+%' ob )
%1+( % → %+1 )
%-( % %' → %-%' )
%1-( % → %-1 )
%>%%-( % %' → %%-%%' )
%*( % %' → %*%' ) — . Name Description
%10*( % → %*10 )
%/( % %' → %/%' )
( % %' → %ˆ%' )
%ABS( % → %' )
%CHS( % → -% )
%SGN( % → -1/0/1 )
%1/( % → 1/% )
%>%%1/( % → 1/%% ) — √
%SQRT( % → % ) — √
%>%%SQRT( % → %% )
%EXP( % → eˆ% )
%EXPM1( % → eˆ%-1 )
%LN( % → LN% )
%LNP1( % → LN(%+1) )
%LOG( % → LOG% )
%ALOG( % → 10ˆ% )
%SIN( % → SIN% )
%COS( % → COS% )
%TAN( % → TAN% )
%ASIN( % → ASIN% )
%ACOS( % → ACOS% )
%ATAN( % → ATAN% )
%SINH( % → SINH% )
%COSH( % → COSH% )
%TANH( % → TANH% )
%ASINH( % → ASINH% )
%ACOSH( % → ACOSH% )
%ATANH( % → ATANH% )
%MANTISSA( % → %mant )
%EXPONENT( % → %expn )
%FP( % → %frac )
%IP( % → %int )
%FLOOR( % → %maxint <=% )
%CEIL( % → %minint >=% )
%MOD( % %' → %rem )
%ANGLE( %x %y → %ang )
%>%%ANGLE( %x %y → %%ang )
RNDXY( % %places → %' )
TRCXY( % %places → %' )
%COMB( % %' → COMB(%,%') )
%PERM( % %' → PERM(%,%') )
%NFACT( % → %! ) — Calculates factorial of number.
%FACT( % → gamma(%+1) ) — Calculates gamma(x+1).
%NROOT( % %n → %' ) — Calculates the %nth root of the real number. Equivalent to user function XROOT.
%MIN( % %' → %lesser )
%MAX( % %' → %greater )
%MAXorder( % %' → %max %min )
%RAN( → %random ) — Returns next random number.
%RANDOMIZE( %seed → ) — System level RDZ: seeds the random number gen- erator.
DORANDOMIZE( % → ) — Stores given number as random number seed.
%OF( % %' → %'/% * 100 )
%T( % %' → %pctotal )
%CH( % %' → %pcchange )
%D>R( %deg → %rad )
%R>D( %rad → %deg )
%REC>%POL( %r %ang → %x %y )
%POL>%REC( %x %y → %r %ang )
%SPH>%REC( %r %ang %ph → %x %y %z )

Extended Real Functions

%%+( %% %%' → %%+%%' )
%%-( %% %%' → %%-%%' )
%%*( %% %%' → %%*%%' )
%%*ROT( ob ob' %% %%' → ob' %%+%%' ob )
%%*SWAP( ob %% %%' → %%+%%' ob )
%%*UNROT( ob ob' %% %%' → %%+%%' ob ob' ) — . Name Description
%%/( %% %%' → %%/%%' )
SWAP%%/( %% %%' → %%'' )
%%/>%( %% %%' → % )
%%ˆ( %% %%' → %%ˆ%%' )
ˆCK%%SQRT( %% → %%/C%% )
%%SINRAD( %% → %%' )
%%ANGLERAD( %% → %%' )
%%ABS( %% → %%abs )
%%ACOSRAD( %% → %%rad )
%%ANGLE( %%x %%y → %%ang )
%%ANGLEDEG( %%x %%y → %%deg )
%%ASINRAD( %% → %%rad )
%%CHS( %% → -%% )
%%1/( %% → 1/%% )
%%COS( %% → %%cos )
%%COSDEG( %%deg → %%cos )
%%COSH( %% → %%cosh )
%%COSRAD( %%rad → %%cos )
%%EXP( %% → eˆ%% )
%%LN( %% → ln %% )
%%FLOOR( %% → %%maxint ) — aka: %%INT
%%LNP1( %% → %%ln(%%+1) )
%%MAX( %% %%' → %%max )
%%R>P( %%x %%y → %%radius %%angle )
%%P>R( %%r %%ang → %%x %%y )
%%SIN( %% → %%sin )
%%SINDEG( %%deg → %%sin )
%%SINH( %% → %%sinh ) — √
%%SQRT( %% → %% )
%%TANRAD( %%rad → %%tan )

Tests

%=( % %' → flag )
%<>( % %' → flag )
%<( % %' → flag )
%<=( % %' → flag )
%>( % %' → flag )
%>=( % %' → flag )
%0=( % → flag )
DUP%0=( % → flag )
%0<>( % → flag ) — Can be used to change a user flag into a system flag.
%0<( % → flag )
%0>( % → flag )
%0>=( % → flag )
%%<( %% %%' → flag )
%%<=( %% %%' → falg )
%%>( %% %%' → flag )
%%>=( %% %%' → flag )
%%0=( %% → flag )
%%0<>( %% → flag )
%%0<( %% → flag )
%%0<=( %% → flag )
%%0>( %% → flag )
%%0>=( %% → flag )

Complex Numbers

54

Builtin Complex Numbers

C%0(0,0)
C%1(1,0)
C%-1(-1,0)
C%%1(%%1,%%0)

Conversion

C%%>C%( C%% → C% )
%>C%( %re %im → C% )
SWAP%>C%( %im %re → C% )
Re>C%( %re → C% )
C>Re%( C% → %re )
C>Im%( C% → %im )
ˆE%%>C%%( %%re %%im → C%% ) — Converts long reals to long complex.
%%>C%( %%re %%im → C% )
C%>%%( C% → %%re %%im )
C%>%%SWAP( C% → %%im %%re )
C%%>%%( C%% → %%re %%im )
ˆC2C%%( C → C%% ) — Converts Gaussian integer to long complex.
ˆZZ2C%%ext( Zre Zim → C%% ) — Converts Gaussian integer to long complex.
ˆC%>C%%( C% → C%% ) — Converts complex to long complex.
ˆRIXCext( Zre Zim → C ) — Convert integers to complex.
ˆIRXCext( Zim Zre → C ) — Convert integers to complex.

Functions

C%CˆC( C% C%' → C%'' )
C%CˆR( C% % → C%' )
C%RˆC( % C% → C%' )
C%ABS( C% → % )
ˆCZABS( complex → real ) — Absolute value.
C%CHS( C% → -C% )
C%1/( C% → 1/C% ) — √
C%SQRT( C% → C% )
C%SGN( C% → C%/C%ABS ) — . Name Description
C%CONJ( C% → C%' )
C%ARG( C% → % )
C%EXP( C% → eˆC% )
C%LN( C% → ln C% )
C%LOG( C% → log C% )
C%ALOG( C% → 10ˆC% )
C%SIN( C% → sin C% )
C%COS( C% → cos C% )
C%TAN( C% → tan C% )
C%ASIN( C% → asin C% )
C%ACOS( C% → acos C% )
C%ATAN( C% → atan C% )
C%SINH( C% → sinh C% )
C%COSH( C% → cosh C% )
C%TANH( C% → tanh C% )
C%ASINH( C% → asinh C% )
C%ACOSH( C% → acosh C% )
C%ATANH( C% → atanh C% )
C%%CHS( C%% → -C%% )
C%%CONJ( C%% → C%%' )
ˆARG2( im re → arg(ob) ) — ARG.
ˆQUADRANT( re im ?re>0 ?im>0 → newre newim % ) — Returns Z0 Z1 Z-2 or Z-1 so that arg of correspond- ing complex number is Z * π/2 + theta where θ is in the interval [0,π/2].
ˆC%%SQRT( C%% → C%%' )

Tests

C%0=( C% → flag )
C%%0=( C%% → flag )

Characters and Strings

107

Built-in Strings with Stack Manipulation

NULL$SWAP( ob → $ ob ) — NULL$, then SWAP.
DROPNULL$( ob → NULL$ ) — DROP then NULL$.
NULL$TEMP( → $ ) — Creates null string in temporary memory (NULL$, then TOTEMPOB).

Conversion

#>$( # → $ ) — Creates string from the bint (decimal).
#:>$( # → "#: " ) — Creates string from the bint and appends a colon and a space. Ex: "1: "
a%>$( % → $ ) — Converts real number into string using current display mode. aka: a%>$,
ID>$( id/lam → $ ) — Converts identifier into string.
DOCHR( % → $ ) — Creates string of the character with the number speci- fied.
ˆZ>S( Z → $ ) — Converts Z into a string (decimal).
hxs>$( hxs → $ ) — Uses current display mode and wordsize.
HXS>$( hxs → $ ) — Does hxs>$ and then appends base character.

Management

#>CHR( # → chr ) — Returns character with the specified ASCII code.
CHR>$( chr → $* Strings ) — Converts a character into a string.
LEN$( $ → #length ) — Returns length in bytes.
DUPLEN$( $ → $ # ) — DUP then LEN$.
OVERLEN$( $ ob → $ ob #len ) — OVER then LEN$.
NEWLINE$&$( $ → "$\0a" ) — Appends newline character to string. aka: NEWLINE&$
APNDCRLF( $ → $' ) — Appends carriage return and line feed to string.
CAR$( $ → chr ) — Returns first character of string as a string, or NULL$ for null string.
CDR$( $ → $' ) — Returns string without first character, or NULL$ for null string.
POS$( $ $find start# → #pos ) — Search for $find in $search, starting at posi- tion #start. Returns position of $find or 0 if not found. Same entry as POSCHR.
POSCHR( $search chr #start → #pos ) — Same entry as POS$.
POS$REV( $ $find #limit → #pos ) — Searches backwards from #limit to #1. Same entry as POSCHRREV.
POSCHRREV( $seach chr #start → #pos ) — Same entry as POS$REV. . Name Description
COERCE$22( $ → $' ) — If the string is longer than 22 characters, trun- cates it to 21 characters and appends "...".
Blank$( #len → $ ) — Creates a string with the specified number of spaces.
PromptIdUtil( id ob → $ ) — Creates string of the form "id: ob".
SEP$NL( $ → $' $'' ) — Separates string at the first newline. $'' is the substring before the first newline; $' the sub- string after the first newline.
(ˆWRAP$)( $ #width → $' ) — Replace SPACE chars with NEWLINE in or- der to fit the text in the given #width. Used by ViewStrObject. Very fast (bang type).
SUB$( $ #start #end → $' ) — Returns substring between specified positions.
#1-SUB$( $ #start #end+#1 → $' ) — Does #1- and then SUB$.
1_#1-SUB$( $ #end → $' ) — Returns substring from the first character to the character before the specified position. aka: 1_#1-SUB
LAST$( $ #start → $' ) — Returns substring from the specified start po- sition to the end (inclusive).
#1+LAST$( $ #start-#1 → $' ) — Returns substring from the specified start po- sition to the end (exclusive).
SUB$SWAP( ob $ # #' → $' ob ) — SUB$ then SWAP.
SUB$1#( $ # → #' ) — Returns bint with ASCII code of character at the specified position.
EXPAND( hxs #nibs → hxs' ) — Appends null characters to the string. Since refers to the number of nibbles, you must use a number twice as large as the number of null characters yo
&$( $ $' → $+$' ) — Concatenates two strings.
&$SWAP( ob $ $' → $+$' ob ) — &$ then SWAP.
!append$( $ $' → $+$' ) — Tries &$, if not enough memory does !!ap- pend$?.
!insert$( $ $' → $'+$ ) — Does SWAP then !append$.
!append$SWAP( ob $ $' → $+$' ob ) — !append$ then SWAP.
!!append$?( $ $' → $+$' ) — Attempts append "in place" if target is in tem- pob.
!!append$( $ $' → $+$' ) — Tries appending "in place".
!!insert$( $ $' → $'+$ ) — Tries inserting "in place".
>H$( $ chr → $' ) — Prepends character to string
>T$( $ chr → $' ) — Appends character to string.
APPEND_SPACE( $ → $' ) — Appends space to string.
SWAP&$( $ $' → $'+$ ) — Concatenates two strings.
TIMESTR( %dt %tm → "dy dt tm" ) — Returns string representation of time, using current format. Example: "WED 06/24/98 10:00:45A"
AND$( $1 $2 → $' ) — Logical AND. Errors if strings are not the same length. . Name Description
OR$( $ $' → $'' ) — Logical OR. Errors if strings are not the same length.
XOR$( $ $' → $'' ) — Logical XOR. Errors if strings are not the same length.
CHARSEDIT( → ) — HP49 character browser. This is an interac- tive application from which characters can be echoed into the command line.

Parsing Strings

DOSTR>( $ → ? ) — Internal version of STR→.
palparse( $ → ob T ) — ( $ → $ #pos $' F ) Tries parsing a string into an object. If success- ful, returns object and TRUE, otherwise returns position of error, the offendin
!*trior( F → <SKIP> ) — ( T T → <COLA> )
!*triand( T T → ) — ( F T → F T <SEMI> )
tok8cktrior( $1 $1 → :: $1 <Ob1> ; ) — ( $1 $2 → :: $1 <Ob2> <Rest> ; )
tok8trior( GNT data $1 $1 → :: GNT data Get- NextToken ; ) — ( GNT data $1 $2 → :: $1 <Ob1> <Rest> ; )
nultrior( NULL$ → :: ; ) — ( $ → :: $ <Ob1> <Rest> ; )
GetNextToken( hxs-mask $ #start → hxs-mask $ #next $token )
getmatchtok( hxs-mask $ #loc $_tok → hxs-mask $ #next $match )
ParseFail( ob $parsed #pos $' → ) — Uses DispBadToken to re-edit the parsed string and displays "Syntax Error".
DispBadToken( ob $parsed #pos $' → ) — Re-edits the parsed string, positions the cursor to the location of the error. Used by ParseFail.

Decompilation

!DcompWidth( # → ) — Sets the width (in characters) of decompiled strings. This width is used to cut the re- sulting string (for stack display) or to break it into lines (
DcompWidth@( → # ) — Recalls the width of decompiled strings (in characters).
setStdWid( → ) — Sets DcompWidth to the standard value for stack display, either 19 or 30 characters, de- pending on system flag 72 (stack minifont).
setStdEditWid( → ) — Sets DcompWidth to the width for editing, either 21 or 32 characters, depending on sys- tem flag 73 (edit minifont).
stkdecomp$w( ob → $ ) — Decompiles for stack display using the cur- rent DcompWidth to cut the string if it is too long. . Name Description
1stkdecomp$w( ob → $ ) — Calls setStdWid and decompiles for stack display (cutting the string if necessary).
Decomp1Line( ob → $ ) — Same as 1stkdecomp$w.
RPNDecomp1Line( ob → $ ) — Same as Decomp1Line but enforce RPN mode (system flag 95 clear) during execu- tion.
>Review$( id → $ ) — Makes a string from the variable name and its contents (decompiled with De- comp1Line), for display with the review key.
DecompStd1Line32( ob → $ ) — Sets 32 as DcompWidth and decompiles us- ing stkdecomp$w.
RPNDecompStd1Line32( ob → $ ) — Same as DecompStd1Line32 but enforce RPN mode (system flag 95 clear) during ex- ecution.
DecompStd1Line( ob → $ ) — Calls setStdWid and decompiles, cutting if the string becomes too long.
RPNDecompStd1Line( ob → $ ) — Same as DecompStd1Line but enforce RPN mode (system flag 95 clear) during execu- tion.
Decomp#Disp( ob # → $ ) — Calls setStdWid and decompiles ob (User- RPL components only), breaks the string into lines and returns the first #+1 lines. Used for multiline displa
RPNDecomp#Disp( ob # → $ ) — Same as Decomp#Disp but enforce RPN mode (system flag 95 clear) during execu- tion.
Decomp#Line( ob # → $ ) — Similar to Decomp#Disp, but the returned string is an internal representation of the different lines to be displayed. Used for mul- tiline display in
RPNDecomp#Line( ob # → $ ) — Same as Decomp#Line but enforce RPN mode (system flag 95 clear) during execu- tion.
editdecomp$w( ob → $ ) — Decompiles entire object for editing. It only decompiles the UserRPL components. Some System RPL entries like TakeOver are sim- ply skipped, others ar
EDITDECOMP$( ob → $ ) — Calls setStdEditWid and the decompiles for editing like editdecomp$w.
DecompEdit( ob → $ ) — Same as EDITDECOMP$.
RPNDecompEdit( ob → $ ) — Same as DecompEdit but enforce RPN mode (system flag 95 clear) during execu- tion.
AlgDecomp( ob → $ ) — Calls DecompEdit with a few checks around it.
DECOMP$( ob → $ ) — Calls setStdWid and decompiles entire ob- ject (UserRPL components only). Breaks the string into lines using DcompWidth as width.
(ob&$)( ob $ → "ob$" ) — Applies DECOMP$ to ob and concatenates with the string.
($&ob)( $ ob → "$ob" ) — Applies DECOMP$ to ob and concatenates with the string. . Name Description
DO>STR( $ → $ ) — ( ob → $ ) Internal version of →STR.
ˆDO>STRID( id/ob → $ ) — Like DO>STR but without quotes for id.
DecompEcho( ob → $ ) — Calls setStdEditWid and decompiles the entire object (UserRPL only) into a single line.
RPNDecompEcho( ob → $ ) — Same as DecompEcho but enforce RPN mode (system flag 95 clear) during execu- tion.
Decomp%Short( % #width → $ ) — Decompiles a real number into a string of the given #width. It will drop less signifi- cant digits or add zeros as needed, but will also exceed #width
ˆFSTR1( ob → $ ) — The decompiler used by stkdecomp$w, 1stkdecomp$w, Decomp1Line, Decomp- Std1Line32. DcompWidth must be set be- fore this is called.
ˆFSTR3( ob # → $ ) — The decompiler used by Decomp#Line. DcompWidth must be set before this is called.
ˆFSTR4( ob → $ ) — The decompiler used by editdecomp$w, DecompEdit, EDITDECOMP$. DcompWidth must be set before this is called.
ˆFSTR5( ob → $ ) — The decompiler used by DecompEcho. DcompWidth must be set before this is called.
ˆFSTR6( ob # → $ ) — The decompiler used by Decomp#Line. DcompWidth must be set before this is called.
ˆFSTR7( ob → $ ) — The decompiler used by DO>STR. Dcomp- Width must be set before this is called.
ˆFSTR9( ob → $ ) — The decompiler used by DecompStd1Line. DcompWidth must be set before this is called.
ˆFSTR13( ob → $ ) — The decompiler used by DECOMP$. Dcomp- Width must be set before this is called.
palrompdcmp( romptr → $ T ) — Decompiles a rompointer for the UserRPL stack. If it is a named rompointer, returns the name. Otherwise returns "XLIB n m".

String Tests

NULL$?( ob → flag )
DUPNULL$?( ob → ob flag )
CkChr00( $ → $ flag ) — Returns FALSE if string contains any null charac- ters.

Hex Strings

39

Conversion

#>HXS( # → hxs ) — Length will be five.
%>#( % → # ) — Converts real number into hxs. Should be called %>HXS.

General Functions

WORDSIZE( → # ) — Returns the current wordsize as a bint.
dostws( # → ) — Sets the current wordsize. 055D5 NULLHXS HXS 0 Puts a null hxs in the stack.
&HXS( hxs hxs' → hxs'' ) — Appends hxs'' to hxs'.
EXPAND( hxs #nibs → hxs' ) — Appends #nibs zero nibbles to the hxs.
LENHXS( hxs → #nibs ) — Returns length in nibbles.
SUBHXS( hxs #m #n → hxs' ) — Returns sub hxs string.
bit+( hxs hxs' → hxs'' ) — Adds two hxs.
bit%#+( % hxs → hxs' ) — Adds real to hxs, returns hxs.
bit#%+( hxs % → hxs' ) — Adds real to hxs, returns hxs.
bit-( hxs hxs' → hxs'' ) — Subtracts hxs2 from hxs1.
bit%#-( % hxs → hxs' ) — Subtracts hxs from real, returns hxs.
bit#%-( hxs % → hxs' ) — Subtracts real from hxs, returns hxs.
bit*( hxs hxs' → hxs'' ) — Multiplies two hxs.
bit%#*( % hxs → hxs' ) — Multiplies real by hxs, returns hxs.
bit#%*( hxs % → hxs' ) — Multiplies hxs by real, returns hxs.
bit/( hxs hxs' → hxs'' ) — Divides hxs1 by hxs2.
bit%#/( % hxs → hxs' ) — Divides real by hxs, returns hxs. . Name Description
bit#%/( hxs % → hxs' ) — Divides hxs by real, returns hxs.
bitAND( hxs hxs' → hxs'' ) — Bitwise AND.
bitOR( hxs hxs' → hxs'' ) — Bitwise OR.
bitXOR( hxs hxs' → hxs'' ) — Bitwise XOR.
bitNOT( hxs → hxs' ) — Bitwise NOT.
bitASR( hxs → hxs' ) — Arithmetic shift one bit to the right. The most signif- icant bit (the sign) does not change.
bitRL( hxs → hxs' ) — Shifts circularly one bit to the left.
bitRLB( hxs → hxs' ) — Shifts circularly one byte to the left
bitRR( hxs → hxs' ) — Shifts circularly one bit to the right.
bitRRB( hxs → hxs' ) — Shifts circularly one byte to the right.
bitSL( hxs → hxs' ) — Shifts one bit to the left.
bitSLB( hxs → hxs' ) — Shifts one byte to the left.
bitSR( hxs → hxs' ) — Shifts one bit to the right.
bitSRB( hxs → hxs' ) — Shifts one byte to the right.

Tests

HXS==HXS( hxs hxs' → %flag ) — == test
HXS#HXS( hxs hxs' → %flag ) — 6= test
HXS<HXS( hxs hxs' → %flag ) — < test
HXS>HXS( hxs hxs' → %flag ) — > test
HXS>=HXS( hxs hxs' → %flag ) — ≥ test
HXS<=HXS( hxs hxs' → %flag ) — ≤ test

Tagged Objects

7

Reference

>TAG( ob $tag → tagged ) — Tags an object.
USER$>TAG( ob $tag → tagged ) — Maximum of 255 characters in string.
%>TAG( ob % → tagged ) — Converts real to string using current display mode and tags object.
ID>TAG( ob id/lam → tagged ) — Tags object with identifier or lam.
TAGOBS( ob $tag → tagged ) — ( ob.. { $.. } → tagged... ) Tags one or more objects. . Name Description
STRIPTAGS( tagged → ob ) — Strips all tags from the object.
STRIPTAGSl2( tagged ob' → ob ob' ) — Strips all tags from the object in level two.

Arrays

29

General Functions

GETATELN( # [] → ob T ) — ( # [] → F ) Gets one element from array.
ˆMDIMS( [[]] → #rows #cols T ) — ( [] → #elem F ) Returns the size of an array. Equivalent to the HP48 command MDIMS.
MDIMSDROP( [2D] → #m #n ) — MDIMS followed by DROP.
ˆDIMLIMITS( [] → { # } ) — ( [[]] → {# #} ) Returns the size of an array, like the User com- mand SIZE, but the lengths are bints and not re- als. Equivalent to the HP48 command
ˆARSIZE( [] → # ) — Returns max # in an array.
OVERARSIZE( [] ob → [] ob #elts ) — Does OVER then ARSIZE.
PULLREALEL( [%] # → [%] % ) — Gets real element.
PULLCMPEL( [C%] # → [C%] C% ) — Gets complex element.
PUTEL( [%] % # → [%]' ) — ( [C%] C% # → [C%]' ) Puts element at specified position. Converts to "short" before. Warning: no copy to tempob first.
PUTREALEL( [%] % # → [%]' ) — Puts real element at specified position. Warning: no copy to tempob first.
PUTCMPEL( [C%] C% # → [C%]' ) — Puts complex element at specified position. Warning: no copy to tempob first.
ˆMATTRAN( M → M' ) — Matrix transposition.
ˆYext( V2 V1 → ob ) — Scalar product of symbolic vectors, no check.

Conversion

ˆBESTMATRIXTYPE( ob → ob ) — Converts symbolic matrix with real/cmplex entries to a numeric array.
ˆCKNUMARRY( ob → ob ) — Tests if ob is a numeric array. Tries to convert symbolic array to numeric array.
ˆMATRIX2ARRAY( [] → [] ) — ( [[]] → [[]] ) Tries to convert a symbolic matrix to a nu- meric one.
ˆListToArry( {}/{{}} → []/[[]] TRUE ) — ( {}/{{}} → FALSE ) If possible, converts list of lists to normal array and returns TRUE. Otherwise, returns FALSE.
ˆXEQ>ARRY( ob1...obn {%n} → [] ) — ( ob11...obmn {%m %n} → [[mxn]] ) Builds a matrix a la →ARRY.
ˆXEQARRY>( [] → ob1...obn meta-arry ) — Explodes a matrix a la →ARRY. . Name Description
ˆArryToMatrix( [] → M ) — Converts array to symbolic array.

Statistics

STATCLST( → ) — Clears ΣDAT.
STATSADD%( % → ) — Internal Σ+.
STATN( → N ) — Internal NΣ.
STATSMIN( → % ) — Internal MINΣ.
STATSMAX( → % ) — Internal MAXΣ.
STATMEAN( → % ) — ( → [] ) Internal MEAN.
STATSTDEV( → % ) — ( → [] ) Internal SDEV.
STATTOT( → % ) — ( → [] ) Internal TOT.
STATVAR( → % ) — ( → [] ) Internal VAR.

Composite Objects

68

General Operations

&COMP( comp comp' → comp'' ) — Concatenates two composites.
>TCOMP( comp ob → comp+ob ) — Adds ob to tail (end) of composite.
>HCOMP( comp ob → ob+comp ) — Adds ob to head (beginning) of composite.
(SWAP>HCOMP)( ob comp → ob+comp ) — Does SWAP then >HCOMP.
CARCOMP( comp → ob_head ) — ( comp_null → comp_null ) Returns first object of the composite, or a null composite if the argument is a null composite.
?CARCOMP( comp T → ob ) — ( comp F → comp ) If the flag is TRUE, does CARCOMP.
CDRCOMP( comp → comp-ob_head ) — ( comp_null → comp_null ) Returns the composite minus its first object, or a null composite if the argument is a null composite.
(2NELCOMPDROP)( comp → ob2 ) — Gets the second element of composite.
ˆLASTCOMP( comp → ob ) — Gets the last element of composite. Does DU- PLENCOMP then NTHCOMPDROP.
LENCOMP( comp → #n ) — Returns length of composite (number of ob- jects).
DUPLENCOMP( comp → comp #n ) — Does DUP then LENCOMP.
NULLCOMP?( comp → flag ) — If the composite is empty, returns TRUE.
DUPNULLCOMP?( comp → comp flag ) — Does DUP then NULLCOMP?.
NTHELCOMP( comp #i → ob T ) — ( comp #i → F ) Returns specified element of composite and TRUE, or just FALSE if it could not be found.
NTHCOMPDROP( comp #i → ob ) — Does NTHELCOMP then DROP.
NTHCOMDDUP( comp #i → ob ob ) — Does NTHCOMPDROP then DUP.
POSCOMP( comp ob pred → #i ) — ( comp ob pred → #0 ) (eg: pred = ' %<) Evaluates pred for all elements of composite and ob, and returns index of first object for which the pred is T
EQUALPOSCOMP( comp ob → #pos ) — ( comp ob → #0 ) POSCOMP with EQUAL as test.
NTHOF( ob comp → #i ) — ( ob comp → #0 ) Does SWAP then EQUALPOSCOMP.
ˆListPos( ob {} → #i / #0 ) — Equivalent to NTHOF, but faster. However, it only works for lists.
#=POSCOMP( comp # → #i ) — ( comp # → #0 ) POSCOMP with #= as test.
SUBCOMP( comp #m #n → comp' ) — Returns a sub-composite. Makes all index checks first.
matchob?( ob comp → T ) — ( ob comp → ob F ) Returns TRUE if ob is EQUAL to any element of the composite. . Name Description
Embedded?( ob1 ob2 → flag ) — Returns TRUE if ob2 is embedded in, or is the same as, ob1. Otherwise returns FALSE.
Find1stTrue( comp test → ob T ) — ( comp test → F ) Tests every element for test. The first one that returns TRUE is put into the stack along with TRUE. If no object returned TRUE, FAL
Lookup( ob test comp → nextob T ) — ( ob test comp → ob F ) Tests every odd element (1,3,...) in the com- posite. If a test returns TRUE, the object after the tested one is returned, alo
Lookup.1( ob test → nextob T ) — ( ob test → ob F ) Return Stack: ( comp → ) Lookup with the composite already pushed (with >R) onto the runstream. Called by Lookup.
EQLookup( ob comp → nextob T ) — ( ob comp → ob F ) Lookup with EQ as test.
NEXTCOMPOB( comp #ofs → comp #ofs' ob T ) — ( comp #ofs → comp F ) Returns object at specified nibble offset from start. If the object is SEMI (i.e., the end of the composite has been reached) r

Building

{}N( obn..ob1 #n → { obn..ob1 } )
::N( ob1..obn #n → :: ob1..obn ; )
SYMBN( ob1..obn #n → symb ) — Build a symbolic object.
EXTN( ob1..obn #n → u ) — Builds a unit object.
P{}N( ob1..obn #n → {} ) — Build list with possible garbage collection.

Exploding

INNERCOMP( comp → obn..ob1 #n )
DUPINCOMP( comp → comp obn..ob1 #n )
SWAPINCOMP( comp obj → obj obn..ob1 #n )
INCOMPDROP( comp → obn..ob1 )
INNERDUP( comp → obn..ob1 #n #n )
ICMPDRPRTDRP( comp → obn...ob4 ob2 ob1 ) — Does INCOMPDROP then ROTDROP.
(INNERCOMP>%)( comp → obn..ob1 %n )
INNER#1=( comp → obn..ob1 flag ) — . Name Description
ˆSYMBINCOMP( symb → ob1 .. obN #n ) — ( ob → ob #1 ) ( {} → {} #1 ) Explodes symbolic object into meta. Other ob- jects are converted into one-object metas by pushing #1 into the stack.
ˆ2SYMBINCOMP( ob1 ob2 → meta1 meta2 ) — Does ˆSYMBINCOMP for 2 objects.
ˆCKINNERCOMP( {} → ob1 .. obN #n ) — ( ob → ob #1 ) Explodes a list into a meta object. Other ob- jects are converted into one-object metas by pushing #1 into the stack.

Lists

NULL{}( → {} ) — Pushes a null list to the stack.
DUPNULL{}?( {} → {} flag )
ˆDUPCKLEN{}( {} → {} #n ) — ( ob → ob #1 ) Return length of list, or 1 for non-lists.
ONE{}N( ob → { ob } )
TWO{}N( ob1 ob2 → { ob1 ob2 } )
THREE{}N( ob1 ob2 ob3 → { ob1 ob2 ob3 } )
#1-{}N( ob1..obn #n+1 → {} )
PUTLIST( ob #i {} → {}' ) — Replaces object at specified position. Assumes valid #i.
ˆINSERT{}N( {} ob # → {}' ) — Insert object into list at given position. The po- sition must be < than length of the list. If the position is zero, >TCOMP is used.
ˆNEXTPext( list → list1 list2 ) — Extract in list2 all occurrances of the 1st object of list, the remaining objects are stored in list1. list1 = list-list2.
ˆCOMPRIMext( {} → {}' ) — Suppress multiple occurrances in the list.
ˆCKCARCOMP( {} → ob1 ) — ( ob → ob ) Returns first element for lists, or object itself if it is not a list.
apndvarlst( {} ob → {}' ) — Appends ob to list if not already there.
ˆAppendList( {} ob → {}' ) — Equivalent to apndvarlst, but faster.
ˆprepvarlist( {} ob → {}' ) — Adds ob at the beginning of the list if not present. If ob is in list, move ob to the begin- ning of list.
ˆSortList( L pred → L' ) — Sorts list according to give predicate. Pred is a program that tests two elements and returns FALSE if the first is to appear earlier than the second.
ˆPIext( {} → ob ) — Returns the product of all elements of the list.
EqList?( ob → ) — Is ob a list of equations? Returns T if ob is a list of at least two elements, and the second element is not a list itself.

Secondaries

NULL::( → :: ; ) — Returns null secondary.
Ob>Seco( ob → :: ob ; ) — Does ONE then ::N.
?Ob>Seco( ob → :: ob ; ) — If the object is not a secondary, does Ob>Seco.
2Ob>Seco( ob1 ob2 → :: ob1 ob2 ; ) — Does TWO then ::N. . Name Description
::NEVAL( ob1..obn #n → ? ) — Does ::N then EVAL.

Meta Objects

41

Stack Functions

NDROP( meta → ) — Should be called drop.
DROPNDROP( meta ob → ) — Should be called DROPdrop.
#1+NDROP( ob meta → ) — Should be called dropDROP. aka: N+1DROP . Name Description
NDROPFALSE( meta → F ) — Should be called dropFALSE.
ˆNDROPZERO( obn..ob1 #n → #0 ) — Replace Meta object with empty Meta object. Should be called dropZERO.
psh( meta1 meta2 → meta2 meta1 ) — Should be called swap.
roll2ND( meta1 meta2 meta3 → meta2 meta3 meta1 ) — Should be called rot.
unroll2ND( meta1 meta2 meta3 → meta3 meta1 meta2 ) — Should be called unrot.
SWAPUnNDROP( meta1 meta2 → meta2 ) — Should be called swapdrop.
metaROTDUP( meta1 meta2 meta3 → meta2 meta3 meta1 meta1 ) — Should be called rotdup.

Combining Functions

top&( meta1 meta2 → meta1&meta2 )
pshtop&( meta1 meta2 → meta2&meta1 )
ROTUntop&( meta1 meta2 meta3 → meta2 meta3&meta1 )
roll2top&( meta1 meta2 meta3 → meta3 meta1&meta2 ) — aka: rolltwotop&
psh&( meta1 meta2 meta3 → meta1&meta3 meta2 )

Meta and Object Operations

SWAP#1+( # ob → ob #+1 ) — aka: SWP1+
DUP#1+PICK( n..1 #n → n..1 #n n )
get1( ob meta → meta ob )
OVER#2+UNROL( meta ob → ob meta )
psh1top&( meta ob → ob&meta )
pull( meta&ob → meta ob ) — aka: #1-SWAP
pullrev( ob&meta → meta ob )
psh1&( meta1 meta2 ob → ob&meta1 meta2 )
psh1&rev( meta1 meta2 ob → ob&meta1 meta2 )
UobROT( ob meta1 meta2 → meta1 meta2 ob )
pullpsh1&( meta1 meta2&ob → ob&meta1 meta2 )
ˆaddt0meta( meta1&ob meta2 → meta1 meta2 ) — Removes the last object of meta1.
pshzer( meta → #0 meta )
SWAPUnDROP( ob meta → meta )
xnsgeneral( meta → LAM3&meta&LAM1 ) — Uses contents of LAM1 and LAM3.
xsngeneral( meta → meta&LAM3&LAM1 ) — Uses contents of LAM1 and LAM3.

Other Operations

SubMetaOb( meta #start #end → meta' ) — Gets a sub-meta. Does range checks. . Name Description
SubMetaOb1( ob1..obi..obn #n #i #n #i → ob1..obi #n #i ) — This function can be used to take the first i objects of a meta, if you follow it with SWAPDROP. Example: :: %1 %2 %3 %4 %5 BINT5 BINT3 BINT5 BINT3 Su
ˆsubmeta( meta #begin #end → meta' ) — Extracts submeta from a meta.
metatail( ob1..obn-i..obn #i #n+1 → ob1..ob..obn-i #n-i obn-i+1..obn #i ) — #n is the count of the objects in meta. Takes the last #i elements of meta and creates a new one. Example: :: %1 %2 %3 %4 %5 BINT2 BINT6 metatail ; Re
ˆmetasplit( meta #i → meta1 meta2 ) — Split a meta in 2 metas at position i. meta1 will contain #i elements meta2 will contain #n-i elements.
ˆmetaEQUAL?( meta2 meta1 → meta2 meta1 flag ) — Test equality of 2 metas.
ˆEQUALPOSMETA( Meta ob → Meta ob #pos ) — Returns last occurrence of ob in Meta. If a component of meta is a list/symb then search if ob is embedded in this component of meta.
ˆEQUALPOS2META( Meta2 Meta1 ob → Meta2 Meta1 ob #pos ) — Returns last occurrence of ob in Meta1 or in Meta2. #pos is >0 if in meta2, is <0 if in meta1 (#pos=MINUSONE-#).
ˆMETAINT?( Meta → Meta flag ) — Tests if Meta is an integer.
ˆMETAPOSINT?( Meta → Meta flag ) — Tests if Meta is a positive integer smaller than Zsmall.

Unit Objects

40

General Functions

U>NCQ( u → n%% cf%% qhxs ) — Returns the number, conversion factor to base units and a vector in the form: [ kg m A s K cd mol r sr ? ] where each element represents the exponent
UM>U( % u → u' ) — Replaces number part of unit.
UMCONV( u1 u2 → u1' ) — Change units of unit1 to units of unit2.
UMSI( u → u' ) — Equivalent to user word UBASE.
UMU>( u → % u' ) — Returns number and normalized part of unit.
UNIT>$( u → $ ) — Converts unit to string.
U>nbr( u → % ) — Returns number part of unit.
Unbr>U( u % → u' ) — Replaces number part of unit. 2F09A TempConv ??? Used by UMCONV for the conversion of temperature units.
KeepUnit( % ob ob' → % ob ) — ( % ob u → u' ob ) If the level one object is a unit object, replaces the numeric part of it with the number on level 3. If not, just DROP.

Arithmetic Functions

UM+( u u' → u'' )
UM-( u u' → u'' )
UM*( u u' → u'' )
UM/( u u' → u'' )
UM%( u %percent → u' )
UM%CH( u u' → % )
UM%T( u u' → % )
UMMIN( u u' → u? )
UMMAX( u u' → u? )
UMXROOT( u u' → u'' )
UMABS( u → u' )
UMCHS( u → u' )
UMSQ( u → u' )
UMSQRT( u → u' )
UMSIGN( u → u' )
UMIP( u → u' )
UMFP( u → u' )
UMFLOOR( u → u' )
UMCEIL( u → u' )
UMRND( u → u' )
UMTRC( u → u' )
UMCOS( u → u' )
UMSIN( u → u' )
UMTAN( u → u' )

Tests

UM=?( u u' → %flag )
UM#?( u u' → %flag )
UM<?( u u' → %flag )
UM>?( u u' → %flag )
UM<=?( u u' → %flag )
UM>=?( u u' → %flag ) — . Name Description
puretemp?( [] []' → [] []' flag ) — Checks of the two arrays both denote pure temper- ature units, i.e. if both arrays are equal to [0. 0. 0. 0. 1. 0. 0. 0. 0. 0.]

Symbolics

20

General Operations

SYMBN( ob1..obn #n → sym ) — 2BD8C (SYMBN:) ob1..obn #n -> symb Does 'R, SWAP#1+ then SYMBN. Creates a symbolic from the meta in the stack and the next object in the runstream. Th
symcomp( ob → ob' ) — If ob is symbolic, does nothing, otherwise ONE SYMBN.
SWAPcompSWAP( ob ob' → ob'' ob' ) — Does SWAP symcomp SWAP.
(DROP?symcomp)( %/C%/Z/id/lam ob' → %/C%/Z/id/lam ) — ( ob ob' → symb ) Drop ob'. Then, if the object in the stack is a real, complex, zint, identifier or lam, does nothing. For other objects, calls symco
(?symcomp)( %/C%/Z/id/lam #1 → %/C%/Z/id/lam ) — ( ob #1 → symb ) ( ob # → symb ) If # is BINT1, calls DROP?symcomp. If it is any other number, calls SYMBN.
CRUNCH( ob → % ) — Internal version of →NUM.
(FINDVARS)( sym → {} ) — Returns a list of the variables of the equation, recursing into programs and functions in the equation.
ˆEQUATION?( ob → ob flag ) — Returns TRUE if ob is a symbolic finishing by x=.
ˆUSERFCN?( ob → ob flag ) — Returns TRUE if ob is a symbolic finishing by xFCNAPPLY.
uncrunch( → ) — Clears numeric results flag (system flag 3) for the next command only. Example: SYMCOLCT = :: uncrunch colct ;
cknumdsptch1( sym → symf ) — Used by one argument functions to evaluate a symbolic or numeric routine according to nu- meric results flag. Usage: :: cknumdsptch1 <sym> <num> ; If
sscknum2( sym sym → symf ) — Used by two argument functions to evaluate function according to current numeric mode. Usage: :: sscknum2 <sym> <num> ; In numeric mode both arguments
sncknum2( sym % → symf ) — Usage: :: sncknum2 <sym> <num> ; In symbolic mode uses cksneval2:. Exam- ple: SYM+O = :: sncknum2 Meta+Con x+ ;
nscknum2( % sym → symf ) — Usage: :: nscknum2 <sym> <num> ; In symbolic mode uses cknseval2:. Example: O+SYM = :: nscknum2 Con+Meta x+ ;

Other Functions

SYMSHOW( sym id/lam → symf )
XEQSHOWLS( sym {} → symf )

Meta Symbolics Functions

pshzerpsharg( meta → M_last M_rest ) — Pushes last sub-expression in meta. If meta is a valid expression M_rest will be empty.
pZpargSWAPUn( meta → M_rest M_last ) — pshzerpsharg then psh.
plDRPpZparg( meta&ob → M_last M_rest ) — Drops ob then calls pshzerpsharg.
ˆDIVMETAOBJ( o1...on #n ob → {o1/ob...on/ob} ) — Division of all elements of a meta by ob. Tests if o=1.

Graphics Objects (Grobs)

113

Built-in Grobs

(NULLGROB)( → grob ) — 0x0 Null grob
CROSSGROB( → grob ) — 5x5 Cross cursor ("+")
MARKGROB( → grob ) — 5x5 Mark symbol ("x") 27D7B (StdLabelGrob) 21x8 normal menu key 2E25C (InvLabelGrob) 21x8 inverse menu key 0860B0 ˜grobAlertIcon 9x9 Alert grob 0870B0

Dimensions

GROBDIM( grob → #height #width )
DUPGROBDIM( grob → grob #height #width )
GROBDIMw( grob → #width )
CKGROBFITS( g1 g2 #n #m → g1 g2' #n #m ) — Shrinks g2 if it does not fit in g1.
CHECKHEIGHT( grob #height → ) — Forces grob (ABUFF/GBUFF) to be at least 64 rows high.

Grob Handling

GROB!( grob1 grob2 #x #y → ) — Stores grob1 into grob2. Bang type.
(GROB+)( grob1 grob2 → grob ) — Combines two grobs using bitwise OR. Errors when grobs have different sizes.
GROB+#( flag grob1 grob2 #x #y → grob' ) — Inserts grob2 into the specified position of grob1, using OR (if flag is TRUE) or XOR (if flag is FALSE). Does all necessary checks first.
GROB!ZERO( grob #x1 #y1 #x2 #y2 → grob' ) — Blanks a rectangular region of the grob. Bang type.
GROB!ZERODRP( grob #x1 #y1 #x2 #y2 → ) — Blanks a rectangular region of the grob. Prob- ably only useful if grob is the text or graph- ics grob (see section on display-organization). Bang typ
SUBGROB( grob #x1 #y1 #x2 #y2 → grob' ) — Returns specified portion of grob.
XYGROBDISP( #x #y grob → ) — Stores grob in HARDBUFF with upper left cor- ner at (#x,#y). HARDBUFF is expanded if nec- essary.
GROB>GDISP( grob → ) — Stores new graph grob.
MAKEGROB( #height #width → grob ) — Creates a blank grob.
MAKEPICT#( #w #h → ) — Creates blank graph grob. Minimum size is 131x64. Smaller grobs will be automatically resized.
INVGROB( grob → grob' ) — Inverts grob data bits. Bang type.
PIXON( #x #y → ) — Sets pixel in text grob.
PIXOFF( #x #y → ) — Clears pixel in text grob.
PIXON?( #x #y → flag ) — Is pixel in text grob on?
PIXON3( #x #y → ) — Sets pixel in graph grob.
PIXOFF3( #x #y → ) — Clears pixel in graph grob. . Name Description
PIXON?3( #x #y → flag ) — Is pixel in graph grob on?
ORDERXY#( #x1 #y1 #x2 #y2 → #x1' #y1' #x2' #y2' ) — Orders the bints to be appropriate for defining a rectangle in a grob. Swaps #x1 and #x2 if #x2<#x1. Swaps #y1 and #y2 if #y2<#y1.
ORDERXY%( %x1 %y1 %x2 %y2 → %x1' %y1' %x2' %y2' ) — ORDERXY# with real numbers.
LINEON( #x1 #y1 #x2 #y2 → ) — Draws a line in text grob.
LINEOFF( #x1 #y1 #x2 #y2 → ) — Clears a line in text grob.
TOGLINE( #x1 #y1 #x2 #y2 → ) — Toggles a line in text grob.
LINEON3( #x1 #y1 #x2 #y2 → ) — Draws a line in graph grob.
DRAWLINE#3( #x1 #y1 #x2 #y2 → ) — Draws a line in graph grob. x1<x2 is not re- quired.
LINEOFF3( #x1 #y1 #x2 #y2 → ) — Clears a line in graph grob.
TOGLINE3( #x1 #y1 #x2 #y2 → ) — Toggles a line in graph grob.
TOGGLELINE#3( #x1 #y1 #x2 #y2 → ) — Toggles line in graph grob. x1<x2 is not re- quired.
DRAWBOX#( #x1 #y1 #x2 #y2 → ) — Draws rectangle in graph grob.
DOLCD>( → grob ) — Returns current display.
DO>LCD( grob → ) — Grob to display.
ˆGROBADDext( grob2 grob1 → grob ) — Vertical grob addition. grob2 will be above grob1.

Greyscale Graphics

SubRepl( grb1 grb2 #x1 #y1 #x2 #y2 #W #H → grb1' ) — Replace a part of grb1 with a part of grb2 in REPLACE mode.
SubGor( grb1 grb2 #x1 #y1 #x2 #y2 #W #H → grb1' ) — Replace a part of grb1 with a part of grb2 in OR mode.
SubGxor( grb1 grb2 #x1 #y1 #x2 #y2 #W #H → grb1' ) — Replace a part of grb1 with a part of rgb2 in XOR mode.
LineW( grb #x1 #y1 #x2 #y2 → grb' ) — Draw a white line.
LineG1( grb #x1 #y1 #x2 #y2 → grb' ) — Draw a light grey line.
LineG2( grb #x1 #y1 #x2 #y2 → grb' ) — Draw a dark grey line.
LineB( grb #x1 #y1 #x2 #y2 → grb' ) — Draw a black line.
LineXor( grb #x1 #y1 #x2 #y2 → grb' ) — XOR a line.
CircleW( grb #Cx #Cy #r → grb' ) — Draw a white circle.
CircleG1( grb #Cx #Cy #r → grb' ) — Draw a light grey circle.
CircleG2( grb #Cx #Cy #r → grb' ) — Draw a dark grey circle.
CircleB( grb #Cx #Cy #r → grb' ) — Draw a black circle
CircleXor( grb #Cx #Cy #r → grb' ) — XOR a circle.
Sub( grb #x1 #y1 #x2 #y2 → grb' flag ) — Get a part of a grob.
Repl( grb1 grb2 #x #y → grb1' ) — Copy grb2 into grb1 in REPLACE mode. . Name Description
Gor( grb1 grb2 #x #y → grb1' ) — Copy grb2 into grb1 in OR mode.
Gxor( grb1 grb2 #x #y → grb1' ) — Copy grb2 into grb1 in XOR mode.
Grey?( grob → flag ) — Is grob a Greyscale Grob?
ScrollVGrob( grb #W #X #Yd #Ys #h → grb' ) — Scroll up and down a portion of a graphical object.
PixonW( grb #x #y → grb' ) — Make a pixel white.
PixonG1( grb #x #y → grb' ) — Make a pixel light grey.
PixonG2( grb #x #y → grb' ) — Make a pixel dark grey.
PixonB( grb #x #y → grb' ) — Make a pixel black.
PixonXor( grb #x #y → grb' ) — Apply XOR to a pixel.
FBoxW( grb #x1 #y1 #x2 #y2 → grb' ) — Make a white filled rectangle.
FBoxG1( grb #x1 #y1 #x2 #y2 → grb' ) — Make a light grey filled rectangle.
FBoxG2( grb #x1 #y1 #x2 #y2 → grb' ) — Make a dark grey filled rectangle.
FBoxB( grb #x1 #y1 #x2 #y2 → grb' ) — Make a black filled rectangle.
FBoxXor( grb #x1 #y1 #x2 #y2 → grb' ) — Apply XOR to a filled rectangle.
LBoxW( grb #x1 #y1 #x2 #y2 → grb' ) — Draw a white rectangle.
LBoxG1( grb #x1 #y1 #x2 #y2 → grb' ) — Draw a light grey rectangle.
LBoxG2( grb #x1 #y1 #x2 #y2 → grb' ) — Draw a dark grey rectangle.
LBoxB( grb #x1 #y1 #x2 #y2 → grb' ) — Draw a black rectangle.
LBoxXor( grb #x1 #y1 #x2 #y2 → grb' ) — Apply XOR to a rectangle.
ToGray( grb → grb'/grb ) — Convert a B&W grob to Greyscale.
Dither( grb → grb'/grb ) — Convert a greyscale grob to B&W
Distance( #∆x #∆y → #SQRT(∆xˆ2+∆yˆ2) ) — Compute the distance between two points.

Creating Menu Label Grobs

MakeStdLabel( $ → grob ) — Makes standard menu label.
MakeBoxLabel( $ → grob ) — Makes label with a box.
MakeDirLabel( $ → grob ) — Makes directory label.
MakeInvLabel( $ → grob ) — Makes inverse label.
Box/StdLabel( $ flag → grob ) — If TRUE makes box label, otherwise makes stan- dard label.
Std/BoxLabel( $ flag → grob ) — If TRUE makes standard label, otherwise makes box label.
Box/StdLbl:( → grob ) — Does Box/StdLabel with the next two objects from the stream. Usage: :: Box/StdLbl: $ <test> ;
Grob>Menu( #col grob → ) — Displays grob as menu label.
Str>Menu( #col $ → ) — Displays string as menu label.
Id>Menu( #col id → ) — Displays id as menu label.
Seco>Menu( #col :: → ) — Does EVAL then DoLabel. . Name Description
DoLabel( #col ob → ) — If ob is of one of the supported types, displays a menu label. If not, generates a "Bad Argument Type" error.

Converting Strings to Grobs

$>GROB( $ → grob ) — Makes grob of the string using the system font. Linefeed does not make new line.
$>GROBCR( $ → grob ) — Makes grob of the string using the system font. Linefeed does make new line.
$>grob( $ → grob ) — Makes grob of the string using the minifont. Linefeed does not make new line.
$>grobCR( $ → grob ) — Makes grob of the string using the minifont. Linefeed does make new line.
(˜$>grobOrGROB)( $ → grob ) — Converts string to a grob using either the current font or the minifont, depending on system flag 90.
RIGHT$3x6( $ #n → flag grob ) — Transforms string into grob (using the minifont), then takes all characters start- ing after column #n. flag is FALSE if #n is greater than the width
CENTER$3x5( grob #x #y $ #w → grob' ) — Creates grob from string (using the mini- font) and embeds it at specified position (#x, #y). The grob is centered around #x and the to is put at #y.
MakeLabel( $ #w #x grob → grob' ) — Inserts $ into grob using CENTER$3x5 with y=5.
LEFT$3x5( grob #x #y $ #w → grob' ) — Like CENTER$3x5, but the left corner of the text is positioned at #x.
ERASE&LEFT$3x5( grob #x #y $ #w → grob' ) — Like LEFT$3x5, but erase background first.
LEFT$3x5Arrow( grob #x #y $ #w → grob' ) — Like LEFT$3x5, but if the text does not fit, replace the last character by character 31 (dots) to show that the text was truncated.
LEFT$3x5CR( grob #x #y $ #w #h → grob' ) — Like LEFT$3x5, but newlines in the strings are interpreted and start new lines. Note the additional argument #h for the maxi- mum height of the text g
LEFT$3x5CRArrow( grob #x #y $ #w #h → grob' ) — Like LEFT$3x5CR, but show truncation with arrows.
CENTER$5x7( grob #x #y $ #w → grob' ) — Same as CENTER$3x5, but using system font.
LEFT$5x7( grob #x #y $ #w → grob' ) — Like CENTER$5x7, but the left corner of the text is positioned at #x.
ERASE&LEFT$5x7( grob #x #y $ #w → grob' ) — Like LEFT$5x7, but erase background first.
LEFT$5x7Arrow( grob #x #y $ #w → grob' ) — Like LEFT$5x7, but if the text has to be truncated, replace the last character with character 31 (arrow).
LEFT$5x7CR( grob #x #y $ #w → grob' ) — Like LEFT$5x7, but interpret newlines.
LEFT$5x7CRArrow( grob #x #y $ #w → grob' ) — Like LEFT$5x7CR, but show truncation with arrows.

Creating Grobs from Other Objects

ˆEQW3GROB( ob → ext grob #0 ) — ( ob → #2 )
ˆEQW3GROBStk( ob → ext grob #0 ) — ( ob → #2 )
ˆEQW3GROBmini( ob → ext grob #0 ) — ( ob → #2 )
ˆEQW3GROBsys( ob → ext grob #0 ) — ( ob → #2 )
ˆXGROBext( ob → grob ) — Convert object to a grob.
ˆDISPLAYext( grob ob → grob' ) — Adds ob to grob after converting it to a grob.

Library and Backup Objects

16

Port Operations

NEXTLIBBAK( #addr → backup/library #nextaddr ) — Gets next library or backup.

Rompointers

#>ROMPTR( #lib #cmd → ROMPTR ) — Creates rompointer.
ROMPTR>#( ROMPTR → #lib #cmd ) — Splits rompointer.
ROMPTR@( ROMPTR → ob T ) — ( ROMPTR → F ) Recalls contents of rompointer.
DUPROMPTR@( ROMPTR → ROMPTR ob T ) — ( ROMPTR → ROMPTR F ) Does DUP then ROMPTR@.
?>ROMPTR( ob → ob' ) — If ROM-WORD? and TYPECOL? then RPL@.
?ROMPTR>( ob → ob' ) — If TYPEROMP? and content exists INHARDROM? then return contents.
RESOROMP( → ob ) — Recalls contents of next object in the runstream (which must be a rompointer).
ROM-WORD?( ob → flag )
DUPROM-WORD?( ob → ob flag )

Libraries

TOSRRP( # → ) — Attaches library to HOME directory.
OFFSRRP( # → ) — Detaches library from HOME directory.
XEQSETLIB( % → ) — Internal ATTACH.
SETHASH( hxs #libnum → ) — Buggy?

Backup Objects

BAKNAME( bak → id T ) — Returns backup's name
BAK>OB( bak → ob ) — Gets backup object. Part II General System RPL Entries

Stack Operations

121

Reference

DUP( ob → ob ob )
DUPDUP( ob → ob ob ob )
ˆ3DUP( 3 2 1 → 3 2 1 3 2 1 )
NDUPN( ob #n → ob..ob #n ) — ( ob #0 → #0 )
DUPROT( 1 2 → 2 2 1 )
DUPUNROT( 1 2 → 2 1 2 ) — aka: SWAPOVER
DUPROLL( 1..n #n → 1 3..n #n 2 )
DUP4UNROLL( 1 2 3 → 3 1 2 3 )
DUPPICK( n..1 #n → n..1 #n n-1 )
DUP3PICK( 1 2 → 1 2 2 1 ) — aka: 2DUPSWAP
DUP#1+PICK( n..1 #n → n..1 #n n )
2DUP( 1 2 → 1 2 1 2 )
2DUPSWAP( 1 2 → 1 2 2 1 ) — aka: DUP3PICK
2DUP5ROLL( 1 2 3 → 2 3 2 3 1 )
NDUP( 1..n #n → 1..n 1..n )
DROP( 1 → )
DROPDUP( 1 2 → 1 1 )
DROPNDROP( 1..n #n ob → )
DROPSWAP( 1 2 3 → 2 1 )
DROPSWAPDROP( 1 2 3 → 2 ) — aka: ROT2DROP, XYZ>Y
DROPROT( 1 2 3 4 → 2 3 1 )
DROPOVER( 1 2 3 → 1 2 1 )
2DROP( 1 2 → )
3DROP( 1 2 3 → ) — aka: XYZ>
4DROP( 1..4 → ) — aka: XYZW>
5DROP( 1..5 → )
6DROP( 1..6 → )
7DROP( 1..7 → )
NDROP( 1..n #n → )
#1+NDROP( ob 1..n #n → ) — aka: N+1DROP
RESETDEPTH( ob1..obn obn+1..obx #n → ob1..obn ) — Drops all but #n levels of the stack.
DEPTH( 1..n → 1..n #n )
reversym( 1..n #n → n..1 #n )
SWAP( 1 2 → 2 1 )
SWAPDUP( 1 2 → 2 1 1 )
SWAP2DUP( 1 2 → 2 1 2 1 )
SWAPDROP( 1 2 → 2 ) — aka: XY>Y
SWAPDROPDUP( 1 2 → 2 2 )
SWAPDROPSWAP( 1 2 3 → 3 1 ) — aka: UNROTDROP, XYZ>ZX
SWAPROT( 1 2 3 → 3 2 1 ) — aka: UNROTSWAP, XYZ>ZYX
SWAP4ROLL( 1 2 3 4 → 2 4 3 1 ) — aka: XYZW>YWZX
SWAPOVER( 1 2 → 2 1 2 ) — aka: DUPUNROT
SWAP3PICK( 1 2 3 → 1 3 2 1 )
2SWAP( 1 2 3 4 → 3 4 1 2 )
ROT( 1 2 3 → 2 3 1 )
ROTDUP( 1 2 3 → 2 3 1 1 )
ROT2DUP( 1 2 3 → 2 3 1 3 1 )
ROTDROP( 1 2 3 → 2 3 ) — aka: XYZ>YZ
ROT2DROP( 1 2 3 → 2 ) — aka: DROPSWAPDROP, XYZ>Y
ROTDROPSWAP( 1 2 3 → 3 2 ) — aka: XYZ>ZY
ROTSWAP( 1 2 3 → 2 1 3 ) — aka: XYZ>YXZ
ROTROT2DROP( 1 2 3 → 3 ) — aka: UNROT2DROP, XYZ>Z
ROTOVER( 1 2 3 → 2 3 1 3 )
4ROLL( 1 2 3 4 → 2 3 4 1 ) — aka: FOURROLL, XYZW>YZWX
4ROLLDROP( 1 2 3 4 → 2 3 4 )
4ROLLSWAP( 1 2 3 4 → 2 3 1 4 ) — . Name Description
4ROLLROT( 1 2 3 4 → 2 4 1 3 ) — aka: FOURROLLROT
4ROLLOVER( 1 2 3 4 → 2 3 4 1 4 )
5ROLL( 1 2 3 4 5 → 2 3 4 5 1 ) — aka: FIVEROLL
5ROLLDROP( 1 2 3 4 5 → 2 3 4 5 )
6ROLL( 1..6 → 2..6 1 ) — aka: SIXROLL
7ROLL( 1..7 → 2..7 1 ) — aka: SEVENROLL
8ROLL( 1..8 → 2..8 1 ) — aka: EIGHTROLL
ROLL( 1..n #n → 2..n 1 )
ROLLDROP( 1..n #n → 2..n )
ROLLSWAP( 1..n #n → 2..n-1 1 n )
#1+ROLL( ob 1..n #n → 1..n ob )
#2+ROLL( a b 1..n #n → b 1..n a )
ˆ#3+ROLL( obn+3...obn...ob1 #n → obn+2...ob1 obn+3 )
#+ROLL( 1..n+m #n #m → 2..n+m 1 )
#-ROLL( 1..n-m #n #m → 2..n-m 1 )
UNROT( 1 2 3 → 3 1 2 ) — aka: 3UNROLL, XYZ>ZXY
UNROTDUP( 1 2 3 → 3 1 2 1 )
UNROTDROP( 1 2 3 → 3 1 ) — aka: SWAPDROPSWAP, XYZ>ZX
UNROT2DROP( 1 2 3 → 3 ) — aka: ROTROT2DROP, XYZ>Z
UNROTSWAP( 1 2 3 → 3 2 1 ) — aka: SWAPROT, XYZ>ZYX
UNROTOVER( 1 2 3 → 3 1 2 1 )
3UNROLL( 1 2 3 → 3 1 2 ) — aka: UNROT, XYZ>ZXY
4UNROLL( 1 2 3 4 → 4 1 2 3 ) — aka: FOURUNROLL, XYZW>WXYZ
4UNROLLDUP( 1 2 3 4 → 4 1 2 3 3 )
4UNROLL3DROP( 1 2 3 4 → 4 ) — aka: XYZW>W
4UNROLLROT( 1 2 3 4 → 4 3 2 1 )
5UNROLL( 1 2 3 4 5 → 5 1 2 3 4 ) — aka: FIVEUNROLL
6UNROLL( 1..6 → 6 1..5 ) — aka: SIXUNROLL
7UNROLL( 1..7 → 7 1..6 )
8UNROLL( 1..8 → 8 1..7 )
(9UNROLL)( 1..9 → 9 1..8 )
10UNROLL( 1..10 → 10 1..9 )
UNROLL( 1..n #n → n 1..n-1 )
#1+UNROLL( ob 1..n #n → n ob 1..n-1 )
#2+UNROLL( a b 1..n #n → n a b 1..n-1 )
#+UNROLL( 1..n+m #n #m → n+m 1..n+m-1 )
#-UNROLL( 1..n-m #n #m → n-m 1..n+m-1 )
OVER( 1 2 → 1 2 1 )
OVERDUP( 1 2 → 1 2 1 1 )
OVERSWAP( 1 2 → 1 1 2 ) — aka: OVERUNROT
OVERUNROT( 1 2 → 1 1 2 ) — aka: OVERSWAP
OVER5PICK( 1 2 3 4 → 1 2 3 4 3 1 )
2OVER( 1 2 3 4 → 1 2 3 4 1 2 )
3PICK( 1 2 3 → 1 2 3 1 )
3PICKSWAP( 1 2 3 → 1 2 1 3 )
3PICKOVER( 1 2 3 → 1 2 3 1 3 )
3PICK3PICK( 1 2 3 → 1 2 3 1 2 )
DROP3PICK( 1 2 3 4 → 1 2 3 1 )
4PICK( 1 2 3 4 → 1 2 3 4 1 )
4PICKSWAP( 1 2 3 4 → 1 2 3 1 4 )
SWAP4PICK( 1 2 3 4 → 1 2 4 3 1 )
4PICKOVER( 1 2 3 4 → 1 2 3 4 1 4 )
5PICK( 1 2 3 4 5 → 1 2 3 4 5 1 )
6PICK( 1..6 → 1..6 1 )
7PICK( 1..7 → 1..7 1 )
8PICK( 1..8 → 1..8 1 )
(9PICK)( 1..9 → 1..9 1 )
(10PICK)( 1..10 → 1..10 1 )
PICK( 1..n #n → 1..n 1 )
#1+PICK( 1..n #n-1 → 1..n 1 )
#2+PICK( 1..n #n-2 → 1..n 1 ) — . Name Description
#3+PICK( 1..n #n-3 → 1..n 1 )
#4+PICK( 1..n #n-4 → 1..n 1 )
#+PICK( 1..n+m #n #m → 1..n+m 1 )
#-PICK( 1..n-m #n #m → 1..n-m 1 )

Temporary Environments

88

Builtin IDs and LAMs

NULLID( → id ) — Null (empty) identifier
NULLLAM( → lam ) — Puts NULLLAM in the stack.
'IDX( → id ) — Puts ID X unevaluated on the stack. 272F3 (ID_EQ) ID EQ 27937 (ID_SIGMADAT) ID ΣDAT

Conversion

$>ID( $ → ID )
DUP$>ID( $ → $ ID )

Temporary Environments Words

BIND( obn..ob1 {lamn..lam1} → ) — Binds n objects to n differently named lams.
DOBIND( obn..ob1 lamn..lam1 #n → ) — Binds n objects to n differently named lams.
1LAMBIND( ob → ) — Binds one object to a null named lam.
DUP1LAMBIND( ob → ob ) — Does DUP then 1LAMBIND.
ˆ2LAMBIND( ob1 ob2 → ) — Binds two objects to null named lams.
ˆ3LAMBIND( ob1 ob2 ob3 → ) — Binds three objects to null named lams.
˜nNullBind( obn..ob1 #n → ) — Binds #n objects to null named lams. 1LAM has the count, 2LAM the first object. Decom- piles to :: ' NULLLAM CACHE ;
dvarlsBIND( ob → ) — Binds ob to LAM 'dvar.
ABND( → ) — Abandons topmost temporary environment.
CACHE( obn..ob1 #n lam → ) — Binds all objects under the same name. 1LAM has the count.
DUMP( NULLLAM → ob1..obn #n ) — Inverse of CACHE. Always does garbage collec- tion.
SAVESTACK( → ) — Caches stack to SAVELAM.
undo( → ) — Dumps SAVELAM.
@LAM( lam → ob T ) — ( lam → F ) Tries recalling object from lam. If success- ful, returns object and TRUE, otherwise returns just FALSE.
STOLAM( ob lam → ) — Tries storing object in lam. Generates "Unde- fined Local Name" error if lam is not found.
GETLAM( #n → ob ) — Gets contents of nth topmost lam.
1GETLAM( → ob )
2GETLAM( → ob )
3GETLAM( → ob )
4GETLAM( → ob )
5GETLAM( → ob )
6GETLAM( → ob )
7GETLAM( → ob )
8GETLAM( → ob )
9GETLAM( → ob )
10GETLAM( → ob ) — . Name Description
11GETLAM( → ob )
12GETLAM( → ob )
13GETLAM( → ob )
14GETLAM( → ob )
15GETLAM( → ob )
16GETLAM( → ob )
17GETLAM( → ob )
18GETLAM( → ob )
19GETLAM( → ob )
20GETLAM( → ob )
21GETLAM( → ob )
22GETLAM( → ob )
(23GETLAM)( → ob )
(24GETLAM)( → ob )
(25GETLAM)( → ob )
(26GETLAM)( → ob )
(27GETLAM)( → ob )
PUTLAM( ob #n → ) — Stores new contents to nth topmost lam.
1PUTLAM( ob → )
2PUTLAM( ob → )
3PUTLAM( ob → )
4PUTLAM( ob → )
5PUTLAM( ob → )
6PUTLAM( ob → )
7PUTLAM( ob → )
8PUTLAM( ob → )
9PUTLAM( ob → )
10PUTLAM( ob → )
11PUTLAM( ob → )
12PUTLAM( ob → )
13PUTLAM( ob → )
14PUTLAM( ob → )
15PUTLAM( ob → )
16PUTLAM( ob → )
17PUTLAM( ob → )
18PUTLAM( ob → )
19PUTLAM( ob → )
20PUTLAM( ob → )
21PUTLAM( ob → )
22PUTLAM( ob → )
(23PUTLAM)( ob → )
(24PUTLAM)( ob → )
(25PUTLAM)( ob → )
(26PUTLAM)( ob → )
(27PUTLAM)( ob → )
DUP4PUTLAM( ob → ob ) — Does DUP then 4PUTLAM.
1GETABND( → 1lamob ) — Does 1GETLAM then ABND.
1ABNDSWAP( ob → 1lamob ob ) — Does 1GETABND then SWAP.
1GETSWAP( ob → 1lamob ob ) — Does 1GETLAM then SWAP.
1GETLAMSWP1+( # → 1lamob #+1 ) — Does 1GETLAM then SWAP#1+.
2GETEVAL( → ? ) — Does 2GETLAM then EVAL.
GETLAMPAIR( #n → #n ob lam F ) — ( #n → #n T ) Gets lam contents and name (10 = 1lam, 20 = 2lam, etc.)
DUPTEMPENV( → ) — Duplicates topmost tempenv (clears protection word).
1NULLLAM{}( → {} ) — Puts a list with one NULLLAM in the stack.
(2NULLLAM{})( → {} ) — Puts a list with two times NULLLAM in the stack.
(3NULLLAM{})( → {} ) — Puts a list with three times NULLLAM in the stack.
4NULLLAM{}( → {} ) — Puts a list with four times NULLLAM in the stack.

Runstream Control

51

Reference

NOP( → ) — Does nothing.
'R( → ob ) — Pushes next object in return stack (i.e., the first ob- ject in the composite above this one) to the stack (skipping it). If top return stack is empty
'REVAL( → ? ) — Does 'R then EVAL.
'R'R( → ob1 ob2 ) — Does 'R twice.
ticR( → ob T ) — ( → F ) Pushes next object in return stack to stack and TRUE, of just FALSE if the top return stack body is empty. In this case, it is dropped.
'RRDROP( → ob ) — Does 'R, then RDROP.
>R( :: → ) — Pushes :: to top of return stack (skips prolog, i.e., the composite will be executed automatically).
R>( → :: ) — Creates and pops a secondary from top return stack body to stack.
R@( → :: ) — Like R>, but the return stack is not popped.
IDUP( → ) — Pushes top body into return stack.
EVAL( ob → ? ) — Evaluates object.
COMPEVAL( comp → ? ) — EVAL just pushes a list back, this one executes it.
2@REVAL( → ? ) — EVAL first object in the stream above the previous one.
3@REVAL( → ? ) — EVAL first object in the stream above the stream above the previous one.
GOTO( → ) — Jumps to next address in stream. Address is a five- nibble address, not a system binary. Can only be used to jump to the middle of programs, cannot ju
?GOTO( flag → ) — If TRUE, jumps, else skips five nibbles.
NOT?GOTO( flag → ) — If FALSE jumps, else skips five nibbles.
RDUP( → ) — Duplicates top return stack level.
RDROP( → ) — Pops the return stack.
2RDROP( → ) — Pops two return stack levels.
3RDROP( → ) — Pops three return stack levels.
DROPRDROP( ob → ) — Does DROP then RDROP.
RDROPCOLA( → ) — Does RDROP then COLA.
RSWAP( → ) — Swap in the return stack.
RSKIP( → ) — Skips first object in the return stack (i.e., the first object in the composite above this one).
(OBJ>R)( ob → ) — Pushes an object into the return stack, for example for temporary storage. If ob is a list, the list is put as a whole onto the stream, not the indivi
(R>OBJ)( → ob ) — Gets an object from the return stack.
SEMI( → ) — DROP the rest of the current stream.

Quoting Objects

'( → nob (nextob) ) — Pushes next object in the stream to the stack (skipping it).
DUP'( ob → ob nob ) — Does DUP then '.
DROP'( ob → nob ) — Does DROP then '.
SWAP'( ob1 ob2 → ob2 ob1 nob ) — Does SWAP then '.
OVER'( ob1 ob2 → ob1 ob2 ob1 nob ) — Does OVER then '.
STO'( ob id/lam → nob ) — Does STO then '.
TRUE'( → T nob ) — Pushes TRUE and the next object to the stack.
FALSE'( → F nob ) — Pushes FALSE and the next object to the stack.
ONEFALSE'( → #1 F nob ) — Pushes ONE, FALSE and the next object to the stack.
#1+'( # → #+1 nob ) — Does #1+ then '.
'NOP( → NOP ) — Pushes NOP to the stack.
'ERRJMP( → ERRJMP ) — Pushes ERRJMP to the stack.
'DROPFALSE( → DROPFALSE ) — Pushes DROPFALSE to the stack.
'DoBadKey( → DoBadKey ) — Pushes DoBadKey to the stack.
'DoBadKeyT( → DoBadKey T ) — Pushes DoBadKey and TRUE to the stack.
DROPDEADTRUE( ob → DoBadKey T ) — Makes the user drop dead, then pushes TRUE.
('x*)( → x* ) — Pushes x* (User word *) to the stack.
'xDER( → xDER ) — Pushes xDER (User word ∂) to the stack.
'IDFUNCTION( → xFUNCTION ) — Pushes xFUNCTION (User word FUNCTION) to the stack.
'IDPOLAR( → xPOLAR ) — Pushes xPOLAR (User word POLAR) to the stack.
'IDPARAMETER( → xPARAMETRIC ) — Pushes xPARAMETRIC (user word PARAMETRIC) to the stack.
'Rapndit( meta ob1...ob4 → meta&ob ob1...ob4 ) — Takes ob from runstream and appends it to the meta starting in level 5.
'xDEREQ( ob → flag ) — Is ob eq to user command xDER?

Conditionals

154

Boolean Flags

COERCEFLAG( T → %1 ) — ( F → %0 ) Converts system flag to user flag, drops current stream.
%0<>( % → flag ) — Can be used to change a user flag into a system flag.
TRUE( → T )
TrueTrue( → T T ) — . Name Description
TrueFalse( → T F ) — aka: TRUEFALSE
FALSE( → F )
FalseTrue( → F T ) — aka: FALSETRUE
FalseFalse( → F F )
failed( → F T )
DROPTRUE( ob → T )
ˆ2DROPTRUE( ob ob' → T )
DROPFALSE( ob → F )
2DROPFALSE( ob1 ob2 → F )
NDROPFALSE( ob1..obn #n → F )
SWAPTRUE( ob1 ob2 → ob2 ob1 T )
SWAPDROPTRUE( ob1 ob2 → ob2 T )
XYZ>ZTRUE( ob1 ob2 ob3 → ob3 T )
RDROPFALSE( → F ) — Puts FALSE in the stack and drops rest of cur- rent stream.
NOT( flag → flag' ) — Returns FALSE if the input is TRUE, and vice- versa.
AND( flag1 flag2 → flag ) — Returns TRUE if both flags are TRUE.
OR( flag1 flag2 → flag ) — Returns TRUE if either flag is TRUE.
XOR( flag1 flag2 → flag ) — Returns TRUE if flags are different.
ORNOT( flag1 flag2 → flag ) — Returns FALSE if either flag is TRUE.
NOTAND( flag1 flag2 → flag ) — Returns TRUE if flag1 is TRUE and flag2 is FALSE.
ROTAND( flag1 ob flag2 → ob flag ) — Returns TRUE if either flag is TRUE.

General Tests

EQ( ob1 ob2 → flag ) — Returns TRUE if both objects are the same, i.e., they occupy the same physical space in memory. Only the addresses of the objects are tested.
2DUPEQ( ob1 ob2 → ob1 ob2 flag ) — Does 2DUP then EQ.
EQOR( flag ob1 ob2 → flag' ) — Does EQ then OR.
EQOVER( ob3 ob1 ob2 → ob3 flag ob3 ) — Does EQ then OVER.
EQ:( ob → flag ) — EQ with the next object in the current stream.
DUPEQ:( ob → ob flag ) — Does DUP then EQ:.
EQUAL( ob1 ob2 → flag ) — Returns TRUE if the objects are equal (but not nec- essarily the same), i.e., their prologs and contents are the same.
EQUALNOT( ob1 ob2 → flag ) — Returns TRUE if the objects are different.
EQUALOR( flag ob1 ob2 → flag' ) — Does EQUAL then OR.
ˆContains?( ob1 ob2 → ob1 ob2 flag ) — Tests if ob1 contains ob2. If ob1 is a symbolic then ob1 is searched for embedded ob2. If ob1 is a list then ob1 is traversed for a direct match. Othe

True/False Tests

?SEMI( T → :: ; ) — ( F → :: <ob1> <rest> ; )
NOT?SEMI( T → :: <ob1> <rest> ; ) — ( F → :: ; ) . Name Description
?SEMIDROP( ob T → :: ob ; ) — ( ob F → :: <ob1> <rest> ; )
NOT?DROP( ob T → :: ob <ob1> <rest> ; ) — ( ob F → :: <ob1> <rest> ; )
?SWAP( ob1 ob2 T → :: ob2 ob1 <ob1> <rest> ; ) — ( ob1 ob2 F → :: ob1 ob2 <ob1> <rest> ; )
?SKIPSWAP( ob1 ob2 T → :: ob1 ob2 <ob1> <rest> ; ) — ( ob1 ob2 F → :: ob2 ob1 <ob1> <rest> ; )
?SWAPDROP( ob1 ob2 T → :: ob1 <ob1> <rest> ; ) — ( ob1 ob2 F → :: ob2 <ob1> <rest> ; )
NOT?SWAPDROP( ob1 ob2 T → :: ob2 <ob1> <rest> ; ) — ( ob1 ob2 F → :: ob1 <ob1> <rest> ; )
RPIT( T ob → :: ob <ob1> <rest> ; ) — ( F ob → :: <ob1> <rest> ; ) ob is actually executed, and not pushed in the stack.
RPITE( T ob1 ob2 → :: ob1 <ob1> <rest> ; ) — ( F ob1 ob2 → ob2 <ob1> <rest> ; ) ob1 or ob2 is actually executed, and not pushed in the stack.
COLARPITE( T ob1 ob2 → :: ob1 ; ) — ( F ob1 ob2 → :: ob2 ; ) ob1 or ob2 is actually executed, and not pushed in the stack. 34B4F 2'RCOLARPITE Return to composite and ITE there.
IT( T → :: <ob1> <rest> ; ) — ( F → :: <ob2> <rest> ; )
?SKIP( T → :: <ob2> <rest> ; ) — ( F → :: <ob1> <rest> ; ) aka: NOT_IT
ITE( T → :: <ob1> <ob3> <rest> ; ) — ( F → :: <ob2> <rest> ; )
COLAITE( T → :: <ob1> ; ) — ( F → :: <ob2> ; )
ITE_DROP( ob T → :: <ob2> <rest> ; ) — ( ob F → :: ob <ob1> <rest> ; )
ANDITE( f1 f2 → :: <ob1> <ob3> <rest> ; ) — ( f1 f2 → :: <ob2> <rest> ; )
case( T → :: <ob1> ; ) — ( F → :: <ob2> <rest> ; )
NOTcase( T → :: <ob2> <rest> ; ) — ( F → :: <ob1> ; )
ANDcase( f1 f2 → :: <ob1> ; ) — ( f1 f2 → :: <ob2> <rest> ; )
ANDNOTcase( f1 f2 → :: <ob1> ; ) — ( f1 f2 → :: <ob2> <rest> ; )
ORcase( f1 f2 → :: <ob1> ; ) — ( f1 f2 → :: <ob2> <rest> ; )
casedrop( ob T → :: <ob1> ; ) — ( ob F → :: ob <ob2> <rest> ; )
NOTcasedrop( ob T → :: ob <ob2> <rest> ; ) — ( ob F → :: <ob1> ; )
case2drop( ob1 ob2 T → :: <ob1> ; ) — ( ob1 ob2 F → :: ob1 ob2 <ob2> <rest> ; )
NOTcase2drop( ob1 ob2 T → :: ob1 ob2 <ob2> <rest> ; ) — ( ob1 ob2 F → :: <ob1> ; )
caseDROP( ob T → :: ; ) — ( ob F → :: ob <ob1> <rest> ; )
NOTcaseDROP( ob T → :: ob <ob1> <rest> ; ) — ( ob F → :: ; )
casedrptru( ob T → T ) — ( ob F → :: ob <ob1> <rest> ; ) Note: should be caseDRPTRU.
casedrpfls( ob T → F ) — ( ob F → :: ob <ob1> <rest> ; ) Note: should be caseDRPFLS. . Name Description
NOTcsdrpfls( ob T → :: ob <ob1> <rest> ; ) — ( ob F → F ) Note: should be NOTcaseDRPFLS.
case2DROP( ob1 ob2 T → :: ; ) — ( ob1 ob2 F → :: ob1 ob2 <ob1> <rest> ; )
NOTcase2DROP( ob1 ob2 T → :: ob1 ob2 <ob1> <rest> ; ) — ( ob1 ob2 F → :: ; )
case2drpfls( ob1 ob2 T → F ) — ( ob1 ob2 F → :: ob1 ob2 <ob1> <rest> ; ) Note: should be case2DRPFLS.
caseTRUE( T → T ) — ( F → :: <ob1> <rest> ; )
NOTcaseTRUE( T → :: <ob1> <rest> ; ) — ( F → T )
caseFALSE( T → F ) — ( F → :: <ob1> <rest> ; )
NOTcaseFALSE( T → :: <ob1> <rest> ; ) — ( F → F )
COLAcase( T → :: <ob1> ; ) — ( F → :: <ob2> <rest> ; ) Drops the rest of current stream and executes case in the stream above.
COLANOTcase( T → :: <ob2> <rest> ; ) — ( F → :: <ob1> ; ) Drops the rest of current stream and executes NOTcase in the stream above.

Binary Integer Tests

#=?SKIP( #m #n → :: <ob2> <rest> ; ) — ( #m #n → :: <ob1> <rest> ; )
#>?SKIP( #m #n → :: <ob1> <rest> ; ) — ( #m #n → :: <ob2> <rest> ; )
#=ITE( #m #n → :: <ob1> <ob3> <rest> ; ) — ( #m #n → :: <ob2> <rest> ; )
#<ITE( #m #n → :: <ob1> <ob3> <rest> ; ) — ( #m #n → :: <ob2> <rest> ; )
#>ITE( #m #n → :: <ob2> <rest> ; ) — ( #m #n → :: <ob1> <ob3> <rest> ; )
#=case( #m #n → :: <ob1> ; ) — ( #m #n → :: <ob2> <rest> ; )
OVER#=case( #m #n → :: #m <ob1> ; ) — ( #m #n → :: #m <ob2> <rest> ; )
#=casedrop( #m #n → :: <ob1> ; ) — ( #m #n → :: #m <ob2> <rest> ; ) Note: should be OVER#=casedrop.
#=casedrpfls( #m #n → F ) — ( #m #n → :: #m <ob1> <rest> ; ) Note: should be OVER#=caseDRPFLS.
#<>case( #m #n → :: <ob2> <rest> ; ) — ( #m #n → :: <ob1> ; )
#<case( #m #n → :: <ob1> ; ) — ( #m #n → :: <ob2> <rest> ; )
#>case( #m #n → :: <ob2> <rest> ; ) — ( #m #n → :: <ob1> ; )
#0=?SEMI( #0 → :: ; ) — ( # → :: <ob1> <rest> ; )
#0=?SKIP( #0 → :: <ob2> <rest> ; ) — ( # → :: <ob1> <rest> ; )
#0=ITE( #0 → :: <ob1> <ob3> <rest> ; ) — ( # → :: <ob2> <rest> )
DUP#0=IT( #0 → :: #0 <ob1> <rest> ; ) — ( # → :: # <ob2> <rest> ; )
DUP#0=ITE( #0 → :: #0 <ob1> <ob3> <rest> ; ) — ( # → :: # <ob2> <rest> ; )
#0=case( #0 → :: <ob1> ; ) — ( # → :: <ob2> <rest> ; )
DUP#0=case( #0 → :: #0 <ob1> ; ) — ( # → :: # <ob2> <rest> ; )
DUP#0=csedrp( #0 → :: <ob1> ; ) — ( # → :: # <ob2> <rest> ; ) . Name Description
DUP#0=csDROP( #0 → :: ; ) — ( # → :: # <ob1> <rest> ; )
#1=case( #1 → :: <ob1> ; ) — ( # → :: <ob2> <rest> ; )
#1=?SKIP( #1 → :: <ob2> <rest> ; ) — ( # → :: <ob1> <rest> ; )
#>2case( #0/#1/#2 → :: <ob2> <rest> ; ) — ( # → :: <ob1> ; )
?CaseKeyDef( # #' → :: ' ob1 T ; ) — ( # #' → :: <ob2> <rest> ; ) Compares two bints. If equal, quotes the next object from the runsream and returns it along with TRUE.
?CaseRomptr@( # #' → ob T ) — ( # #' → F ) ( # #' → :: <ob2> <rest> ; ) Compares two bints. If equal, tries to resolve the rompointer which must be the next object in the runstream

Real and Complex Number Tests

%0=case( %0 → :: %0 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
j%0=case( %0 → :: <ob1> ; ) — ( ob → :: <ob2> <rest> ; )
C%0=case( C%0 → :: C%0 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
num0=case( 0 → :: 0 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; ) Both a real and a complex zero are TRUE conditions for this test.
%1=case( %1 → :: %1 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
C%1=case( C%1 → :: C%1 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
num1=case( 1 → :: 1 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; ) Both a real and a complex one are TRUE conditions for this test.
%2=case( %2 → :: %2 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
C%2=case( C%2 → :: C%2 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
num2=case( 2 → :: 2 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; ) Both a real and a complex two are TRUE conditions for this test.
%-1=case( %-1 → :: %-1 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
C%-1=case( C%-1 → :: C%-1 <ob1> ; ) — ( ob → ob <ob2> <rest> ; )
num-1=case( -1 → :: -1 <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; ) Both a real and a complex -1 are TRUE conditions for this test.

Meta Object Tests

MEQ1stcase( meta&ob1 ob2 → ob1=ob2 ? case ) — Meta&ob1 ob2 ob1=ob2 ? case
AEQ1stcase( meta&ob → ob=nob ? case ) — Meta&ob ob=nob ? case
MEQopscase( meta1&ob1 meta2&ob2 ob3 → ) — Meta1&ob1 Meta2&ob2 ob3 2B06A AEQopscase meta1&ob1 meta2&ob2 Meta1&ob1 Meta2&ob2
Mid1stcase( meta&ob → ob is id ) — lam ? case Meta&ob ob is id or lam ? case . Name Description
M-1stcasechs( Meta&NEG → Meta COLA ) — ( Meta → Meta SKIP ) ( Meta&(%<0) → Meta&ABS(%) COLA ) Meta&NEG Meta COLA ; Meta Meta SKIP Meta&(%<0) Meta&ABS(%) COLA

General Object Tests

EQIT( ob1 ob1 → :: <ob1> <rest> ; ) — ( ob1 ob2 → :: <ob2> <rest> ; )
EQITE( ob1 ob1 → :: <ob1> <ob3> <rest> ; ) — ( ob1 ob2 → :: <ob2> <rest> ; )
jEQcase( ob1 ob1 → :: <ob1> ; ) — ( ob1 ob2 → :: <ob2> <rest> ; )
EQcase( ob1 ob1 → :: ob1 <ob1> ; ) — ( ob1 ob2 → :: ob1 <ob2> <rest> ; ) Note: Should be called OVEREQcase.
REQcase( ob → :: ob <ob2> ; ) — ( ob → :: ob <ob3> <rest> ; ) EQcase with the next object in the runstream.
EQcasedrop( ob1 ob1 → :: <ob1> ; ) — ( ob1 ob2 → :: ob1 <ob2> <rest> ; ) Note: should be OVEREQcasedrop.
REQcasedrop( ob → <ob2> ; ) — ( ob → <ob3> <rest> ; ) EQcasedrop with the next object in the run- stream.
EQUALcase( ob1 ob1 → :: <ob1> ; ) — ( ob1 ob2 → :: <ob2> <rest> ; )
EQUALNOTcase( ob1 ob1 → :: <ob2> <rest> ; ) — ( ob1 ob2 → :: <ob1> ; )
EQUALcasedrp( ob ob1 ob2 → :: <ob1> ; ) — ( ob ob1 ob2 → :: ob <ob2> <rest> ; )
EQUALcasedrop( ob1 ob2 → :: <ob1> ; ) — ( ob1 ob2 → :: ob1 <ob2> <rest> ; )
tok=casedrop( $ $' → :: <ob1> ; ) — ( $ $' → :: $ <ob2> <rest> ; ) Note: should be OVERtok=casedrop.
nonopcase( seco → :: seco <ob2> <rest> ; ) — ( ob → :: ob <ob1> ; )
idntcase( id → :: id <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
dIDNTNcase( id → :: id <ob2> <rest> ; ) — ( ob → :: ob <ob1> ; )
idntlamcase( id/lam → :: id <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
REALcase( % → :: <ob1> ; ) — ( ob → :: <ob2> <rest> ; )
dREALNcase( % → :: % <ob2> <rest> ; ) — ( ob → :: ob <ob1> ; )
dARRYcase( [] → :: [] <ob1> ; ) — ( ob → :: ob <ob2> <rest> ; )
dLISTcase( {} → :: {} ob1 ; ) — ( ob → :: ob <ob2> <rest> ; )
NOTLISTcase( {} → :: {} <ob2> <rest> ; ) — ( ob → :: ob <ob1> ; )
NOTSECOcase( seco → :: seco <ob2> <rest> ; ) — ( ob → :: ob <ob1> ; )
NOTROMPcase( romp → :: romp <ob2> <rest> ; ) — ( ob → :: ob <ob1> ; )
numb1stcase( %/C%/[]/[L] → :: <ob1> ; ) — ( ob → :: ob2 <rest> ; ) If %, C%, [ ] or [L] then COLA, else SKIP.

Miscellaneous

UserITE( #set → :: <ob1> <ob3> <rest> ; ) — ( #clr → :: <ob2> <rest> ; )
SysITE( #set → :: <ob1> <ob3> <rest> ; ) — ( #clr → :: <ob2> <rest> ; )
caseDoBadKey( T → :: DoBadKey ; ) — ( F → :: <ob1> <rest> ; ) aka: caseDEADKEY
caseDrpBadKy( ob T → :: DoBadKey ; ) — ( ob F → :: ob <ob1> <rest> ; )
caseERRJMP( T → :: ERRJMP ; ) — ( F → :: <ob> <rest> ; )
caseSIZEERR( T → :: SIZEERR ; ) — ( F → :: <ob> <rest> ; )
NcaseSIZEERR( T → :: <ob> <rest> ; ) — ( F → :: SIZEERR ; )
NcaseTYPEERR( T → :: <ob1> <rest> ; ) — ( F → :: TYPEERR ; )
NoEdit?case( → :: <ob1> <rest> ; ) — ( → :: <rest> ; ) Tests if there is no edit line active.
EditExstCase( → :: <ob1> <rest> ; ) — ( → :: <rest> ; ) Tests if there is an edit line active.
(ALGcase)( → :: <ob1> ; ) — ( → :: <ob2> <rest> ) Tests for algebraic mode and does case.

Loops

33

Definite Loops

AGAIN( → ) — Sets the interpreter pointer to the topmost value in the return stack, without popping it.
REPEAT( → ) — Sets the interpreter pointer to the topmost value in the return stack, without popping it.
UNTIL( flag → ) — If FALSE then AGAIN, otherwise RDROP.
NOT_UNTIL( flag → ) — NOT then UNTIL.
#0=UNTIL( # → # ) — Actually, should be DUP#0=UNTIL.
WHILE( flag → ) — If TRUE does nothing, otherwise RDROP then 2SKIP.
NOT_WHILE( flag → ) — NOT then WHILE.
DUP#0<>WHILE( # → ) — Try to guess what it does.
DO( #stop #start → )
ZERO_DO( #stop → )
DUP#0_DO( #stop → #stop )
ONE_DO( #stop → )
#1+_ONE_DO( #stop → )
toLEN_DO( {} → {} ) — From ONE to #elements.
LOOP( → )
+LOOP( # → ) — Increments index by specified number.
DROPLOOP( ob → )
SWAPLOOP( ob1 ob2 → ob2 ob1 )
SEMILOOP( → )
INDEX@( → # ) — Recalls topmost loop counter value. . Name Description
DUPINDEX@( ob → ob # )
SWAPINDEX@( ob1 ob2 → ob2 ob1 # )
OVERINDEX@( ob1 ob2 → ob1 ob2 ob1 # )
INDEX@#-( # → #' )
INDEXSTO( # → ) — Stores new topmost loop counter value.
ISTOP@( → # ) — Recalls topmost loop stop value.
ISTOPSTO( # → ) — Stores new topmost loop stop value.
ISTOP-INDEX( → # )
JINDEX@( → # ) — Recalls second topmost loop counter value.
JINDEXSTO( # → ) — Stores new second topmost loop counter value.
JSTOP@( → # ) — Recalls second topmost loop stop value.
JSTOPSTO( # → ) — Stores new second topmost loop stop value.
ExitAtLOOP( → ) — Does not exit loop immediately. Just stores zero as the stop value, so all objects until the next LOOP will be evaluated. aka: ZEROISTOPSTO

Error Handling

19

General Words

ERRBEEP( → ) — Beeps.
ERROR@( → # ) — Returns current error number.
ERRORSTO( # → ) — Stores new error number.
ERROROUT( # → ) — Stores new error number and calls ERRJMP.
ERRORCLR( → ) — Stores zero as new error number.
ERRJMP( → ) — Invokes error handling sub-system.
GETEXITMSG( → $ ) — Gets EXITMSG (user defined error message).
EXITMSGSTO( $ → ) — Stores $ as EXITMSG.
DO#EXIT( # → ) — Stores new error number, does AtUserStack and then ERRJMP.
DO%EXIT( % → ) — Same as above, but takes real number as argu- ment.
DO$EXIT( $ → ) — Stores string as EXITMSG, #70000 as error number, does AtUserStack and then ERRJMP.
ABORT( → ) — Does ERRORCLR and ERRJMP.
ERRSET( → ) — Sets new error trap.
ERRTRAP( → ) — Error trap marker. If no error happens, still removes all temporary environments created since ERRSET.
JstGetTHEMESG( # → $ ) — Fetches message from message table. To get a message from a library, use the formula: libnum*#100+msgnum. aka: JstGETTHEMSG
GETTHEMESG( # → $ ) — If #70000 then does GETEXITMSG, else does JstGetTHEMESG.
(?GETMSG)( # → $msg ) — ( ob → ob ) If the argument is a bint, does JstGETTHEMSG to fetch a message. Other arguments are re- turned unchanged.

Error Generating Words

Sig?ErrJmp( # → ) — Calls ERRJMP if the error number is any of {13E 123 DFF}.
ederr( → ) — Error handler for applications which use savefmt1 to save the current display format. Calls rstfmt1 and then errors out.

The Virtual Stack

20

Reference

PushVStack( obn..ob1 → obn..ob1 ) — Virtual Stack: ( → [obn..ob1] ) Pushes the RPN stack onto the Virtual Stack. The RPN stack is unchanged.
PushVStack&Clear( obn..ob1 → ) — Virtual Stack: ( → [obn..ob1] ) Does PushVStack and then clears the RPN stack.
PopMetaVStackDROP( → obn..ob1 ) — Virtual Stack: ( [obn..ob1] → ) Pops the topmost virtual stack into the RPN stack. The previous contents of the RPN stack are preserved. (The Meta in
PopVStack( obm..ob1 → obn'..ob1' ) — Virtual Stack: ( [obn'..ob1'] → ) Pops the topmost virtual stack into the RPN stack. The previous contents of the RPN stack are lost.
GetMetaVStackDROP( → obn..ob1 ) — Virtual Stack: ( [obn..ob1] → [obn..ob1] ) Inserts the objects from the topmost virtual stack into the RPN stack. The Virtual Stack is unchanged. (The
GetVStack( obm..ob1 → obn'..ob1' ) — Virtual Stack: ( [obn'..ob1'] → [obn'..ob1'] ) Copies the topmost virtual stack into the RPN stack. The Virtual Stack is not changed, but the current
PushMetaVStack( obn..ob1 #n → obn..ob1 #n ) — Virtual Stack: ( → [obn..ob1] ) Pushes #n objects as a new virtual stack. Any other objects in the RPN stack are not pushed. The RPN stack is unchange
PushMetaVStack&Drop( obn..ob1 #n → ) — Virtual Stack: ( → [obn..ob1] ) Does PushMetaVStack then drops the pushed objects. Any other objects present in the RPN stack are neither pushed nor d
PopMetaVStack( → obn..ob1 #n ) — Virtual Stack: ( [obn..ob1] → ) Insers the contents of the most recent vir- tual stack into the RPN stack, followed by the count. The previous content
GetMetaVStack( → obn..ob1 #n ) — Virtual Stack: ( [obn..ob1] → [obn..ob1] ) Inserts the objects from the topmost virtual stack into the RPN stack, along with the count. The Virtual St
PushVStack&Keep( obn..ob1 obm'..ob1' #m → obm'..ob1' #m ) — Virtual Stack: ( → [obn..ob1] ) Pushes the contents of the RPN stack which do not belong to the meta (ie, are "above" it) into a new virtual stack, re
PushVStack&KeepDROP( obn..ob1 obm'..ob1' #m → obm'..ob1' ) — Virtual Stack: ( → [obn..ob1] ) Does PushVStack&Keep and then DROP.
PopVStackAbove( obm'..ob1' → obn..ob1 obm'..ob1' ) — Virtual Stack: ( [obn..ob1] → ) Pops the contents of the topmost virtual stack (like PopMetaVStackDROP would have done) into the RPN stack, but above
DropVStack( → ) — Virtual Stack: ( [obn..ob1] → ) Drops the topmost virtual stack from the Vir- tual Stack.
GetElemTopVStack( #i → obi ) — Virtual Stack: ( [obn..ob1] → [obn..ob1] ) Returns the ith object from the topmost vir- tual stack, counting from the top. "Counting from the top" mea
PutElemTopVStack( new_ob #i → ) — Virtual Stack: ( [obn..ob(n-i)..ob1] → [obn..new_ob..ob1] ) Replaces the ith object from the topmost virtual stack with new_ob, counting from the top.
GetElemBotVStack( #i → obi ) — Virtual Stack: ( [obn..ob1] → [obn..ob1] ) Returns the ith object from the topmost virtual stack, counting from the bottom. "Counting from the bottom"
PutElemBotVStack( new_ob #i → ) — Virtual Stack: ( [obn..obi..ob1] → [obn..new_ob..ob1] ) Replaces the ith object from the topmost virtual stack with new_ob, counting from the bottom.
GetVStackProtectWord( → # ) — Hacking stuff: Gets the protection word of the last VStack level.
SetVStackProtectWord( # → ) — Hacking stuff: Sets the protection word of the last VStack level.

Memory Operations

52

Recalling, Storing and Purging

@( id/lam → ob T ) — ( id/lam → F ) Basic recalling function.
DUP@( id/lam → id/lam ob T ) — ( id/lam → id/lam F ) Does DUP then @.
SAFE@( id/lam → ob T ) — ( id/lam → F ) For lams does @. For ids does ?ROMPTR> to the ob found.
DUPSAFE@( id/lam → id/lam ob T ) — ( id/lam → id/lam F ) Does DUP then SAFE@.
SAFE@_HERE( id → ob F ) — ( id → T ) Same as SAFE@, but works only in the current directory.
Sys@( ID → ob T ) — ( ID → F ) Switches temporarily to the HOME directory and executes @ there.
XEQRCL( id → ob ) — Same as SAFE@, but errors if variable is not found. Also works for lams, but you get the wrong error.
LISTRCL( {path id} → ob ) — Recalls from specified path.
STO( ob id/lam → ) — For ids this assumes ob is not pco. If replacing some object, that object is copied to TEMPOB and pointers are updated. For lams: Errors if lam is unb
SAFESTO( ob id/lam → ) — For ids, does ?>ROMPTR to the object before storing.
SysSTO( ob ID → ) — Switches temporarily to the HOME directory and executes STO there.
XEQSTOID( ob id/lam → ) — Same as SAFESTO, but will only store in the current directory and will not overwrite a di- rectory. aka: ?STO_HERE
XEQStoKey( ob ID → )
xSTO>( ob id → ) — ( ob symb → ) Like xSTO, but if the level 1 argument is sym- bolic, use the first element of it as the variable to write to.
ˆPROMPTSTO1( id/lam → ) — Inputs value for a variable and stores it.
REPLACE( newob oldob → newob ) — Replaces oldob (in memory) with newob.
PURGE( id → ) — Purges variable. Does no type check first.
?PURGE_HERE( id → ) — Like PURGE, but only works in current direc- tory.
ˆSAFEPURGE( idnt/lam → ) — Purge idnt/lam if it exist.
CREATE( ob id → ) — Creates a variable in the current directory. Er- rors if id is or contains current directory. As- sumes id is not a pco. . Name Description
DoHere:( → ) — Next object in the runstream is evaluated for the current directory only.
'LAMLNAMESTO( ob → ) — STO to LAM LAMLNAME.

Directories

CREATEDIR( id → ) — Creates an empty directory. Calls ?PURGE_HERE first to delete the original.
LASTRAM-WORD( rrp → ob T ) — ( rrp → F ) Recalls first object in directory.
LastNonNull( rrp → ob T ) — ( rrp → F ) Recalls first object in directory (not null named).
PREVRAM-WORD( ob → ob' T ) — ( ob → F ) Recalls next object in directory.
PrevNonNull( ob → ob' T ) — ( ob → F ) Recalls next object in directory (not null named).
RAM-WORDNAME( ob → id ) — Recalls name of object in current directory.
XEQPGDIR( id → ) — Purges a directory. Checks references, etc. first.
XEQORDER( {id1 id2..} → ) — Orders the variables in the directory by mov- ing the given variables to the beginning of the directory.
DOVARS( → {id1 id2..} ) — Returns list of variables from current directory.
DOTVARS%( % → {} ) — Returns a list of variables in the current direc- tory with user type given by the number. In- ternal TVARS if a single number was given.
ˆDOTVARS{}( {# #' ...} → {} ) — Returns a list of variables in the current direc- tory with user type given by any of the num- bers in the list. This is the core of the TVARS program
PATHDIR( → {HOME dir1 dir2..} ) — Returns current path.
UPDIR( → ) — Goes to parent directory.
CONTEXT@( → rrp ) — Recalls current directory.
CONTEXT!( rrp → ) — Sets new current directory.
SYSRRP?( rrp → flag ) — Is rrp HOME?
HOMEDIR( → ) — Sets HOME as current directory. aka: SYSCONTEXT
SaveVarRes( → ) — Binds current and last directories to two null- named lams.
RestVarRes( → ) — First sets HOME as both the current and last directories (in case an error happens). Then, restores the current and last directories from 1LAM and 2LA

The Hidden Directory

SetHiddenRes( → ) — Sets the hidden directory as the current and last directories.
WithHidden( → ? ) — Executes next command in hidden directory.
RclHiddenVar( id → ob T ) — ( id → F ) Recalls variable in hidden directory. Same as :: WithHidden @ ;
StoHiddenVar( ob id → ) — Stores variable in hidden directory. Same as :: WithHidden STO ;
PuHiddenVar( id → ) — Purges variable in hidden directory. Same as :: WithHidden PURGE ;

Temporary Memory

TOTEMPOB( ob → ob' ) — Copies object to TEMPOB and returns pointer to the new copy.
TOTEMPSWAP( ob1 ob2 → ob2' ob1 ) — Does TOTEMPOB then SWAP.
CKREF( ob → ob' ) — If object is in TEMPOB, is not embedded in a composite and not referenced, does nothing. Else copies it to TEMPOB and returns the copy.
SWAPCKREF( ob1 ob2 → ob2 ob1' ) — Does SWAP then CKREF.
INTEMNOTREF?( ob → ob flag ) — If the object is in TEMPOB area, is not embed- ded in a composite and is not referenced, re- turns the object and TRUE, otherwise returns the object a
˜INTEMPOB?( ob → ob flag )

Time and Alarms

28

Reference

SLOW( → ) — 15 millisecond delay.
VERYSLOW( → ) — 300 millisecond delay.
SORTASLOW( → ) — 1.2 second delay (4 x VERYSLOW).
VERYVERYSLOW( → ) — 3 second delay.
dowait( %secs → ) — Waits specified number of seconds.
%>HMS( % → %hms ) — Converts from decimal to H.MMSS format.
%%H>HMS( %% → %%hms ) — Same as %>HMS, but for long reals.
%HMS>( %hms → % ) — Converts from H.MMSS format to decimal.
%HMS+( %hms1 %hms2 → %hms ) — Adds time in hms format.
%HMS-( %hms1 %hms2 → %hms ) — Subtracts time in hms format.
TOD( → %time ) — Returns current time.
VerifyTOD( %time → %time ) — Checks for validaty of time. Errors if not valid.
DATE( → %date ) — Returns current date.
DATE+DAYS( %date %days → %date' ) — Adds specified number of days to date.
DDAYS( %date1 %date2 → %days ) — Returns number of days between two dates.
CLKTICKS( → hxs ) — Returns tick count. aka: SysTime
TIMESTR( %dt %tm → "dy dt tm" ) — Returns string representation of time, using current format. Example: "WED 06/24/98 10:00:45A"
Date>d$( %date → $ ) — Returns string representation of date, using cur- rent format.
TOD>t$( %time → $ ) — Returns string represent the time, using current format.
Date>hxs13( %date → hxs ) — Converts date to ticks.
(Ticks>Date)( hxs → %date ) — Returns date from hxs of internal alarm list for- mat.
(Ticks>TOD)( hxs → %time ) — Returns time from hxs of internal alarm list for- mat.
(Ticks>Rpt)( hxs → %rpt ) — Converts hxs in internal alarm list format to repetition interval.

Alarms

ALARMS@( → {} ) — Returns internal alarms list.
STOALM( %date %time acti %rep → % ) — Stores an alarm. %repeat is the number of ticks between every repetition. Since there are 8192 ticks in a second, 60 seconds in a minute, and 60 minut
PURGALARM%( % → ) — Internal DELALARM.
RCLALARM%( %n → {} ) — Recalls nth alarm. List is in the format of STOALARMLS.
ALARM?( → flag ) — Returns TRUE if an alarm is due.

System Functions

56

User and System Flags

SetSysFlag( # → ) — Sets the system flag with number #.
ClrSysFlag( # → ) — Clears the system flag with number #.
TestSysFlag( # → flag ) — Returns TRUE if system flag is set.
SetUserFlag( # → ) — Set the user flag with number #.
ClrUserFlag( # → ) — Clear the user flag with number #.
TestUserFlag( # → flag ) — Returns TRUE if user flag is set.
RCLSYSF( → hxs ) — Recalls system flags from 1 to 64.
(STOSYSF)( hxs → ) — Stores system flags from 1 to 64.
DOSTOSYSF( hxs → ) — Stores system flags from 1 to 64, checking for changes in LASTARG flag. . Name Description
(RCLSYSF2)( → hxs ) — Recalls system flags from 65 to 128.
(STOSYSF2)( hxs → ) — Stores system flags from 65 to 128.
RCLUSERF( → hxs ) — Recalls user flags from 1 to 64.
(STOUSERF)( hxs → ) — Stores user flags from 1 to 64.
(RCLUSERF2)( → hxs ) — Recalls user flags from 65 to 128.
(STOUSERF2)( hxs → ) — Stores user flags from 65 to 128.
(STOALLF)( hxs_usr hxs_sys → ) — Stores user and system flags from 1 to 64. First is user flags, second is system flags.
(STOALLF2)( hxs_sys1 hxs_usr1 hxs_sys2 hxs_usr2 → ) — Expects 4 hxs and stores them as user and system flags.
(DOSTOALLF2)( {} → ) — Stores system and user flags. Expects a list with two or four hxs. The first two are the system and user flags, respectively, from 1 to and user flags
SaveSysFlags( → ) — Save system flags in a virtual stack.
RestoreSysFlags( → ) — Restore system flags from virtual stack, pop- ping that level. 2ABF0 RunSafeFlags Run Stream: ( ob → ) Evaluates the next object in the runstream, but
DoRunSafe( ob → hxs1 hxs2 ) — Evaluate ob and put the system flags as they were before the evaluation on the stack. Used by RunSafeFlags and RunSafeFlagsNoEr- ror. 2ABD7 RunSafeFla
DOHEX( → ) — Switch stack display format of HEX strings to hexadecimal.
DODEC( → ) — Switch stack display format of HEX strings to decimal.
DOBIN( → ) — Switch stack display format of HEX strings to binary.
DOOCT( → ) — Switch stack display of HEX strings to octal.
BASE( → # ) — Returns #10h, #10d, #10b or #10o. In decimal terms, 16 for hexadecimal base, 10 for decimal base, 8 for octal base or 2 for binary base.
DOSTD( → ) — Internal version of user word STD.
DOFIX( # → ) — Internal version of user word FIX.
DOSCI( # → ) — Internal version of user word SCI.
DOENG( # → ) — Internal version of user word ENG.
savefmt1( → ) — Saves the current number format, and changes to STD mode. . Name Description
rstfmt1( → ) — Restores the number format saved by savefmt1. Only one set of flags can be saved, there is no nesting of these entries.
SETRAD( → ) — Set angular mode to RAD.
RAD?( → flag ) — Is angular mode RAD?
SETDEG( → ) — Set angular mode DEG.
SETGRAD( → ) — Set angular mode GRAD.
DPRADIX?( → flag ) — Returns TRUE if current radix is ".".

General Functions

DOBEEP( %freq %dur → ) — Beeps. Analog to user function BEEP.
setbeep( #ms #Hz → ) — Also beeps.
TurnOff( → ) — Internal OFF.
DEEPSLEEP( → flag ) — Puts HP into deepsleep mode. Returns TRUE if "Invalid Card Data" message.
LowBat?( → flag ) — Returns TRUE if low battery.
ShowInvRomp( → ) — Flashes "Invalid Card Data" message.
?FlashAlert( → ) — Displays system warnings.
GARBAGE( → ) — Forces garbage collection.
MEM( → # ) — Returns amount of free memory in nibbles. Does not do garbage collection. (The user word does.)
OSIZE( ob → # ) — Returns object size in nibbles. Forces garbage collection.
OCRC( ob → #nib hxs ) — Returns size in nibbles and checksum as hxs.
OCRC%( ob → hxs %bytes ) — Returns checksum and size in bytes.
VARSIZE( id → hxs %bytes ) — Returns checksum and size in bytes of specified variable.
INHARDROM?( ob → ob flag ) — Is object address < #80000h?
CHANGETYPE( ob #prolog → ob' ) — Changes prolog of object, does TOTEMPOB.
>LANGUAGE( # → ) — Sets the current language for messages. Inter- nal version of x→LANGUAGE.
LANGUAGE>( → # ) — Returns the current language for messages. In- ternal version of the xLANGUAGE→ command.
NOBLINK( → ) — Clears the BLINKFLAG, SysNib5.
?BlinkCursor( → ) — Makes the cursor Blink if in App-mode or Edit- line.

Serial Communications

23

Reference

SENDLIST( {} → ) — Internal SEND.
GETNAME( $/id/lam → ) — Internal KGET.
DOFINISH( → ) — Internal FINISH.
DOPKT( $ $' → ) — Internal PKT.
DOBAUD( % → ) — Internal BAUD.
DOPARITY( % → ) — Internal PARITY.
DOTRANSIO( % → ) — Internal TRANSIO.
DOKERRM( → $ ) — Internal KERRM.
DOBUFLEN( → % 0/1 ) — Internal BUFLEN.
DOSBRK( → ) — Internal SBRK.
DOSRECV( % → ) — Internal SRECV.
CLOSEUART( → ) — Internal CLOSEIO.
DOCR( → ) — Internal CR.
DODELAY( % → ) — Internal DELAY.
APNDCRLF( $ → $' ) — Appends carriage return and line feed to string.
StdIOPAR( → {} ) — Default IOPAR: { 9600 0 0 0 3 1 }.
GetIOPAR( → %baud % % % % % ) — Recalls IOPAR and explodes it into the stack.
StoIOPAR( {} → ) — STO the list of IO parameters in the HOME direc- tory in the variable IOPAR.
SetIOPARErr( → ) — Throws the IOPAR error: "Invalid IOPAR".
KVISLF( $ → $' ) — Like KVIS, but insert <cr> in front of each new- line for PC's.
KVIS( $ → $' ) — Translate special characters into digraphs for ASCII transfer to a PC.
KINVISLF( $ → $' ) — Translate digraphs in the string to characters. and remove <cr> from th end of lines.
VERSTRING( → $ ) — Returns version string.

The HP49 Filer

3

Reference

ˆFiler( → ) — Calls the standard filer.
ˆFILER_MANAGER( {path} {args} → ) — Customized Filer, browsing all object types.
ˆFILER_MANAGERTYPE( {types} {path} {args} → ) — {args} = { item1 item2 ... } item = {name loc action [prog] [key]} ... } Customized filer for selected types only. Part III Input and Output

Checking for Arguments

99

Reference

CK0( → ) — Saves current command to LASTCKCMD. Marks stack below level 1 to STACKMARK.
CK1( ob → ob ) — Saves current command to LASTCKCMD. Veri- fies that there is at least one object in the stack, if not generates a "Too Few Arguments" error. Saves sta
CK2( ob1 ob2 → ob1 ob2 ) — Like CK1, but checks for at least two arguments.
CK3( ob1...ob3 → ob1...ob3 ) — Like CK1, but checks for at least three argu- ments.
CK4( ob1...ob5 → ob1...ob5 ) — Like CK1, but checks for at least four arguments.
CK5( ob1...ob5 → ob1...ob5 ) — Like CK1, but checks for at least five arguments.
CKN( ob1...obn %n → ob1..obn #n ) — Checks for a real in level one. Then checks for that number of arguments. Finally, converts the real to a bint.
CK0NOLASTWD( → ) — Like CK0, but does not save current command.
CK1NOLASTWD( ob → ob ) — Like CK1, but does not save current command.
CK2NOLASTWD( ob1 ob2 → ob1 ob2 ) — Like CK2, but does not save current command.
CK3NOLASTWD( ob1...ob3 → ob1...ob3 ) — Like CK3, but does not save current command.
CK4NOLASTWD( ob1...ob4 → ob1...ob4 ) — Like CK4, but does not save current command.
CK5NOLASTWD( ob1...ob5 → ob1...ob5 ) — Like CK5, but does not save current command.
CKNNOLASTWD( ob1...obn %n → ob1..obn #n ) — Like CKN, but does not save current command.
CK&DISPATCH0( → ) — Dispatches on stack argument.
CK&DISPATCH1( → ) — Dispatches on stack arguments, stripping tags and converting reals to ZINTS if necessary.
CK&DISPATCH2( → ) — Equivalent to CK&DISPATCH1.
CK1&Dispatch( → ) — Combines CK1 with CK&DISPATCH1.
CK2&Dispatch( → ) — Combines CK2 with CK&DISPATCH1.
CK3&Dispatch( → ) — Combines CK3 with CK&DISPATCH1.
CK4&Dispatch( → ) — Combines CK4 with CK&DISPATCH1.
CK5&Dispatch( → ) — Combines CK5 with CK&DISPATCH1.
0LASTOWDOB!( → ) — Clears command save by last CK<n> command. aka: 0LASTOWDOB!, 0LastRomWrd!
AtUserStack( → ) — :: CK0NOLASTWD 0LASTOWDOB! ;
CK1NoBlame( → ) — :: 0LASTOWDOB! CK1NOLASTWD ; . Name Description
'RSAVEWORD( → ) — Stores first object in the composite above the ac- tual to LASTCKCMD. aka: 'RSaveRomWrd
EvalNoCK( comp → ? ) — Evaluates composite without saving as current command. If first command is CK<n>&Dispatch it is replaced by CK&DISPATCH1. If first command is CK<n> it

Type Checking

CKREAL( % → % ) — ( Z → % ) Checks for real. If a ZINT, convert to real. Else SETTYPEERR.
ˆCK1Z( $/#/hxs → Z ) — CHecks for an integer. Converts strings, bints or hxs's to zints. Errors for other ob- ject types.
ˆCK2Z( ob ob' → Z Z' ) — Like ˆCK1Z, but for two objects.
ˆCK3Z( ob ob' ob'' → Z Z' Z'' ) — Like ˆCK1Z, but for three objects.
CKSYMBTYPE( → ) — Checks for quoted name (name as symbolic).
nmetasyms( meta → meta ) — Checks for meta containing %, C%, unit, id, lam or symb.
TYPE( ob → #prolog ) — Returns address of prolog of object.
XEQTYPE( ob → ob %type ) — System version of user word TYPE, but this keeps the object.
TYPEREAL?( ob → flag )
DUPTYPEREAL?( ob → ob flag ) — aka: DTYPEREAL?
TYPECMP?( ob → flag )
DUPTYPECMP?( ob → ob flag )
TYPECSTR?( ob → flag )
DUPTYPECSTR?( ob → ob flag ) — aka: DTYPECSTR?
DUPTYPEARRY?( ob → ob flag ) — aka: DTYPEARRY?
TYPEARRY?( ob → flag ??? )
TYPERARRY?( ob → flag )
TYPECARRY?( ob → flag )
TYPELIST?( ob → flag )
DUPTYPELIST?( ob → ob flag ) — aka: DTYPELIST?
TYPEIDNT?( ob → flag )
DUPTYPEIDNT?( ob → ob flag )
TYPELAM?( ob → flag )
DUPTYPELAM?( ob → ob flag )
ˆTYPEIDNTLAM?( ob → flag ) — Tests if ob is ID or lam.
(ILnot?)( ob → ob flag ) — Tests if ob is neither an ID nor a LAM.
TYPESYMB?( ob → flag )
DUPTYPESYMB?( ob → ob flag )
TYPEHSTR?( ob → flag )
DUPTYPEHSTR?( ob → ob flag )
TYPEGROB?( ob → flag ) — . Name Description
DUPTYPEGROB?( ob → ob flag )
TYPETAGGED?( ob → flag )
DUPTYPETAG?( ob → ob flag )
TYPEEXT?( ob → flag ) — Is ob a unit object?
DUPTYPEEXT?( ob → ob flag ) — Is ob a unit object?
TYPEROMP?( ob → flag )
DUPTYPEROMP?( ob → ob flag )
TYPEBINT?( ob → flag )
DUPTYPEBINT?( ob → ob flag )
TYPERRP?( ob → flag )
DUPTYPERRP?( ob → ob flag )
TYPECHAR?( ob → flag )
DUPTYPECHAR?( ob → ob flag )
TYPECOL?( ob → flag ) — Is on a secondary?
DUPTYPECOL?( ob → ob flag ) — Is ob a secondary? aka: DTYPECOL?
TYPEAPLET?( ob → flag )
DUPTYPEAPLET?( ob → ob flag )
TYPEFLASHPTR?( ob → flag )
DUPTYPEFLASHPTR?( ob → ob flag )
TYPEFONT?( ob → flag )
DUPTYPEFONT?( ob → ob flag )
TYPELNGCMP?( ob → flag )
DUPTYPELNGCMP?( ob → ob flag )
TYPELNGREAL?( ob → flag )
DUPTYPELNGREAL?( ob → ob flag )
TYPEZINT?( ob → flag )
DUPTYPEZINT?( ob → ob flag )
ˆTYPEZ?( ob → flag )
ˆDUPTYPEZ?( ob → ob flag )
ˆTYPEGAUSSINT?( ob → flag ) — Checks if ob is Gaussian integer.
ˆDTYPEGAUSSINT?( ob → ob flag ) — Checks if ob is Gaussian integer.
ˆDUPTYPEGAUSSINT?( ob → ob flag ) — Checks if ob is Gaussian integer.
ˆCK1Cext( ob → flag ) — Checks if object is integer or Gaussian inte- ger.
ˆCKALG( ob → ob ) — Checks that an object is real/cmplx/unit or idnt/lam/symbolic.
?OKINALG( ob → ob flag ) — Is object allowed in algebraics?
ˆDTYPFMAT?( ob → ob flag ) — Tests if object is a symbolic matrix.
ˆIDNTLAM?( ob → ob flag ) — Tests if ob is idnt or lam.
ˆFLOAT?( ob → ob flag ) — Tests if ob is real or complex.
ˆREAL?( ob → ob flag ) — Tests if ob is real, zint or hxs.
ˆTYPEREALZINT?( ob → flag ) — Tests if ob is real, zint or hxs.
ˆCKSYMREALCMP( ob → ob ) — Does "Bad Argument Type" error if ob is not a real, complex or symbolics.

Keyboard Control

28

Key Locations

CHECKKEY( → #kc T ) — ( → F ) Returns next key in the key buffer (if there is one), but does not pop it. Does handle shift-hold keys.
GETTOUCH( → #kc T ) — ( → F ) Pops next key from key buffer (if there is one). Does handle shift-hold keys.
GETKEY( → #kc flag ) — Get a single keypress from the keybuffer, waits if necessary. The key is returned along with TRUE. If an exception happens, returns FALSE. The excepti
GETKEY*( → #kc T ) — ( → F F ) ( → {Alrmlist} T F ) Get a single keypress from the keybuffer, waits if necessary. The key is returned along with TRUE. If an exception happ
GetKeyOb( → ob ) — Wait for a single key and return the object as- sociated with this key. Does handle shift-hold keys.
DoKeyOb( ob → ) — Execute ob as if it had been assigned to a key and the key had been pressed.
REPKEY?( #kc → flag ) — Returns TRUE if the key is being pressed.
KEYINBUFFER?( → flag ) — Returns TRUE if there is at least a key in the key buffer.
WaitForKey( → #kc #flag ) — Returns next full key press. Does not handle shift-hold keys.
Wait/GetKey( % → ? ) — Internal WAIT command. Does not handle shift- hold keys.

The ATTN Flag

ATTN?( → flag ) — Returns TRUE if CANCEL has been pressed.
?ATTNQUIT( → ) — If CANCEL has been pressed, ABORTs program. aka: ?ATTN_QUIT
CK0ATTNABORT( → ) — Executed by the UserRPL program delimiters x<< and x>> and by xUNTIL. Mainly just ?ATTNQUIT.
NoAttn?Semi( → ) — If CANCEL has been not pressed, drops the rest of the stream.
ATTNFLG@( → # ) — Recalls CANCEL key counter.
ATTNFLGCLR( → ) — Clears CANCEL key counter. Does not affect the key buffer.

Bad Keys

DoBadKey( → ) — Beeps.
DropBadKey( ob → ) — Beeps.
2DropBadKey( ob ob' → ) — Beeps.

User Keys

UserKeys?( → flag ) — Does BINT62 TestSysFlag.
GetUserKeys( → {} ) — Returns user keys list (internal format).
(AsnKey)( ob #kc #p → ) — Assigns an object to a key, specified in system format.
(NonUsrKeyOK?)( → flag ) — Returns TRUE if the keys not defined do their normal actions.
(SetNUsrKeyOK)( → ) — Keys not defined do their normal actions.
(ClrNUsrKeyOK)( → ) — Keys not defined just beep when pressed.
Key>StdKeyOb( #kc #pl → ob ) — Recalls the standard assignment of the key. This is the assignment which is active when USER mode is of.
Key>U/SKeyOb( #kc #pl → ob ) — If user mode is on, recalls the user object as- signed to a key. If user mode is off, recalls the standard assignment instead.
ˆKEYEVAL( % → ? ) — Keystroke evaluation. If % is negative, the standard key is always evaluated.

Using InputLine

3

Reference

InputLine( args → $ T ) — ( args → $ ob1..obn T ) ( args → ob1..obn T ) ( args → F ) args = $pr $line #pos #I/R #I/A #alph menu #row attn #parse
(input$)( $1 $2 → $3 ) — This is what the User command INPUT does if level 1 is a string.
(input{})( $1 {} → $3 ) — This is what the User command INPUT does if level 1 is a list.

The Parameterized Outer Loop

10

Reference

AppMode?( → flag ) — Is currently a POL active?
SetAppMode( → )
ClrAppMode( → )
SetNAppKeyOK( → )
DoStdKeys?( → flag )
SetDoStdKeys( → )
SuspendOK?( → flag ) — Does the current user interface allow suspen- sion?
nohalt( → ob ) — :: LAM 'nohalt ;
SetAppSuspOK( → )
ClrAppSuspOK( → )

Using the HP49 Browser

10

Reference

(ˆChoose3)( meta $title #pos ::handler → ob T ) — ( meta $title #pos ::handler → F ) The main choose engine.
(ˆChoose3Index)( meta $title #pos ::handler → #idx T ) — ( meta $title #pos ::handler → F ) Same as ˆChoose3, but returns the index of the selected item instead of the item itself. #idx starts at zero.
(ˆChoose2)( meta $title #pos → ob T ) — ( meta $title #pos → F ) Call Choose3Index with empty message handler. This is just :: 'DROPFALSE FPTR2 ˆChoose3Index ;
(ˆChoose3Save)( meta $title #pos ::handler → ob T ) — ( meta $title #pos ::handler → F ) Save and restore HARDBUFF/2 around a Choose3 call.
(ˆsysCHOOSE)( $title {} %sel → ob %1 ) — ( $title {} %sel → %0 ) Equivalent to User RPL CHOOSE com- mand.
(ˆChooseDefHandler)( → ::handler ) — Pushed the default message handler (the one used by the CAT key) on the stack. 49 Browser
(ˆSaveHARDBUFF)( → ) — Save HARDBUFF and HARDBUFF2 is a safe place.
(ˆRestoreHARDBUFF)( → ) — Restore HARDBUFF and HARDBUFF2 saved with SaveHARDBUFF.
(ˆChoose3OK)( → ) — The OK action executed by Choose3 if OK or ENTER is pressed.
(ˆChoose3CANCL)( → ) — The CANCEL action executed by Choose3 if CANCL or ON is pressed.

Using the HP48 Browser

40

Reference

˜Choose( ::Appl $Title ::Convert {} offset → {}' T ) — ( ::Appl $Title ::Convert {} offset → ob T ) ( ::Appl $Title ::Convert {} offset → F ) The return value is a list if checkfields are enabled, otherwis
˜ChooseMenu0( → {} ) — Menus with "OK".
˜ChooseMenu1( → {} ) — Menus with "CANCL", "OK".
˜ChooseMenu2( → {} ) — Menus with "CHK", "CANCL", "OK".
˜ChooseSimple( $title {items} → ob T ) — ( $title {items} → F ) Simple interface to the HP48 choose engine. On the HP49G, calls ˆRunChooseSimple.
ˆRunChooseSimple( $title {items} → ob T ) — ( $title {items} → F ) Simple interface to the HP48 choose en- gine.
ˆDoCKeyCheck( → ) — Toggle check on current item.
ˆDoCKeyChAll( → ) — Check all elements.
ˆDoCKeyUnChAll( → ) — Uncheck all items.
ˆDoCKeyCancel( → ) — Simulate Cancel.
ˆDoCKeyOK( → ) — Simulate OK.
ˆLEDispPrompt( → ) — Redraw title.
ˆLEDispList( → ) — Redraw browser lines.
ˆLEDispItem( # → ) — Redraw one line.
(˜BBMoveTo)( # → ) — Moves selection to line and updates dis- play.
(˜BBRecalOff&Disp)( flag → ) — Recalculates offset of selected item in page, and redraws lines if the flag is TRUE.
(˜BBRunEntryProc)( → ) — Sends message 85 to ::Appl, thus running the user-defined start-up procedure.
(˜BBReReadPageSize)( → ) — Re-reads the size of the page (message 57).
(˜BBReReadHeight)( → ) — Re-reads the height of the browser line (message 58).
(˜BBReReadCoords)( → ) — Re-reads the coordinates of the browser box (message 63).
(˜BBReReadWidth)( → ) — Re-reads the width of the browser line (message 59).
(˜BBRunENTERAction)( → ) — Sends message 96 to ::Appl, thus running the OK action. It does not check the value returned and never exits.
(˜BBRunCanclAction)( → ) — Sends message 91 to ::Appl, thus running the CANCEL action. It does not check the value returned and never exits.
(˜BBReDrawBackgr)( → ) — Redraws the background.
(˜BBGetNGrob)( #n → grob ) — Returns nth element as a grob. 48 Browser
(˜BBGetNStr)( #n → $ ) — Returns nth element as a string.
(˜BBRereadChkEnbl)( → ) — Re-reads whether checkmarks are en- abled. (Message 61).
(˜BBRereadFullScr)( → ) — Re-reads whether to use full-screen mode. (Message 60).
(˜BReReadMenus)( → ) — Re-reads the menu. (Message 83).
(˜BBReReadNElems)( → ) — Re-reads the number of elements. (Mes- sage 62).
(˜BBGetN)( #n → ob ) — Returns nth element.
(˜BBIsChecked?)( #n → flag ) — Returns whether the given element is checked.
(˜BBUpArrow)( → grob ) — Returns up arrow as grob
(˜BBDownArrow)( → grob ) — Returns down arrow as grob
(˜BBSpace)( → grob ) — Returns a space as grob.
(˜BBPgDown)( → ) — Go down one page.
(˜BBPgUp)( → ) — Go up one page.
(˜BBEmpty?)( → flag ) — Returns TRUE if the browser has no ele- ments.
(˜BBGetDefltHeight)( → # ) — Returns height of lines based on the font that will be used. This value is the default height of the browser. Equivalent to FPTR 2 64.
˜BRRclC1( → ) — :: LAM 'BR5 ;

Creating Input Forms

41

Inputform

˜IFMenuRow2( → {} ) — Returns the menu for the second menu row of an InputForm.
ˆIfSetFieldVisible( # T/F(fld/lbl) T/F(val) → ) — ( # T/F(fld/blb) #0 → T/F(val) ) Toggles the field or label visible or invisible. Second argument specifies if # means a field or a label. Third argum
ˆIfSetSelected( # T/F(fld/lbl) T/F(val) → ) — ( # T/F(fld/blb) #0 → T/F(val) ) Toggles the field or label selected or not selected (appears in inverse video on the screen).
ˆIfSetGrob( # T/F(fld/lbl) grb → ) — Sets the grob of a field or a label (mod- ifies the data saved in the data string).
ˆIfSetFieldValue( val # → ) — Sets the value of a field (full handling, including GROB setting).
ˆIfGetFieldValue( # → val ) — Gets the value of the Nth field.
ˆIfGetCurrentFieldValue( → ) — Gets the value of the current field.
ˆIfSetCurrentFieldValue( val → ) — Sets the value of the current field.
ˆIfGetFieldMessageHandler( # → prg ) — Retrieves a field message handler.
ˆIfGetFieldType( # → #type ) — Retrieves the field type.
ˆIfGetFieldObjectsType( # → {} ) — Retrieves the field object type list.
ˆIfGetFieldDecompObject( # → val ) — Retrieves the field decomp value.
ˆIfGetFieldChooseData( # → {} ) — Retrieves the field data for choose.
ˆIfGetFieldChooseDecomp( # → val ) — Retrieves the field decomp value in case of choose.
ˆIfGetFieldResetValue( # → val ) — Retrieves the field reset value.
ˆIfSetFieldResetValue( val # → ) — Changes the field reset value.
ˆIfGetFieldInternalValue( # → val ) — Retrieves the field internal value.
ˆIfDisplayFromData( → ) — Displays the datastring on the screen. Takes care of the command line size.
ˆIfGetNbFields( → #n ) — Recalls the number of fields from the data string.
ˆIfCheckSetValue( # val → ) — Checks or uncheck a check field.
ˆIfCheckFieldtype( ob → ob flag ) — Checks if an object meets the current field type requirements.
ˆIfGetPrlgFromTypes( {} → {}' ) — ( #FFFFF → #0 ) Generates a list of the allowed prologs for a field.
ˆIfReset( → ) — Resets all fields, set as the current value their reset value. Used to ex- plode the datalist on the stack to work on it.
ˆIfSetField( # → ) — Makes a different field "current".
ˆIfKeyChoose( → val ) — ( → ) If the current field is a choose field, dis- plays the posibilities and let the user choose. A value is returned only if the user does not press
ˆIfKeyEdit( → (cmd line) ) — Edits the current field value if possi- ble. You cannot edit a choose and a la- bel choose field.
ˆIfKeyTypes( → (cmd line) ) — ( → ) Displays a Choose box with all the pos- sible types for this field. A command line is opened only if the user replies with OK.
ˆIfKeyCalc( → val ) — Puts the value of the field on the stack and HALT. Allows to the user to com- pute a new value.
ˆIfKeyInvertCheck( → ) — Inverts the current check field value.
ˆIfONKeyPress( → ) — On Key handler. Gives the oportunity to the user to perform his own pro- gram. Asks to the IF if we can leave. If Yes, puts a FALSE (quit with ON (if
ˆIfEnterKeyPress( → ) — Enter Key management. Gives the oportunity to the user to perform his own program. Asks to the IF if we can leave. If yes, puts the fields values on t
ˆIfSetHelpString( $dat #n $/# → $dat' ) — Sets the help string associated with a field. This is used by the automatic IF generator program and should not be use in other ways.
ˆIfSetTitle( $dat grb/$/# → $dat' ) — Alters a DataString modifying the Ti- tle part. This is used by automatic IF generator program ans should not be use in other ways.
ˆIfInitDepth( → ) — Initializes the internal depth counter. This has to be used when running a command modifying the stack
ˆIfMain2( $dat handl {} → F ) — ( $dat handl {} → ob1...obn T ) Internal Inform Box main program. Alters a DataString modifying the Title part. This is used by automatic IF generator
ˆIfPutFieldsOnStack( → ob1...obn ) — Puts on the stack the external value of each field.
ˆIfSetFieldPos( # T/F(fld/lbl) #x #y #w #h → ) — Changes the size and position of an object Note: You can not change the size or the X position of a label or a check field.
ˆIfGetFieldPos( # T/F(fld/lbl) → #x #y #w #h ) — Gets the size and position of an object.
ˆIfSetAllLabelsMessages( $dat bmsg #n → $dat ) — Sets the text of a set of labels.
ˆIfSetAllHelpStrings( $dat bmsg #n → $dat ) — Sets the Help String of all fields.
ˆIsUncompressDataString( $dc → $dat ) — Uncompresses a compressed data string.

The Display

190

Display Organization

TOADISP( → ) — Sets the text display as the active.
TOGDISP( → ) — Sets the graphic display as the active.
ABUFF( → textgrob ) — Returns the text grob to the stack.
GBUFF( → graphgrob ) — Returns the graphic grob to the stack. The HP49 extable address for ExitAction! is the same, but this must be a bug.
HARDBUFF( → dispgrob ) — Returns the current grob to the stack.
HARDBUFF2( → menugrob ) — Returns the menu grob to the stack.
HARDHEIGHT( → #height ) — Returns the height of HARDBUFF.
GBUFFGROBDIM( → #height #width ) — Returns dimensions of graphic grob.

Preparing the Display

RECLAIMDISP( → ) — Activates the text grob, clears it and sets the de- fault size.
ClrDA1IsStat( → ) — Suspends clock display.
MENUOFF?( → flag ) — Returns TRUE if the menu grob is off.
TURNMENUOFF( → ) — Turns off menu display, enlarges ABUFF to fill screen.
TURNMENUON( → ) — Turns menu grob on.
MENUOFF( → )
GetHeader( → # ) — Gets header size in lines (0-2).
SetHeader( # → ) — Sets header size in lines (0-2).
HEIGHTENGROB( grob #rows → ) — Heightens graph or text grob.
KILLGDISP( → ) — Clears graph display by setting it to NULLGROB. See DOERASE.
DOERASE( → ) — Erases the graphics display grob without chang- ing its size.

Immediate Refresh

SysDisplay( → ) — Redisplays all required areas. Does it imme- diately, without waiting for the current com- mand to finish.
?DispCommandLine( → ) — Redisplays the command line now if necessary.
DispCommandLine( → ) — Redisplays the command line now.
DispEditLine( → ) — Just calls DispCommandLine.
?DispMenu( → ) — Redisplays the menu now if no key is waiting in the buffer. Even better is this: :: DA3OK?NOTIT ?DispMenu ;
DispMenu.1( → ) — Displays menu now.
DispMenu( → ) — :: DispMenu.1 SetDAsValid ;
?DispStack( → ) — Redisplays the stack now if necessary.
?DispStatus( → ) — Redisplays the status area now if necessary.
DispStatus( → ) — Displays the status area now.
DispStsBound( → ) — Displays a horizontal line at y=14, normally the separation between header and stack.
DispTimeReq?( → flag ) — Is time display required? Checks system flag 40 and something else.
DispILPrompt( → ) — Redisplays the InputLine prompt, i.e. re- freshes the region between the command line and the header during InputLine. Requires a string (the prompt)
nDISPSTACK( $prompt #height #header flag flag → ) — Used by DispILPrompt.

Controlling Display Refresh

ClrDA1OK( → )
ClrDA2aOK( → )
ClrDA2bOK( → )
ClrDA2OK( → )
ClrDA3OK( → )
ClrDAsOK( → )
DA1OK?( → flag )
DA3OK?( → flag )
DA2aLess1OK?( → flag )
DA1OK?NOTIT( → ) — Does DA1OK?, NOT then IT.
DA2aOK?NOTIT( → ) — DA2aOK?, NOT then IT.
DA2bOK?NOTIT( → ) — DA2bOK?, NOT then IT.
DA3OK?NOTIT( → ) — Does DA3OK?, NOT then IT.
SetDA1Temp( → )
SetDA2aTemp( → )
SetDA2bTemp( → )
ClrDA2bTemp( → )
SetDA2OKTemp( → )
SetDA3Temp( → )
SetDA12Temp( → )
SetDAsTemp( → )
SetDA2bTempF( → )
SetDA1Valid( → )
SetDA2aValid( → )
SetDA2bValid( → )
SetDA2Valid( → )
SetDA3Valid( → ) — . Name Description
SetDA3ValidF( → )
SetDA1Bad( → )
ClrDA1Bad( → )
DA1Bad?( → flag )
SetDA2aBad( → )
ClrDA2aBad( → )
DA2aBad?( → flag )
SetDA2bBad( → )
ClrDA2bBad( → )
DA2bBad?( → flag )
SetDA3Bad( → )
ClrDA3Bad( → )
DA3Bad?( → flag )
SetDA1NoCh( → )
SetDA2aNoCh( → )
SetDA2bNoCh( → )
ClrDA2bNoCh( → )
DA2bNoCh?( → flag )
SetDA2NoCh( → )
SetDA12NoCh( → )
SetDA3NoCh( → )
SetDA13NoCh( → )
SetDA23NoCh( → )
SetDA12a3NCh( → ) — aka: SetDA12a3NoCh
SetDA123NoCh( → )
SetDAsNoCh( → )
SetDA2aEcho( → )
SetDA1IsStat( → )
SetNoRollDA2( → )
ClrNoRollDA2( → )
DA1IsStatus?( → flag )
SetDA2bIsEdL( → )
DA2bIsEdL?( → flag )
ClrDA2bIsEdL( → )

Clearing the Display

BLANKIT( #startrow #rows → ) — Clears #rows from HARDBUFF, starting at #startrow.
CLEARVDISP( → ) — Clears HARDBUFF.
Clr8( → ) — Clears top eight rows (first status line).
Clr8-15( → ) — Clears 2nd status line.
Clr16( → ) — Clears top 16 rows.
BlankDA1( → ) — Clears status area from HARDBUFF.
BlankDA2a( → ) — Clears display area DA2a.
BlankDA2( → ) — Clears display areas DA2a and DA2b.
BlankDA12( → ) — Clears display areas DA1 and DA2
CLCD10( → ) — Clears status and stack areas.
CLEARLCD( → ) — Clears whole display.
DOCLLCD( → ) — Like user word CLLCD.

Annunciator and Modes Control

SetLeftAnn( → ) — Sets left-shift annunciator.
ClrLeftAnn( → ) — Clears left-shift annunciator.
SetRightAnn( → ) — Sets right-shift annunciator. . Name Description
ClrRightAnn( → ) — Clears right-shift annunciator.
SetAlphaAnn( → ) — Sets alpha annunciator.
ClrAlphaAnn( → ) — Clears alpha annunciator.
LockAlpha( → ) — Sets alpha mode, annunciators, etc.
UnLockAlpha( → ) — Clears alpha mode, annunciators, etc.
(ClrBusyAnn)( → ) — Clears the busy annunciator.
SetPrgmEntry( → ) — Sets program-entry mode.
PrgmEntry?( → flag ) — Is program-entry mode set?
Do1st/2nd+:( → :: <ob1> ; (PRG mode) ) — ( → :: <ob2> <rest> ; (no PRG mode) ) If in program mode, executes the next object after it. If not in program mode, executes the rest of the stream s
SetAlgEntry( → ) — Sets algebraic-entry mode.
ClrAlgEntry( → ) — Clears algebraic-entry mode.
AlgEntry?( → flag ) — Is algebraic-entry mode set?
ImmedEntry?( → flag ) — Returns TRUE if immediate-entry mode (pro- gram and algebraic-entry modes cleared).
?ClrAlg( → ) — Clears AlgEntry mode if set.
?ClrAlgSetPr( → ) — Clears AlgEntry mode if set and sets Progra- mEntry mode.

Window Coordinates

TOP8( → HBgrob #x1 #y #x1+131 #y1+8 ) — Returns coordinates of first status line.
Rows8-15( → HBgrob #x1 #y1+8 #x1+131 #y1+16 ) — Returns coordinates of second status line.
TOP16( → HBgrob #x1 #y1 #x1+131 #y1+16 ) — Returns coordinates of status area.
WINDOWCORNER( → #x #y ) — Gets coordinates of corner of window.
HBUFF_X_Y( → HBgrob #x #y ) — Returns current grob and window coordinates.
LEFTCOL( → #x ) — Gets x-coordinate of left column.
RIGHTCOL( → #x ) — Gets x-coordinate of right column.
TOPROW( → #y ) — Gets y-coordinate of top row.
BOTROW( → #y ) — Gets y-coordinate of bottom row.
WINDOWXY( #x #y → ) — Sets corner coordinates.

Scrolling the Display

WINDOWUP( → ) — Moves display one pixel up.
WINDOWDOWN( → ) — Moves display one pixel down.
WINDOWLEFT( → ) — Moves display one pixel left.
WINDOWRIGHT( → ) — Moves display one pixel right.
SCROLLUP( → ) — Moves display one pixel up, checks for corre- sponding key being pressed. . Name Description
SCROLLDOWN( → ) — Moves display one pixel down, checks for corre- sponding key being pressed.
SCROLLLEFT( → ) — Moves display one pixel left, checks for corre- sponding key being pressed.
SCROLLRIGHT( → ) — Moves display one pixel right, checks for corre- sponding key being pressed.
JUMPTOP( → ) — Jumps to top of display.
JUMPBOT( → ) — Jumps to bottom of display.
JUMPLEFT( → ) — Jumps to left of display.
JUMPRIGHT( → ) — Jumps to right of display.
WINDOWTOP?( → flag ) — Is window at the top?
WINDOWBOT?( → flag ) — Is window at the bottom?
WINDOWLEFT?( → flag ) — Is window at the left?
WINDOWRIGHT?( → flag ) — Is window at the right?

Displaying Objects

ViewObject( ob → )
ViewStrObject( flag $ → F ) — Flag decides if it should be possible to toggle TEXT/GRAPH.
ViewGrobObject( flag grob → F ) — Flag decides if it should be possible to toggle TEXT/GRAPH.
sstDISP( ob → ) — Displays ob in status line. Used for single stepping during debugging.
ˆSCROLLext( grob → ) — Launches PICT environment.
WINDOW#( #x #y → ) — Internal PVIEW, displays PICT starting at the given coordinates.

Displaying Text

DODISP( ob %row → ) — Displays any object in specified row.
DISPROW1( $ → ) — aka: DISP@01, BIGDISPROW1
DISPROW1*( $ → ) — Displays relative to window corner.
DISPROW2( $ → ) — aka: DISP@09, BIGDISPROW2
DISPROW2*( $ → ) — Displays relative to window corner.
DISPROW3( $ → ) — aka: DISP@17, BIGDISPROW3
DISPROW4( $ → ) — aka: DISP@25, BIGDISPROW4
DISPROW5( $ → )
DISPROW6( $ → )
DISPROW7( $ → )
DISPROW8( $ → ) — May not be possible depending on the size of the font and whether the menu is on or off.
DISPROW9( $ → ) — May not be possible depending on the size of the font and whether the menu is on or off.
DISPROW10( $ → ) — May not be possible depending on the size of the font and whether the menu is on or off. . Name Description
DISPN( $ #row → ) — aka: BIGDISPN
Disp5x7( $ #start #max → ) — Displays string on multiple lines, starting at #start and no using more than #max rows. New lines must be manually specified. Seg- ments longer than 2
DISPSTATUS2( $ → ) — Displays message in status area using two lines.
(DISPST2&FREEZE)( $ → ) — DISPSTATUS2 and freeze status area.
DispCoord1( $ → ) — Displays $ in menu grob using minifont.
DISPCOORD2( $ → ) — Displays $ in menu grob using minifont and waits for a key. Then refreshes menu display.
DISPLASTROW( $ → ) — Displays $ in the last stack display row, just above the menu.
DISPLASTROWBUT1( $ → ) — Displays $ in the last stack display row. If menu is turned on it can cover displayed text.
FlashMsg( $ → ) — Displays message in status area, then re- stores it to normal.
FlashWarning( $ → ) — Displays message in a message box and beeps. Waits for OK to be pressed.
AskQuestion( $ → flag ) — Use the string to aks the user a question with yes/no in a choose box.
ˆDoAlert( $ → ) — Displays alert messagebox.
DoWarning( $ → ) — Displays message, beeps and freezes status area.
ˆCk&DoMsgBox( $ #x #y grob menu → T ) — Displays a message box with a grob in the up- per left corner and the specified menu. The meaning of #x and #y is unclear.
˜MsgBoxMenu( → {} ) — The messsage box menu, with just the OK key.

Fonts

FONT>( → font ) — Recalls system font.
MINIFONT>( → minifont ) — Recalls the current minifont.
>FONT( font → ) — Sets system font.
>MINIFONT( minifont → ) — Sets the current minifont.
StackLineHeight( → # ) — Returns height of text grob minus size of header and menu.
GetFontStkHeight( → # ) — Returns stack font height (used for display stack rows). aka: StackFontHeight

The Menu

56

Menu Properties

GETDF( #menukey → ob ) — Gets the definition of a menu key from THOUCHTAB. #menukey = #1..#6
GETPROC( #menukey → ob ) — Gets the definition of a menu key from THOUCHTAB. #menukey = #1..#6. With #7, get the executor.
SetRebuild( → ) — Sets the flag that the menu needs to be rebuild.
MenuRow!( #n → ) — Sets the menu row. #n is not the row, but the index of the first menu key in that row, i.e. 1,7,13,. . .
MenuRow@( → #n ) — Recalls the index of the first menu key in the current menu page. Returns 1 for the first page, 7 for the second page, 13 for the third and so on.
LastMenuRow!( #n → ) — Sets the row of the last menu. #n is not the row, but the index of the first menu key in that row, i.e. 1,7,13,. . .
LastMenuRow@( → #n ) — Recalls the index to the first menu key in the current row of the last menu. Returns 1 for the first page, 7 for the second page, 13 for the third and
MenuDef@( → menu ) — Recalls the current menu definition. menu is a MenuList or a program, or a Rompointer.
LastMenuDef!( menu → ) — Sets the definition of the last menu. menu is a MenuList or a program, or a Rompointer.
LastMenuDef@( → menu ) — Recalls the definition of the last menu. menu is a MenuList or a program, or a Rompointer.
SaveLastMenu( → ) — Stores row and definition of current menu as the last menu.
GetMenu%( → % )
MenuRowAct!( ob → ) — Stores ob as the RowAct menu property.
InitTrack:( → ) — Execute the program which is next in the run- stream if the directory changes. Used by the VAR menu to set first menurow when diretory changes, or by
LabelDef!( ob → ) — Store a program which displays a menu label. Prg has the stack diagram ( #col ob → ) For example, the LIBS command uses the fol- lowing program to mak
MenuKeyLS!( ob → ob ) — Set the action for left-shifted menu keys. The program receives the action part of the menu item as an argument, i.e. {ob-NS ob-LS ob-RS}.
MenuKeyRS!( ob → ob ) — Set the action for right-shifted menu keys. The program receives the action part of the menu item as an argument, i.e. {ob-NS ob-LS ob-RS}.
MenuKeyNS!( og → ob ) — Set the action for unshifted menu keys. The pro- gram receives the action part of the menu item as an argument, i.e. ob-NS or {ob-NS ob-LS ob-RS}.
MenuKeyNS@( → ob ) — Recall the action for unshifted menu keys.
SetKeysNS( ob → ) — Sets ob as MenuKeysNS, DoBadKey to LS & RS.
StdMenuKeyLS( {ob-NS ob-LS ob-RS} → ? ) — The content of MenuKeyLS for standard menus.
StdMenuKeyNS( ob-NS → ? ) — ( {ob-NS ob-LS ob-RS} → ? ) The content of MenuKeyNS for standard menus.
NullMenuKey( → ) — A placeholder for an empty menu key when defining menu lists.
ReviewKey!( ob → ) — Store a program which is called with the review key (RS DOWN). The program has the stack di- agram ( → )
(ExitAction!)( ob → ) — Store ob as exit action.
NoExitAction( → ) — Sets NOP as ExitAction. Mostly used to avoid that the menu is saved as the previous menu when a new Menu gets installed.

Building Menus

TakeOver( → ) — Override the default menu key executer. If this is the first entry in a program, the program can be used in edit mode. When the first in a pro- gram i
Modifier( → ) — :: TakeOver ;
MenuMaker( → ob ) — Quotes next object, and also provides TakeOver. The disassembly is :: TakeOver 'R ; Normally this is used like this: :: MenuMaker menu InitMenu ;
InitMenu( menu → ) — menu is {} or :: settings {} ; Settings override the default settings installed by InitMenu.
DoMenuKey( menu → ) — :: SetDA12NoCh InitMenu ; . Name Description
InitMenu%( %mnu.pg → ) — ( %0 → )
StartMenu( menu #n → ) — #n is the index of the first menu key on the page, use 1 for the first page, 7 for the second etc. StartMenu does ExitAction (Previous menu!), sets th
SetThisRow( → ) — Builds a new TOUCHTAB, SetBadMenu.
LoadTouchTbl( MenuKey1 .. MenuKeyN #n → ) — Builds new TOUCHTAB from menukeys.

Menu Display

SysMenuCheck( → ) — Checks menu validity. If DA3NoCh? then noth- ing. If Track? then ?DoTrackAct@. If Rebuild? then SetThisRow.
?DispMenu( → ) — Redisplay the menu now if no key is waiting in the buffer. Even better is this: :: DA3OK?NOTIT ?DispMenu ;
DispMenu.1( → ) — Displays the menu immediately.
DispMenu( → ) — :: DispMenu.1 SetDAsValid ;

Displaying Menu Labels

Grob>Menu( #col grob → ) — Displays grob as menu label.
Str>Menu( #col $ → ) — Displays string as menu label.
Id>Menu( #col id → ) — Displays id as menu label.
Seco>Menu( #col :: → ) — Does EVAL then DoLabel.
DoLabel( #col ob → ) — If ob is of one of the supported types, displays a menu label. If not, generates a "Bad Argument Type" error.
MakeLabel( $ #w #x grob → grob' ) — Inserts $ into grob using CENTER$3x5 with y=5.
ˆWRITEMENU( $6...$1 → ) — Displays the six strings as menu keys.

General Entries

CheckMenuRow( # → # #' )
SetSomeRow( #n → ) — with Mod(n,FFFFFh)= 0.
DoMenuKeyNS( #n → )
MenuKey( → ) — Takes NOB from Runstream.
CLEARMENU( → )
CHECKMENU( → )
(CST)( → ob ) — Evaluates ID CST.
nCustomMenu( → ) — Installs the CST menu.
SolvMenuInit( → ) — Sets MenuKeyNS/LS/RS, ReviewKey and La- belDef properties needed by the Solver menu. . Name Description
DoFirstRow( → ) — Sets the first row of the current menu.

Programming the HP49 Editor

119

Status

EditLExists?( → flag ) — Does an EditLine exist?
NoEditLine?( → flag ) — Does no EditLine exist?
RCL_CMD( → $ ) — Returns a copy of the current command line to the stack. Same as EDITLINE$.
EDITLINE$( → $ ) — Returns a copy of the current command line to the stack. Same as RCL_CMD.
RCL_CMD2( → $ ) — Similar to RCL_CMD, but if there is not enough memory to copy the EditLine to the stack, it will move the current EditLine into TEMPOB. Of course, thi
RCL_CMD_POS( → # ) — Recalls the current cursor position.
CURSOR@( → # ) — Recalls the current cursor position.
(CURSOR_PART)( → # ) — Recalls the current cursor row (line).
(THISCHAR)( → chr ) — Returns the character under the cursor. At the end of the file, returns CHR_00.
CURSOR_END?( → flag ) — Checks if the cursor is at the end of a line or at the end of the file. Works by checking the cur- rent character against newline and CHR_00.
FIRSTC@( → # ) — Column of the left display window edge.
CURSOR_OFF( → # ) — Cursor column relative to left edge of display window.
CAL_CURS_POS( #l #c → # ) — Computes a position in the current EditLine from line and column number. The result can be used by STO_CURS_POS to move the cur- sor to that location.
CAL_CURS_POS_VIS( #l #c → # ) — Similar to CAL_CURS_POS, but will ignore in- visible characters. The result can be used by STO_CURS_POS_VIS to move the cursor to that location.
RCL_CMD_MODE( → $ ) — Recalls a string with current editor settings. Can be used together with STO_CMD_MODE to save and restore the state of the EditLine, when temporarily
STO_CMD_MODE( $ → ) — Stores a mode string similar to the one ob- tained by RCL_CMD_MODE.

Inserting Text

CMD_PLUS( $ → ) — Inserts string at current cursor position in Edit- Line.
CMD_PLUS2( $ → ) — Replaces entire current EditLine with new string. When there is not enough memory to copy the string on stack level 1, moves the string out of TEMPOB.
CMD_PLUS3( $ → ) — Same as CMD_PLUS2, but the cursor position is not changed. Useful when restoring a command line context after HALT.
InsertEcho( $ → ) — Inserts string at current cursor position in Edit- Line.
Echo$Key( $/chr → ) — Same as CMD_PLUS.
Echo$NoChr00( $ → ) — Inserts string at current cursor position in Edit- Line.
DoDelim( → ) — Takes a character or string from the runstream and inserts it.
DoDelims( → ) — Takes a character or a string from the run- stream, inserts it and moves the cursor back by one character.
INSERT_MODE( → ) — Turns insert mode on. In insert mode, new char- acters do not overwrite old ones.
(TogInsert)( → ) — Toggles the insert/overwrite flag.
INSERT?( → flag ) — Returns TRUE if insert mode is active.

Deleting Text

CMD_DEL( → ) — Deletes next char in Editor. Same as LS+DEL. If you hold down BS while this entry is executed, the HP49G will think you have pressed the key and want
CMD_DROP( → ) — Backspace in Editor. Deletes char before cursor. Same as BS key. If you hold down BS while this entry is executed, the HP49G will think you have press
DEL_CMD( → ) — Clears the entire EditLine.
InitEdLine( → ) — :: DEL_CMD ;
DO<Del( → ) — Deletes left to beginning of word. Same as the ←DEL button in the editor TOOL menu.
DO>Del( → ) — Deletes right to beginning of next word, Same as the DEL→ button in the editor TOOL menu.
DODEL.L( → ) — Deletes all chars in the current line. If the line is already empty, delete the NEWLINE. Same as the DEL.L button in the editor TOOL menu.
DoFarBS( → ) — Deletes to beginning of line. Same as the RS+←DEL in the editor TOOL menu.
DoFarDel( → ) — Deletes to end of line. Same as RS+Del→ in the editor TOOL menu. 49 Editor

Moving the Cursor

STO_CURS_POS( # → ) — Stores cursor position. Moves cursor to spec- ified position and if necessary repositions the editor window to make sure the cursor position is visibl
STO_CURS_POS2( # → ) — Same as STO_CURS_POS, but moves the right edge of the editor window to the cursor column.
STO_CURS_POS3( # → ) — Same as STO_CURS_POS, but without check- ing for style/font switch sequences. So while STO_CURS_POS always makes sure the cursor ends up right before
STO_CURS_POS4( # → ) — Behaves with respect to editor window posi- tioning like STO_CURS_POS2, but with respect to invisible chars like STO_CURS_POS3.
STO_CURS_POS_VIS( # → ) — Like STO_CURS_POS, but ignores the invisible characters. So if you look at your string and say, I want to go to what I see as the 5th char- acter, use
SetCursor( # → ) — ( {# #'} → ) Sets the cursor to the given position. For the list argument, the numbers are row and col- umn.
CMD_NXT( → ) — Moves cursor to next char, like Right Arrow.
CMD_BAK( → ) — Moves cursor to the left. Same as as Left Ar- row.
CMD_DOWN( → ) — Moves cursor to the next line. Same as Down Arrow.
CMD_UP( → ) — Moves cursor to the previous line, like Up Ar- row.
CMD_DEB_LINE( → ) — Moves cursor to the beginning of line. Same as RS+LEFT.
CMD_END_LINE( → ) — Moves cursor to the end of line. Same as RS+RIGHT.
CMD_PAGED( → ) — Moves cursor one page down, like LS+DOWN.
CMD_PAGEL( → ) — Moves cursor one page left, like LS+LEFT.
CMD_PAGER( → ) — Moves cursor one page right, like LS+RIGHT.
CMD_PAGEU( → ) — Moves cursor one page up, like LS+UP.
DO<Skip( → ) — Skips left to beginning of word. Same as the ←SKIP button in the editor TOOL menu.
DO>Skip( → ) — Skips right to the beginning of the next word. Same as the SKIP→ button in the editor TOOL menu.
DO>BEG( → ) — Goes to begin of selection (if active) or to be- ginning of EditLine. Same as →BEG button in the editor TOOL menu. 49 Editor
DO>END( → ) — Goes to end of selection. Same as the →END button in the editor TOOL menu. When there is no selection, does not move.
GOTOLABEL( → ) — Brings up the CHOOSE-box with labels in the EditLine. Same as the LABEL button in the editor TOOL/GOTO menu.

Selection, Cut and Paste, the Clipboard

CMD_STO_DEBUT( # → ) — Sets begin marker, like RS+BEGIN, but takes position from stack.
CMD_STO_FIN( # → ) — Sets end marker, like RS+END, but takes posi- tion from stack.
RCL_CMD_DEB( → # ) — ( → #0 ) Recalls the position of the BEGIN marker. If the selection has been cleared, returns ZERO.
RCL_CMD_FIN( → # ) — ( → #0 ) Recalls the position of the END marker. If the selection has been cleared, returns ZERO.
ClearSelection( → ) — Unselects the selected text without changing the contents of the editor. Sets both begin and end marker to ZERO.
VERIF_SELECTION( → flag ) — Returns TRUE when the END marker is not ZERO, indicating that the selection is active. Use this command as a check before doing any- thing with the se
CMD_COPY( → ) — Copies selected string, like RS+COPY.
CMD_CUT( → ) — Cuts string. Really is "delete", does not copy to kill buffer. So a "normal" CUT would be :: CMD_COPY CMD_CUT ;
CMD_COPY.SBR( → $ ) — Puts the selection as a string on the stack. This command is font/style aware. It is rec- ommended not to use it because it may get the wrong text sty
PASTE.EXT( $ → ) — Pastes from stack with treatment of fonts and styles. Inserts the string on stack level at the cursor position. It can insert normal text right in the
SELECT.LINE( → ) — Selects current line, position cursor at begin- ning of line. Selection does not include the NEWLINE char at the end of the line.
SELECT.LINEEND( → ) — Selects current line, position cursor at end of line. Selection does not include the NEWLINE char at the end of the line.
(Clipboard!)( $ → ) — Stores string to Clipboard.
(Clipboard@)( → $ ) — Recalls Clipboard contents to stack.
(Clipboard0)( → ) — Clears the Clipboard.
(Clipboard?)( → flag ) — Is there anything on the Clipboard? 49 Editor

Search and Replace

GET.W->( → # ) — Returns the position of the next word-start to the right of the current cursor position. Note the asymmetry of this command and GET.W<-.
GET.W<-( # → #' ) — Takes a position from the stack and return the position if the nearest word-start to the left of that position. Note the asymmetry of this command and
FindStrInCmd( $find → $find $start $end T ) — ( $find → $find F ) Finds a string in the EditLine, starting from the current cursor position. The search string remains on the stack, presumably in o
DOFIND( → ) — Same as the FIND menu button in the editor TOOL/SEARCH menu. Pops up the FIND input form.
DONEXT( → ) — Finds next. Same as the NEXT button in the editor TOOL/SEARCH menu.
DOREPL( → ) — Same as the REP button in the editor TOOL/SEARCH menu. Pops up the RE- PLACE input form.
DOREPLACE( → ) — Replaces current match. Same as the R but- ton in the editor TOOL/SEARCH menu.
DOREPLACE/NEXT( → ) — Replaces current match and move to next match. Same as the R/N button in the edi- tor TOOL/SEARCH menu.
REPLACEALL( → ) — Replaces all matches in buffer. Same as the ALL button in the editor TOOL/SEARCH menu.
REPLACEALLNOSCREEN( → ) — Like REPLACEALL, but does not update the screen. Much faster this way.

Evaluation

EditSelect( → ) — Edits the current selection. Opens the editor with the selection only. You can then edit the selection. After pressing ENTER the edited text is insert
EVAL.LINE( → ) — Evaluates the current line and replace it with the result of the evaluation. Similar to EVAL.SELECTION, but without the need to se- lect the line firs
EVAL.SELECTION( → ) — Evaluates the current selection and replace it with the result of the evaluation. Same as the EXEC button in the editor TOOL menu. 49 Editor
EXEC_CMD( cmd algflag → obsel ) — Runs a command on the selection in the Edit- line. Takes two arguments: the command to run and a flag which says how to compile the selection before t
(RunInNewContext)( ob → ) — Saves current user interface, evaluate ob and restore the user interface. Can be used to run applications from inside another application.

Starting the Editor

EditString( $ → ) — Starts editing the string when the current program exits. This is the entry to use if a program should exit with the editor acti- vated. Use InitEdLin
ViewLevel1( ob → ob' ) — Edits the object in level 1
AlgObEdit( ob → ob' ) — Used instead of ViewLevel1 if in Algebraic mode. Does not execute STARTED and EX- ITED.
(CallEditCmd:)( ob → ob' ) — Evaluates the next object in the runstream, which usually in an editing command like ObEdit. When the evaluation returns FALSE, the original object wh
EditLevel1( ob → ob' )
ObEdit( ob → ob' T ) — ( ob → F ) Edits object. When the user cancels, only FALSE is returned. Otherwise the changed object along with TRUE is returned.
ˆEQW3Edit( symb → symb' T ) — ( symb → F ) Opens the equation editor to edit the expres- sion. If exited by ENTER, returns new ex- pression and TRUE. If exited by CANCEL, re- turns

Miscellaneous

EditMenu( → {} ) — Returns the Editor menu.
?Space/Go>( → ) — Inserts a SPACE character unless there is al- ready one before the cursor position. Use this if you want to make sure the next stuff echoed is separat
AddLeadingSpace( $ → $' ) — Adds a leading space to the string on level1 if it does not start with a space and if the cursor in the editor is after a non-white character. So :: "
AddTrailingSpace( $ → $' ) — Adds a trailing space to the string on level1 unless the string already ends with a space.
CommandLineHeight( → #pix ) — Returns the number pixel rows occupied by visible part of the EditLine.
DOTEXTINFO( → ) — Displays the info screen about the Editline. Same as the INFO button in the editor TOOL menu.
GET_CUR_FONT.EXT( → # ) — Returns the ID (as a system binary) of the font used for the character under the cursor.
NO_AFFCMD( → ) — Tells the next CMD_PLUS call not to update the display. For speed, if you want to do more insertion before the user needs to see it.
DispCommandLine( → ) — Redisplays the command line.
?DispCommandLine( → ) — Redisplays the command line if necessary.
PUT_STYLE( # → ) — Changes the style at point. If the selection is active, changes the style of the text in the selection. Otherwise changes the style of text typed subs
PUT_FONTE( # → ) — Changes the font at point. Works similar to the PUT_STYLE command.
SELECT.FONT( → ) — Pops up the CHOOSE box to select a font. Same as the FONT button in the editor TOOL/STYLE menu.
ViewEditGrob( → ) — at cursor Views the grob currently edited in the Edit- line near the cursor. If the EditLine contains GROB 10 10 FFFFFF... move the cursor to the "1"
XLINE_SIZE?( ob → flag ) — Checks if the cursor is outside the current line. In the HP49G editor, you can move the cursor further to the right than the line length, without actu
<DelKey( → {} ) — Returns the ←DEL menu key.
>DelKey( → {} ) — Returns the DEL→ menu key.
<SkipKey( → {} ) — Returns the ←SKIP menu key.
>SkipKey( → {} ) — Returns the SKIP→ menu key.
InitEd&Modes( → ) — :: InitEdLine InitEdModes ;
InitEdLine( → ) — :: DEL_CMD ;
InitEdModes( → )
SaveLastEdit( $ → ) — Calls CMD_STO if history is on.
CMDSTO( $ → ) — Adds string to the list of the last 4 commands, accessible with the CMD key.

Plotting

35

Reference

CHECKPICT( → ) — Checks size of GBUFF. If it is smaller than 131x64 sets GBUFF back to its default size (131x64).
CKPICT( xPICT → ) — Checks for user word xPICT on level 1. Errors (SETTYPEERR) if there is another object.
PICTRCL( xPICT → grob ) — Does CKPICT, then recalls GBUFF and does TOTEMPOB.
MAKEPVARS( → {} ) — Creates the default PPAR variable in the cur- rent directory and returns its value.
CHECKPVARS( → {} ) — Recalls contents of PPAR in current path to stack. Creates PPAR in current directory if non-existent. Errors "Invalid PPAR" if existing PPAR is invali
GETPARAM( # → ob ) — Extracts the #th item from PPAR. No error checking!
GETXMIN( → % ) — Recalls XMIN from the PPAR list if existent. If not, the default PPAR is created in the current directory.
PUTXMIN( % → ) — Sets a new value for XMIN. PPAR is created if necessary.
GETXMAX( → % ) — Recalls XMAX from the PPAR list if existent. If not, the default PPAR is created in the current directory.
PUTXMAX( % → ) — Sets a new value for XMAX. PPAR is created if necessary.
GETYMIN( → % ) — Recalls YMIN from the PPAR list if existent. If not, the default PPAR is created in the current directory.
PUTYMIN( % → ) — Sets a new value for YMIN. PPAR is created if necessary.
GETYMAX( → % ) — Recalls YMAX from the PPAR list if existent. If not, the default PPAR is created in the current directory.
PUTYMAX( % → ) — Sets a new value for YMAX. PPAR is created if necessary.
GETPMIN&MAX( → C% C% ) — Returns PMIN and PMAX.
PUTINDEP( ID → ) — Internal xINDEP if the arg is an ID.
PUTINDEPLIST( {} → ) — Internal xINDEP if the arg is a list.
INDEPVAR( → id ) — Recalls the independent variable. If a list, ex- tract first element. :: GETINDEP DUPTYPELIST? ?CARCOMP ;
GETINDEP( → id ) — ( → {} ) Recalls the independent variable field in PPAR.
GETPTYPE( → name ) — Recalls the plot type using GETPARAM.
PUTPTYPE( name → ) — Sets a new plot type. PPAR is created if neces- sary.
GETRES( → % ) — Recalls the plot resolution using GETPARAM.
PUTRES( % → ) — Set new plot resolution. PPAR is created if nec- essary.
GETSCALE( → % %' ) — Recalls the plot scale parameters. . Name Description
PUTSCALE( % %' → ) — Set new plot scale. PPAR is created if necessary.
AUTOSCALE( → ) — Internal AUTO.
DOGRAPHIC( → ) — Sets the scroll mode of PICTURE and is essen- tially the same as { } PVIEW.
EQUATION( → ob ) — Recall the current equation, stored in the 'EQ' variable.
GetEqN( #n → ob T ) — ( #n → NULL$ F ) Get the #nth equation, if EQ is a list of equations.
DORCLE( → ob ) — Recalls the contents of the EQ variable, errors if it does not exist.
DOSTOE( ob → ) — Stores ob into the variable EQ.
XEQPURGEPICT( xPICT → ) — If object in level one is xPICT, erases the graphic display. Otherwise, errors.
GDISPCENTER( → ) — Moves to center of graphics display
DOPX>C( { hxs hxs' } → C% ) — Converts a list of two hex strings into a complex number. Used for plotting coordinates. Inverse operation is DOC>PX.
DOC>PX( C% → { hxs hxs' } ) — Converts a complex coordinate point into list of two HXS numbers. Inverse operation is DOPX>C. Part IV The HP49 CAS

Type Checking and Conversion

16

Reference

ˆSYMBINCOMP( symb → ob1 .. obN #n ) — ( ob → ob #1 ) ( {} → {} #1 ) Explodes symbolic object into meta. Other ob- jects are converted into one-object metas by pushing #1 into the stack.
ˆ2SYMBINCOMP( ob1 ob2 → meta1 meta2 ) — Does ˆSYMBINCOMP for 2 objects.
ˆVXXLext( ob Lvar → Q ) — Converts object to internal form. The object can be a symbolic, a symbolic vector or a sym- bolic matrix. If the conversion was not suc- cessfull, vxx
ˆR2SYM( lvar ob → ob ) — Back conversion of a scalar object.
ˆMETALISTVXXL( Meta → Meta ) — Conversion of all elements of a meta object with respect to the variables in LAM1.
ˆVXXLFext( n/d → Z1/Z2 ) — Conversion of a fraction which does not de- pend on any variables. . Name Description
ˆVXXL1ext( n → Z ) — Conversion of an object which does not de- pend on any variables.
ˆVXXL0( ob → Q ) — Conversion of object with respect to Lvar in LAM1.
ˆVXXL2NR( Meta → Q ) — Converts symbolic meta to internal form (LAM1=Lvar). Set nocareflag to avoid square root problems.
ˆVXXL2( Meta → Q ) — Converts symbolic meta to internal form (LAM1=Lvar).
ˆTYPEIRRQ?( ob → flag ) — Is ob an irrquad?
ˆDTYPEIRRQ?( ob → ob flag ) — DUP, then ˆTYPEIRRQ?.
ˆCKMATRIXELEM( ob → ob ) — Checks that ob is a valid internal matrix ele- ment. Look for CK[]NCK for user matrix ele- ment.
ˆCKFPOLYext( ob → ob ) — Errors if list contains secondaries or empty lists.
ˆCK2FPOLY( ob ob → ob ob ) — Does CKFPOLYext on two objects.
ˆCLEANIDLAM( ob → ob ) — Suppresses SYMB if not needed.

Integers

85

Built-in Integers

ˆDROPZ0( ob → z0 )
ˆDROPZ1( ob → z1 )
ˆ2DROPZ0( 2 1 → z0 )
ˆNDROPZ0( obn...ob1 #n → z0 ) — Replaces meta with Z0.
ˆNDROPZ1( obn...ob1 #n → z1 ) — Replaces meta with Z1.

Conversion Functions

ˆ#>Z( # → Z ) — Converts bint to zint.
ˆR>Z( % → z ) — Converts real to zint. Do not call this entry if the number if not an integer. . Name Description
ˆR2Zext( % → %%/Z ) — Converts real to zint, or to long real if the number is not an integer. mode if number is not an integer.
ˆH>Z( HXS → Z / Error ) — Checks if HXS is a proper zint number and trims it.
ˆS>Z( $ → z ) — Converts decimal in a string into a zint.
ˆS>Z?( $ → z T ) — ( $ → $ F ) If possible, converts string into a zint and re- turns TRUE. If not, keeps the original string and returns FALSE.
ˆCK1Z( $/#/hxs → Z ) — Checks for an integer. Converts strings, bints or hxs's to zints. Errors for other object types.
ˆCK2Z( ob ob' → Z Z' ) — Like ˆCK1Z, but for two objects.
ˆCK3Z( ob ob' ob'' → Z Z' Z'' ) — Like ˆCK1Z, but for three objects.
ˆCK&CONVINT( symb → zint ) — ( symb → :: zint zint' ; ) Check that a sym is a zint or Gauss integer, convert it.
ˆCK&CONV2INT( symb symb' → zint zint' ) — ( symb symb' → :: zint1 zint2 ; :: zint3 zint4 ; ) Check that 2 sym are zint or Gauss integer, convert them.
ˆCONVBACKINT( zint|c → symb )
ˆCONVBACK2INT( zint|c zint|c → symb symb )
ˆZ>ZH( Z → Z' ) — Converts decimal Z to hex Z.
ˆZ2Sext( Z → '$Z' ) — Converts Z to string number. The number is embedded in a symbolic to enable using it in algebraics.

General Integer Operations

ˆZTrim( Z → Z' ) — Strips Z from unnecessary leading nibbles. Counts nibbles required for representation. If that equals used nibbles then quick exit. Else allocates new
ˆZAbs( Z → |Z| ) — Takes the absolute value of Z. If Z is already pos- itive then does nothing. Else duplicate object and change sign.
ˆZABS( Z → Z' ) — Absolute value.
ˆZSQRT( Z → Z' flag ) — Calculates integer part of square root. If the num- ber was a square, then flag is TRUE to indicate that the returned result is exact.
ˆMod( Z Zn → Z' ) — Make Z modulo N.
ˆZMod( Z1 Z2 → Z' )
ˆZNMax( Z1 Z2 → NormMax[Z1,Z2] ) — Returns the integer with the greatest absolute value. (Returns Z1 if |Z1|≥|Z2|; returns Z2 if |Z1|<|Z2|).
ˆZNMin( Z1 Z2 → NormMin[Z1,Z2] ) — Returns the integer with the smallest absolute value. (Returns Z1 if |Z1|≤|Z2|; returns Z2 if |Z1|>|Z2|).
ˆZBits( Z → Z #bits ) — Calculates number of bits used in Z.
ˆZBit?( Z #bit → Z flag ) — Tests if a bit in Z is set. Count starts from zero, as opposed to ZBits.
ˆZGCDext( Z2 Z1 → Z ) — Integer GCD.
ˆZGcd( Z2 Z1 → Z ) — This is the same entry as ZGCDext. . Name Description
ˆIEGCDext( a b → d u v ) — Bezout for integers. d=au+bv=gcd(a,b).
ˆINEGCD( a b → d u v )
ˆ#FACT( # → Z ) — Calculates the factorial of an integer. Works fine for all numbers #0 - #FFFFF, although at some point you will get an out of memory error.
ˆfactzint( z → z! ) — Factorial for long integers.
ˆPA2B2( z/% → a+bi ) — Internal PA2B2.

Integer Factorization and Prime Numbers

ˆZFactor( Zs → Lf ) — Factors signed long integer.
ˆNFactor( z → {} ) — Factors positive long integer.
ˆNFactorSpc( z → {} ) — Semi-factors positive long integer. This is regular factorization with an extra 'hopeless?' test.
ˆSFactor( S → Lf ) — Factors short integer. Pollard Rho, with the assumption that trial division has been done already. Thus any factor less than 4012009 is known to be a
ˆSPollard( S → S1 S2 ) — Factors short integer into 2 parts using Pol- lard Rho algorithm. Trial division and pri- mality tests should be done prior to calling this subroutine
ˆBFactor( N → Lf ) — Factors long integer. Brent-Pollard, with the assumption that trial division has been done already. When a small factor is found SFactor is called to
ˆBrentPow( Za Z1 Z2 Zn #k → Z ) — Modular * + ˆ mod for Brent-Pollard factoriza- tion. Output is Z1*Z2+Za mod Zn repeated k times Note that k=0 and k=1 give the same result. Also Z16=Z
ˆZPrime?( Z → flag ) — Primality test for a positive integer. Accord- ing to Pinch commercial software packages use only about 5-10 bases by default, maxi- mum around 25. Th
ˆZIsPrime?( Z → flag ) — Probabilistic primality test for a positive in- teger. . Name Description
ˆSIsPrime?( S → flag ) — Tests if positive short Z is prime. M-R test fails for integers ≤ 3, so we just test them separately at the start. For convenience lets define 0 and 1
ˆBIsPrime?( S → flag ) — Test if positive long Z is prime.
ˆBRabin( Z #base → Z flag ) — Performs Miller-Rabin test for long positive integer. Returns TRUE if base witnesses com- posite. Else returns FALSE.
ˆZTrialDiv2( Z → Z' #n ) — Remove factors of 2 from integer. #n is the power of two extracted from the number. The sign is also handled correctly, even though it is never requir
ˆZTrialPrime?( Z → flag ) — Trial division primality test for a positive in- teger. works for Z ≥ 3 (return false for Z=2).
ˆZTrialDiv( Z → Mf Z' ) — Trial division of a positive integer. If Z' is one then full factorization was achieved. The long trial division is not too slow, since division by sh
ˆPrime+( Z → Z' ) — Returns next prime ( Z' > Z ).
ˆPrime-( Z → Z' ) — Returns previous prime ( Z' < Z ).

Gaussian Integers

ˆTYPEGAUSSINT?( ob → flag ) — Checks if ob is Gaussian integer.
ˆDTYPEGAUSSINT?( ob → ob flag ) — Checks if ob is Gaussian integer.
ˆDUPTYPEGAUSSINT?( ob → ob flag ) — Checks if ob is Gaussian integer.
ˆCK1Cext( ob → flag ) — Checks if object is integer or Gaussian inte- ger.
ˆCXRIext( C → Zre Zim ) — Returns real and imaginary part of Gaus- sian integer.
ˆCGCDext( C2 C1 → C ) — GCD for Gauss integers.
ˆCSQFFext( C → { factor1 mult1 ... factn multn } ) — Factorization of Gauss integers. This is not the complete factorization of C over Gauss integers since the GCD of the real part and imaginary part of
ˆSECOSQFFext( :: x<< a b c x>> → { fact1 mult1 ... factn multn } ) — Factorization of irrquads and Gauss inte- gers.
ˆSUMSQRext( Z → Z C ) — Returns a Gauss integer C so that |C|ˆ2=Z. Z must be 2 or so that Z=1 mod 4. If Z 6= 1 mod 4, "Z is not 1 mod 4" error. Z should be prime to ensure th
ˆCNORMext( C → |C|ˆ2 ) — Square modulus of a Gauss integer.

Integer Tests

Z=( Z Z' → flag )
Z<>( Z Z' → flag )
Z<( Z Z' → flag )
Z<=( Z Z' → flag )
Z>( Z Z' → flag )
Z>=( Z Z' → flag )
ˆQIsZero?( Q → flag ) — Tests if Q is zero. Assumes list contains only lists or hexes!.
ˆDupQIsZero?( Q → Q flag ) — Duplicates Q and tests if Q is zero. Assumes list contains only lists or hexes!.
ˆZIsOne?( Z → flag ) — Tests if Z is Z1.
ˆDupZIsOne?( Z → Z flag ) — Duplicates Z, and returns TRUE if Z is 1.
ˆDupZIsTwo?( Z → Z flag ) — Returns TRUE if Z is 2.
ˆZIsNeg?( Z → flag ) — Tests if Z is negative.
ˆDupZIsNeg?( Z → Z flag ) — Tests if Z is negative.
ˆDupZIsEven?( Z → Z flag ) — Tests if Z is even.
ˆZNLT?( Z1 Z2 → flag ) — TRUE if |Z1|<|Z2|.
ˆOBJINT?( z/% → z flag ) — Tests if Obj is an integer.
ˆOBJPOSINT?( z/% → z flag ) — Tests if Obj is a positive integer smaller than Zsmall.
ˆCKINT>0( Obj → Obj flag ) — Tests if Obj is a strictly positive integer.
ˆMETAINT?( Meta → Meta flag ) — Tests if Meta is an integer.
ˆMETAPOSINT?( Meta → Meta flag ) — Tests if Meta is a positive integer smaller than Zsmall.
ˆDupTypeS?( Z → Z flag ) — Tests if Z is short (≤ 64 bits).

Matrices

121

Creating and Redimensioning Matrices

ˆMATIDN( M/z/% → M' ) — Creates identity matrix.
ˆMATCON( M ob → [ob] ) — Creates constant matrix from matrix.
ˆMAKEARRY( {#el} symb → [] ) — ( {#rows #cols} symb → [[]] ) Creates constant matrix/array from ob type.
ˆDIMRANM( {} → M' ) — Creates symbolic random matrix from dimen- sions.
ˆMATRANM( M → M' ) — Changes all elements of matrix to elements generated randomly.
ˆOBJDIMS2MAT( ob {} → M ) — Creates constant matrix from dimension and ob.
ˆLCPROG2M( #n #m prg → M ) — Fills a matrix of specified size using a pro- gram. prg must take two arguments and re- turn one argument. On entry MAKE2DMATRIX provide the indexes a
ˆMAKE2DMATRIX( #n #m prg → M ) — Creates matrix from size and program (with stack checking). prg must take 2 args and re- turn 1 arg. On entry MAKE2DMATRIX provide the indexes as Z in
ˆmake2dmatrix( #n #m prg → meta-M ) — Create meta-matrix from size and program (with stack checking). prg must take 2 args and return 1 arg On entry make2dmatrix provide the indexes as Z i
ˆMATREDIM( M {} → M' ) — Changes size of a matrix, removing elements and/or adding zeros, as necessary. . Name Description
ˆVRRDM( []/[[]] {} → [] ) — Vector Right ReDiMension: adds 0 to the right.
ˆVRRDMmeta( meta #l → meta-#l ) — Meta Right ReDiMension: adds 0 to the right.

Conversion

ˆ{}TO[]( {} → [] ) — Converts from list-of-lists representation to matrix. No checks on the element type.
ˆLIST2MATRIX( {} → [] ) — ( {{}} → [[]] ) ( ob → ob ) Converts a symbolic list to a matrix. Does not check that matrix is a valid one. Use DTYPFMAT? to do that.
ˆ[]TO{}( [] → {} ) — Converts from matrix to list-of-lists.
ˆMATRIX2LIST( [] → { } ) — ( [[]] → {{}} ) ( ob → ob ) Converts a symbolic matrix to a list.
ˆARRAY2MATRIX( [] → [] ) — ( [[]] → [[]] ) Converts array to symbolic array if necessary.
ˆSAMEMATRIX( M1 M2 → M1 M2 flag ) — If one object is a symbolic array, converts both arrays to symbolic form. Returns TRUE for symbolic matrices and FALSE for numeric.
ˆSAMEMATSCTYPE( M ob → M ob flag ) — If M is a numeric matrix and ob is not float, converts matrix to symbolic form. Returns TRUE for symbolic and FALSE for numeric.
ˆArryToList( []/[[]] → {}/{{}} ) — Converts normal array to list of lists; errors for symbolic arrays.
ˆMATEXPLODE( [[ob1..obn]] → ob1..obn [[ob1..obn]] )

Tests

ˆDUPNULL[]?( ob → ob flag ) — Tests for a null array.
ˆNULLVECTOR?( V → flag ) — Returns true if vector is null.
ˆCKSAMESIZE( arry1 arry2 → arry1 arry2 flag ) — Tests if arry1 and 2 have the same size.
ˆDTYPENDO?( ob → ob flag ) — Tests if object is a square symbolic matrix. Convert numeric array to symbolic matrix.
ˆ2DMATRIX?( ob → ob flag ) — Tests if object is a 2D matrix.

Calculations with Matrices

ˆMAT+( M2 M1 → M2+M1 )
ˆMADD( M2 M1 → M2+M1 )
ˆMAT-( M2 M1 → M2-M1 )
ˆMSUB( M2 M1 → M2-M1 )
ˆVADD( V2 V1 → V2+V1 )
ˆVSUB( V2 V1 → V2-V1 )
ˆMAT*( M2 M1 → M2*M1 ) — Matrix product with size and type checking.
ˆMMMULT( M2 M1 → M2*M1 )
ˆMVMULT( M V → V' ) — Product of matrix by vector.
ˆSCL*MAT( ob M → M*ob ) — Scalar times matrix.
ˆMAT*SCL( M ob → M*ob ) — Matrix times scalar. . Name Description
ˆVPMULT( V ob → V' ) — Multiplies vector by a scalar.
ˆMATSQUARE( M → M*M )
ˆMATˆ( M z/% → M' ) — Integral matrix power.
ˆMATCROSS( [] []' → []'' ) — Vector product.
ˆMATDOT( V2 V1 → ob ) — Scalar product with checking.
ˆRNDARRY( M % → M ) — Rounds array.
ˆTRCARRY( M % → M ) — Truncates array.
ˆMAT/SCL( M ob → M/ob ) — Divides matrix by scalar.
ˆMAT/( V M → Mˆ-1*V ) — "Divides" Vector by matrix.
ˆMATCHS( M → -M )
ˆMATINV( M → Mˆ-1 )
ˆMATCONJ( M → M' )
ˆMATRE( M → re[M] )
ˆMATIM( M → im[M] )
ˆMATTRACE( M → trace ) — Matrix trace.
ˆMATTRN( M → M' ) — Matrix transposition and conjugation.
ˆmattran( M → Meta-M' ) — Transposes matrix, returns meta-matrix.
ˆmattrn( Meta-M → Meta-M' ) — Transposes meta-matrix.
ˆMATDET( M → det ) — Determinant, expanding all (not row reduction).
ˆMATRDET( M → det ) — Determinant using row reduction.
ˆMATFNORM( M → ob ) — Frobenius norm.
ˆMATRNORM( M → ob ) — Row norm.
ˆMATCNORM( M → ob ) — Column norm.
ˆMATRIXDIM( ob → # ) — Returns symbolic matrix dimensionality of an ob- ject.

Linear Algebra and Gaussian Reduction

ˆMATREF( M → M' ) — Returns matrix in Row-Echelon form.
ˆMATRREF( M → M' ) — Returns matrix in Reduced Row-Echelon form.
ˆMATREFRREF( M #full_ref → M list M' ) — If #full_ref is 1, returns Reduced Row-Echelon form, otherwise returns just Row-Echolong form.
ˆMATRIXRCI( ncol i M const → M' ) — Multiplies row #i of symbolic matrix M by con- stant. ncol is not used, it's here because of the stack state at call-time from inside laRCI.
ˆMATRIXRCIJ( ncol #i #j M const → M' ) — Does Lj <- c*Li+Lj. ncol is not used, it's here be- cause of the stack state at call-time from inside laRCI.
ˆINXREDext( Lvar #full_ref M → Lvar pivot M )
ˆMETAMATRED( Meta-M Lvar #full_red → meta-M Lvar pivot )
ˆMETAPIVOT( meta-M #l #c → meta-M #l #l' #c' flag ) — Searchs a pivot in column #c starting from row #l. Flag is FALSE if pivot is not found. If pivot is found #l' is the row, #c is updated to #c'.
ˆPIVOTFLOAT( float → float_modulus )
ˆMATRANK( M → Z/% ) — Rank of a matrix.

Linear System Solver

ˆLINSOLV( b a → y ) — Solves y'=ay+b.
ˆSOLVEMETASYST( meta-M → d meta-sol T ) — ( meta-M → F ) Solves linear system in meta representation. Meta-sol has been reduced to the same de- nominator d.
ˆREDUCEMETASYST( meta-M → meta->M' ) — Reduces linear system in meta representa- tion.
ˆREDUCEMETAPSYST( meta-M → meta-M' ) — Reduces linear system in meta representa- tion. Does not reduce last column of meta- matr. This is useful to solve linear system with parameters in th
ˆSOLVECRAMER( meta-M → d meta-sol T ) — ( meta-M → F ) Solves cramer system. Meta-matr must be fully reduced. Meta-sol is reduced to the same denominator. d flag is FALSE if dimen- sion do n
ˆSYSText( M linc → linc linc' res cas_p )
ˆSTOSYSText( M2 M1 → M2 list )
ˆMAKESYSText( M_eq M_inc → M_eq M lidnt flag ) — Converts linear equations to a matrix and checks that equation are linear with respect to lidnt.

Other Matrix Operations

ˆFINDELN( {} A → # flag ) — Returns index # of element {} in array.
ˆPULLEL[S]( A # → A el ) — Extracts element of index # from array. Array type test is made in assembly for array speed.
ˆBANGARRY( el # M → M' ) — Puts el at index # of matrix M.
ˆPUT[]( el #i V → V ) — Replaces #i-th vector component by element.
ˆLENMATRIX( [] → #el ) — ( [[]] → #row )
ˆMATSUB( M rmin nrows cmin ncols { #m #n } → M' ) — Extracts submatrix from a matrix.
ˆMATREPL( M1 M2 → M2' ) — Replaces part of matrix destination (M2) by matrix source (M1). LAM1 to 9 must be bound like in Llib/LIMain.s ( 9:r 8:c 7:dmat? 6:f 5:md 4:nd 3:smat?
ˆMATRIX>DIAG( A ncols+1 ndiags → V ) — Extracts diagonal terms. ncols+1 is there because MATRIX>DIAG is called inside la>DIAG.
ˆMATRIXDIAG>( ncol+1 diagV dlen dims{} → M ) — Constructs a matrix from a vector of diagonal terms.
ˆla+ELEMsym( V ob %i → V' ) — Inserts element in symbolic vector at row %i.
ˆINSERTROW[]( V ob #i → V ) — ( M V #i → M' ) Inserts element/vector in symbolic vec- tor/matrix at row #i. Checks for 0 < #i < #n + 1, but does not check for matrix/vector size.
ˆinsertrow[]( ob #i meta → meta ) — Inserts element/vector in meta-object at posi- tion #i. Checks for 0 < #i < #n + 1, but does not check for vector size. . Name Description
ˆINSERTCOL[]( M V #i → M' ) — Inserts vector in symbolic matrix at col #i. Checks for 0 < #i < #n + 1, but does not check for matrix/vector size.
ˆINSERT[]ROW[]( M3 M2 #i → M ) — Inserts matrix2 in matrix3 starting from row #i. Checks for 0 < #i < #n+1, but does not check for matrix size.
ˆINSERT[]COL[]( M3 M2 #i → M ) — Inserts matrix2 in matrix3 starting from row #i. Checks for 0 < #i < #n + 1, but does not check for matrix size.
ˆMATRIXCSWAP( M #c #c' → M ) — Exchanges columns c and c' of a symbolic ma- trix.
ˆMATRIXRSWAP( M #r #r' → M ) — Exchanges lines r and r' of a symbolic matrix.
ˆSWAPROWS( M % %' → M' ) — SWAP two rows in matrix. Internal version of xRSWP.
ˆMATRIX-ROW( M #r → M' lr ) — Extracts row #r from M. Checks boundaries.
ˆMETAMAT-ROW( meta-M #r → meta-M lr ) — Extracts row #r from meta-matrix. Checks boundaries.
ˆMATRIX-COL( M #c → M cc ) — Extracts column #r from matrix. Checks boundaries.
ˆMETAMATCSWAP( meta-M #c #c' → meta-M ) — Exchanges columns c and c' of a meta-matrix.
ˆMETAMATRSWAP( meta-M #l #l' → meta-M ) — Exchanges lines l and l' of a meta-matrix (or vector).
ˆSTOMAText( M → ) — Stores matrix in 'MATRIX' in current direc- tory.
ˆADDMATOBJext( arry ob → arry arry ) — ( ob arry → arry arry ) Used for addition of numeric matrix and sym- bolic object.
ˆVUNARYOP( v op → V ) — Applies unary op(v[i]) to get V[i].
ˆVBINARYOP( V2 V1 binop → V ) — Works even if V2 and V1 do not have not the same dimension.
ˆPEVAL( V r → P[r] ) — Horner evaluation, where elements of V rep- resent coefficients of a polynomial.

Eigenvalues, Eigenfunctions, Reduction

ˆMATEGVL( M → V ) — Computes eigenvalues of a matrix like EGVL.
ˆMATEGV( M → V ) — Computes eigenvalues/eigenvectors of a matrix like EGV.
ˆMADJ( M → Mˆ-1 P[M] P[lambda] ) — Computes inverse, matrix polynomial and char- acteristic polynomial.
ˆJORDAN( M → pmin pcar {evect} {eval} ) — ( pmadj pcar → pmin pcar {evect} {eval} ) Eigenvalue/eigenfunctions computation.
ˆFLAGJORDAN( M → ) — Internal JORDAN.
ˆQXA( symb lidnt → M lidnt ) — Converts symbolic quad form to matrix quad form.
ˆFLAGQXA( symb lidnt → M lidnt ) — Internal QXA.
ˆAXQ( M lidnt → symb lidnt ) — Converts matrix quad form to qymbolic quad form. . Name Description
ˆFLAGAXQ( M lidnt → symb lidnt ) — Internal AXQ.
ˆGAUSS( symb → D P symb' ) — Gauss reduction of quadratic form (symbolic).
ˆFLAGGAUSS( symb lidnt → symb' ) — Internal GAUSS.
ˆSYLVESTER( M → D P ) — Gauss reduction of a quadratic form (matrix).
ˆFLAGSYLVESTER( M → P D ) — Internal SYLVESTER.
ˆPCAR( [[]] → symb ) — Internal PCAR.

Expression Manipulation

174

Basic Operations and Function Application

ˆx+ext( ob2 ob1 → ob2+ob1 ) — Symbolic addition, tests for infinities.
ˆx-ext( ob2 ob1 → ob2-ob1 ) — Symbolic subtraction, tests for infinities.
ˆx*ext( ob2 ob1 → ob2*ob1 ) — Symbolic multiplication, tests for infinities.
ˆx/ext( ob2 ob1 → ob2/ob1 ) — Symbolic division, tests for infinities.
ˆxˆext( ob power → obˆpower ) — Power.
ˆEXPANDˆ( x y → xˆy=exp[y*ln[x]] ) — Power with simplifications. If y is a fraction of integers, use XROOTˆ instead.
ˆQNeg( ob → -ob ) — Symbolic negation.
ˆRNEGext( ob → -ob ) — Symbolic negation. . Name Description
ˆSWAPRNEG( ob2 ob1 → ob1 -ob2 ) — Does SWAP then symbolic negation.
ˆRREext( ob → Re(ob) ) — Symboloc real part.
ˆSWAPRRE( ob2 ob1 → ob1 Re(ob2) ) — SWAP, then RREext.
ˆRIMext( ob → Im(ob) ) — Symbolic imaginary part.
ˆSWAPRIM( ob1 ob2 → ob2 Im(ob1) ) — SWAP, then RIMext.
ˆxREext( symb → symb' ) — Complex real part. Expands only + - * / ˆ.
ˆxIMext( symb → symb' ) — Complex imaginary part. Expands only + - * / ˆ.
ˆRCONJext( ob → Conj(ob) ) — Symbolic complex conjugate.
ˆxABSext( ob → abs(ob) ) — Symbolic ABS function.
ˆRABSext( ob → abs(ob) ) — Internal ABS. Internal representation.
ˆxINVext( ob → 1/ob ) — Symbolic inversion.
ˆxSYMINV( symb → 1/symb ) — Symbolic inversion.
ˆxSQext( symb → sq(symb) ) — Symbolic square.
ˆxSYMSQ( symb → symbˆ2 )
ˆSXSQRext( ob → sqrt(ob) ) — Does not take care of the sign.
ˆXSQRext( ob → sqrt(ob) ) — Tries to return a positive square root if nocareflag is cleared.
ˆxvext( ob → sqrt(ob) ) — Symbolic square root, tests for 0 and 1.
ˆxSYMSQRT( symb → sqrt(symb) )
ˆCKLN( ob → ln(ob) ) — Symbolic LN with special handling for fractions. Does not use the internal representation.
ˆxLNext( ob → ln(ob) ) — Symbolic LN, without fraction handling.
ˆEXPANDLN( ob → ln(ob) ) — Symbolic LN using internal representation. Be- fore switching to internal representation, test for ABS, 0 and 1 and, in real mode, test if ob=exp(x).
ˆREALLN( ob → ln(ob) ) — Internal natural logarithm for a real argument.
ˆCMPLXLN( ob → ln(ob) ) — Internal complex natural logarithm.
ˆLNATANext( ob → ln(ob) ) — Internal natural logarithm for complex.
ˆxEXPext( y d n → exp(y*n/d*i*π) ) — Symbolic EXP, tests for 0, infinity and i*k*π/12 where k is an integer. Tests for d=1,2,3,4,6.
ˆxCOSext( ob → cos(ob) ) — Symbolic COS, tests for 0 and multiples of π/12. Also tests if ob=acos(x) or ob=asin(x).
ˆxSYMCOS( ob → cos(ob) )
ˆxACOSext( ob → acos(ob) ) — Symbolic ACOS. Tests for 0, infinity and tables.
ˆxSYMACOS( ob → acos(ob) )
ˆxSINext( ob → sin(ob) ) — Symbolic SIN, tests for 0 and multiplies of π/12. Also tests if ob=acos(x) or ob=asin(x).
ˆxSYMSIN( ob → sin(ob) )
ˆxASINext( ob → asin(ob) ) — Symbolic ASIN. Tests for 0, infinity and tables.
ˆxSYMASIN( ob → asin(ob) )
ˆxTANext( ob → tan(ob) ) — Symbolic TAN. Tests for 0 and multiplies of π/12. Also tests if ob=atan(x).
ˆxSYMTAN( ob → tan(ob) )
ˆxATANext( ob → atan(ob) ) — Symbolic ATAN. Tests for 0, infinity and tables.
ˆxSYMATAN( ob → atan(ob) )
ˆxCOSHext( ob → cosh(ob) ) — Symbolic COSH. Tests for 0, infinity and acosh(x).
ˆxSYMCOSH( ob → cosh(ob) ) — . Name Description
ˆxACOSHext( symb → acosh(symb) ) — Symbolic ACOSH.
ˆxSYMACOSH( symb → acosh(symb) )
ˆxSINHext( ob → sinh(ob) ) — Symbolic SINH. Tests for 0, infinity and asinh(x).
ˆxSYMSINH( ob → sinh(ob) )
ˆxASINHext( symb → symb' ) — Symbolic ASINH.
ˆxSYMASINH( symb → asinh(symb) )
ˆxTANHext( ob → tanh(ob) ) — Symbolic TANH. Tests for 0 and atanh(x).
ˆxSYMTANH( ob → tanh(ob) ) — Symbolic TANH.
ˆxATANHext( symb → symb' ) — Symbolic ATANH.
ˆxSYMATANH( ob → atanh(ob) )
ˆxSYMFLOOR( symb → symb' )
ˆxSYMCEIL( symb → symb' )
ˆxSYMIP( symb → symb' )
ˆxSYMFP( symb → symb' )
ˆxSYMXPON( symb → symb' )
ˆxSYMMANT( symb → symb' )
ˆxSYMLNP1( symb → symb' )
ˆxSYMLOG( symb → symb' )
ˆxSYMALOG( symb → symb' )
ˆxSYMEXPM1( symb → symb' )
ˆfactorial( symb → symb! ) — Symbolic factorial.
ˆfacts( symb → symb! ) — Symbolic factorial.
ˆxSYMFACT( symb → symb! )
ˆxSYMNOT( symb → symb' )
ˆx=ext( ob2 ob1 → ob2=ob1 )

Trigonometric and Exponential Operators

ˆCOS2TAN/2( symb → symb' ) — x → (1-(tan(x/2))ˆ2)/(1+(tan(x/2))ˆ2)
ˆSIN2TAN/2( symb → symb' ) — x → 2 tan(x/2)/(1+(tan(x/2))ˆ2)
ˆTAN2TAN/2( symb → symb' ) — x → 2 tan(x/2)/(1-(tan(x/2))ˆ2)
ˆCOS2TAN( symb → symb2 ) — x → 1/sqrt(1+(tan(x))ˆ2)
ˆSIN2TAN( symb → symb' ) — x → tan(x)/sqrt(1+(tan(x))ˆ2)
ˆLNP12LN( symb → symb' ) — x → ln(x+1)
ˆLOG2LN( symb → symb' ) — x → log(x)
ˆALOG2EXP( symb → symb' ) — x → alog(x)
ˆEXPM2EXP( symb → symb' ) — x → exp(x)-1
ˆSQRT2LNEXP( symb → symb' ) — x → exp(ln(x)/2)
ˆsqrt2lnexp( meta → meta' ) — x → exp(ln(x)/2)
ˆTAN2EXP( symb → symb' ) — x → (exp(i2x)-1)/(i*(exp(i2x)+1))
ˆASIN2LN( symb → symb' ) — x → = i*ln(x+sqrt(xˆ2-1))+pi/2.
ˆACOS2LN( symb → symb' ) — x → ln(x+sqrt(xˆ2-1))/i
ˆTAN2SC( symb → symb' ) — x → sin(x)/cos(x)
ˆSIN2TC( symb → symb' ) — x → cos(x)*tan(x)
ˆCOS2ext( symb → symb' ) — x → sqrt(1-(sin(x))ˆ2).
ˆSIN2ext( symb → symb' ) — x → sqrt(1-(cos(x))ˆ2). . Name Description
ˆATAN2ASIN( symb → symb' ) — x → asin(x/sqrt(xˆ2+1))
ˆASIN2ATAN( symb → symb' ) — x → atan(x/sqrt(1-xˆ2))
ˆASIN2ACOS( symb → symb' ) — x → π/2-acos(x)
ˆACOS2ASIN( symb → symb' ) — x → π/2-asin(x)
ˆATAN2LNext( symb → symb' ) — x → i/2*ln((i+x)/(i-x))
ˆTAN2SC2( symb → symb' ) — x → (1-cos(2x))/sin(2x)
ˆTAN2CS2( symb → symb' ) — x → sin(2x)/(1+cos(2x))
ˆSIN2EXPext( symb → symb' ) — x → (eˆ(i*x)-1/eˆ(i*x))/(2i)
ˆCOS2EXPext( symb → symb' ) — x → (eˆ(i*x)+1/eˆ(i*x))/2
ˆSINH2EXPext( symb → symb' ) — x → (eˆx-1/eˆx)/2
ˆCOSH2EXPext( symb → symb' ) — x → (eˆx+1/eˆx)/2
ˆTANH2EXPext( symb → symb' ) — x → (eˆ2x-1)/(eˆ2x+1)
ˆASINH2LNext( symb → symb' ) — x → ln(x+sqrt(xˆ2+1))
ˆACOSH2LNext( symb → symb' ) — x → ln(x+sqrt(xˆ2-1))
ˆATANH2LNext( symb → symb' ) — x → ln((1+x)/(1-x))/2
ˆXROOT2ext( symb1 symb2 → symb' ) — x y → exp(ln(y)/x)
ˆLN2ATAN( symb → symb' ) — x → ln(x)

Simplification, Evaluation and Substitution

ˆVAR=LIST( idnt {} → {}' ) — Replaces all elements of the initial list by idnt=element.
ˆSYMBEXEC( ob symb → ob' ) — If symb is an equation, executes the corre- sponding change of variables in ob, otherwise tries to find symb so that ob is zero. Note that change of v
ˆMEVALext( ob {} {}' → ob' ) — Replaces all occurrances of an element of list2 by the corresponding element of list1 in ob. Looks in ob from outer to inner expressions. list2 and li
ˆCASNUMEVAL( symb list1 list2 → symb' ) — Evaluation of a symbolic. The lists' for- mats are list1={idnt/lam1... idnt_n/lam_n} list2={value1...value_n}. The idnt's/lam's in list1 are not evalu
ˆCASCOMPEVAL( symb → symb' ) — Evaluation of a symbolic.
ˆREPLACE2BY1( symb idnt a → symb' ) — Evaluation of a symbolic replacing an idnt by a value; for example evaluation of F(X) for X=1/2)
ˆNR_REPLACE( symb idnt a → symb' ) — Like REPLACE2BY1 but prevents evaluation of INT.
ˆCASCRUNCH( ob → % ) — Like CRUNCH but in approximate mode.
ˆAPPROXCOMPEVAL( symb → symb' ) — Like CASCOMPEVAL but in approximate mode.
ˆALGCASCOMPEVAL( expr → expr ) — . Name Description
ˆSLVARext( Lvar → Lvar' ) — Simplifies all elements of the list that are sup- posed to be variables.
ˆSIMPLIFY( symb → symb' ) — Simplifies one object like EVAL.
ˆSIMP1ext( symb → symb' ) — Simplifies one object like EXPAND. Object must be a symbolic, a real or a complex number.
ˆSYMEXPAN( symb → symb' ) — Simplifies one object like EXPAN. Object must be symb/real/cmplx.
ˆSIMPVAR( ob → ob' ) — Simplifies variable.
ˆSIMPSYMBS( inf sup fcn var → int(inf,sup,fcn,var) )
ˆSIMPUSERFCN( ob1..obn #n ob → id[] ) — Simplification of user functions. Tests for derivative of user functions. Ob must be an id, a symbolic, a secondary or a romptr.
ˆEVALUSERFCN( V1..Vn #n fcn → f[] ) — Evaluates a user function with stack checking.
ˆSIMP|( ob list → ob' ) — Executes the WHERE operator.
ˆSIMPext( ob1 ob2 → ob1' ob2' ) — Simplifies two objects in internal representa- tion. Checks that o2 is not a complex or an irrquad because decomposition of the corre- sponding fracti
ˆSIMPGCDext( o1 o2 gcd → o1/gcd o2/gcd ) — Divides o1 and o2 by gcd.
ˆSIMP3ext( a b → g a'' b'' ) — Calculates g = gcd(a,b) and a''=a/g and b''=b/g.
ˆTSIMP2ext( symb → symb ) — Transcendental simplifications. Converts only sqrt ˆ and XROOT to EXP/LN. LN are returned as -1/INV[-LN[]] for use by SERIES.
ˆTSIMPext( symb → symb ) — Transcendental simplifications. Convert tran- scendental functions to EXP and LN.
ˆTSIMP3ext( symb → symb )

Collection and Expansion

ˆCOLCext( symb → symb' ) — Factorization with respect to the current vari- able of symb and factorization of the integer content of symb.
ˆTCOLLECT( symb → symb' ) — Performs trigonometric linearization and then collects sines and cosines of the same an- gle.
ˆSIGMAEXPext( symb → symb' ) — Conversion to exp and ln with exponential linearization.
ˆLINEXPext( symb → Meta ) — Meta = arg_exp1 coef1 ... arg_expn coefn #2n.
ˆSIGMAEXP2ext( Meta → symb ) — Back conversion from arg_exp/coef_meta to symbolic.
ˆSINEXPA( symb → symb' ) — Expands SIN.
ˆLNEXPA( symb → symb' ) — Expands LN.
ˆMTRIG2SYMB( Meta → symb ) — Back conversion of trig-meta to symbolic.
ˆCOSEXPA( symb → symb' ) — Expands COS.
ˆEXPEXPA( symb → symb' ) — Expands EXP.
ˆLINEXPA( symb → Meta ) — Alternates trig operator and coefficient.
ˆLNCOLCext( symb → symb' ) — Collects logarithms. . Name Description
ˆTEXPAext( symb → symb ) — Main transcendental expansion program.
ˆEXLR( 'a=b' → a b ) — ( ob → X ob ) Internal equation splitter.

Trigonometric Transformations

ˆHALFTAN( symb → symb' ) — Converts trigonometric functions to TAN of the half angle.
ˆTRIGTAN( symb → symb' ) — Convert sin and cos to tan of the same angle.
ˆTRIGext( symb → symb' ) — Applies sinˆ2+cosˆ2=1 to simplify trigonomet- ric expressions. If flag -116 is set, tries to keep only sin, else only cos.
ˆHYP2EXPext( symb → symb' ) — Converts hyperbolic functions to exp and ln. Converts XROOT and ˆ to exp and ln.
ˆEXPLNext( symb → symb' ) — Converts all transcendental functions to exp and ln.
ˆSERIESEXPLN( symb → symb' ) — Converts sqrt, ˆ and XROOT to EXP/LN.
ˆTAN2SCext( symb → symb' ) — Converts tan to sin/cos.
ˆSIN2TCext( symb → symb' ) — Converts sin to cos*tan.
ˆATAN2Sext( symb → symb' ) — Converts ATAN to ASIN using asin(x)=atan(x/sqrt(1-xˆ2)).
ˆASIN2Text( symb → symb' ) — Converts ASIN to ATAN using asin(x)=atan(x/sqrt(1-xˆ2)).
ˆASIN2Cext( symb → symb' ) — Converts ASIN to ACOS using asin(x)=pi/2- acos(x).
ˆACOS2Sext( symb → symb' ) — Converts ACOS to ASIN using acos(x)=pi/2- asin(x).
ˆTAN2SC2ext( symb → symb' ) — Converts TAN to SIN/COS of the double angle. If flag -116 is set calls TAN2SC2, else TAN2CS2.
ˆLN2ext( symb → symb' ) — If symb contains x, returns -1/inv(-ln(x)), else ln(x). Used by SERIES.

Division, GCD and LCM

ˆPSEUDODIV( Q2 Q1 → a Q2*a/Q1 Q2*a/Q1 )
ˆBESTDIV2( o2 o1 → quo mod )
ˆQUOText( o2 o1 → o2 div o1 ) — Euclidean quotient of 2 objets (works even if o2 mod o1=0).
ˆNEWDIVext( ob2 ob1 → quo mod ) — Euclidean division, ob2 and ob1 may be frac- tions of returns a fraction of Q.
ˆQUOTOBJext( a_a-1...a0 bb_1...b0 #b #a flag → r q ) — SRPL Euclidean division: step 2 computes the remainder r only if flag is TRUE.
ˆDIVISIBLE?( a b → a/b T ) — ( a b → ob F ) Returns TRUE and quotient if b divides a, oth- erwise returns FALSE.
ˆQDiv?( a b → a/b T ) — ( a b → F ) Returns TRUE and quotient if b divides a, oth- erwise returns FALSE. . Name Description
ˆFastDiv?( P Q → P/Q PmodQ T ) — Euclidean division. Assumes P and Q have in- teger or Gaussian integer coefficient. Returns FALSE in complex mode or if sparse short divi- sion fails.
ˆPOTENCEext( z1 z2 → q r ) — Step by step Euclidean division for small inte- gers.
ˆDENOLCMext( list → ob ) — Calculates the LCM of the denominator of the elements of the list. If input is not a list, re- turns the denominator of the object.
ˆMETADENOLCM( Meta → ob ) — Calculates LCM of the denominators of the el- ements of Meta.
ˆLPGCDext( {} → {} ob ) — Calculates the GCD of all the elements in the list. The algorithm is far from optimal.
ˆSLOWGCDext( c 1 A B → c* gcd(A,B) ) — Euclidean algorithm for polynomial GCD. Used if A or B contains irrquads. c is the GCD of the contents of the original polynomials re- turned after fa
ˆQGcd( ob2 ob1 → gcd ) — Generic internal GCD. ( LAM2: GCDext ob1, ob2 → pgcd ).

Symbolic Meta Handling

169

Basic Expression Manipulation

ˆSYMBINCOMP( symb → ob1 .. obN #n ) — ( ob → ob #1 ) ( {} → {} #1 ) Explodes symbolic object into meta. Other ob- jects are converted into one-object metas by pushing #1 into the stack.
ˆm-1&m+1( meta → meta&1&+ meta&1&- ) — Creates two copies of the meta. To the first one, adds 1 and +, to the second one, adds 1 and -.
ˆmeta1/meta( meta → meta 1&meta&/ ) — Duplicates the meta, and inverts the expression represented by it.
ˆ1&meta( Meta → 1&Meta ) — Prepends the number 1 to the meta.
ˆmeta/2( Meta → Meta&2&/ ) — Divides the expression by two.
ˆaddt2( Meta → Meta&2 ) — Appends the number 2 to the meta.
ˆaddt/( Meta → Meta&/ ) — Appends division to meta. . Name Description
ˆmeta2*( Meta → 2&Meta&* ) — Multiplies the expression by 2.
ˆmetai*( meta → meta*i ) — Multiplies meta by i.
ˆmeta1-sq( Meta → 1&Meta&SQ&- ) — Changes x into 1-xˆ2, where x is the original ex- pression.
ˆmetasq+1( Meta → Meta&SQ&1&+ ) — Changes x into xˆ2+1, where x is the original ex- pression.
ˆmetasq-1( Meta → Meta&SQ&1&- ) — Changes x into xˆ2-1, where x is the original equation.
ˆmeta-1( Meta → Meta&1&- ) — Subtracts one from the expression.
ˆaddtˆ( Meat → Meta&ˆ ) — Append power operator to meta object.
ˆtop&addt*( meta2 meta1 → meta2*meta1 ) — top& addt*. No checks.
ˆtop&addt/( meta2 meta1 → meta2/meta1 ) — top& addt/. No checks.
ˆaddti( meta → meta&i ) — Appends i (the Imaginary unit) to expression.

Basic Operations and Function Application

ˆmetaadd( Meta1 Meta2 → Meta1+Meta2 ) — Adds 2 meta objects with trivial simplifica- tions. metaadd checks for Meta1/2=Z0 ONE.
ˆMetaAdd( Meta2 Meta1 → Meta2+Meta1 ) — Adds 2 meta objects with trivial simplifica- tions. Checks for infinities then call metaadd.
ˆckaddt+( Meta1 Meta2 → Meta1+Meta2 ) — Adds 2 meta objects with trivial simplifica- tions.
ˆmetasub( Meta1 Meta2 → Meta1+Meta2 ) — Subtracts 2 meta objects with trivial simplifi- cations. metasub checks for Meta1/2=Z0 ONE.
ˆMetaSub( Meta2 Meta1 → Meta2-Meta1 ) — Subtracts 2 meta objects with trivial sim- plifications. Checks for infinities then call metasub.
ˆckaddt-( Meta1 Meta2 → Meta1+Meta2 ) — Subtracts 2 meta objects with trivial simplifi- cations.
ˆmetamult( Meta1 Meta2 → Meta1*Meta2 ) — Multiplies 2 meta objects with trivial simpli- fications. Checks for meta1, meta2= Z0 or Z1, checks for xNEG.
ˆMetaMul( Meta2 Meta1 → Meta2*Meta1 ) — Multiplies 2 meta objects with trivial sim- plifications. Checks for infinities/0 then call metamult.
ˆckaddt*( Meta1 Meta2 → Meta1*Meta2 ) — Multiplies 2 meta objects with trivial simpli- fications.
ˆmetadiv( Meta2 Meta1 → Meta2/Meta1 ) — Divides 2 meta objects with trivial simplifica- tions. Checks for infinities and 0, meta2 =1 or Z-1, checks for xNEG.
ˆMetaDiv( Meta2 Meta1 → Meta2/Meta1 ) — Divide 2 meta objects with trivial simplifica- tions. Checks for infinities and 0 then call metadiv.
ˆDIVMETAOBJ( o1...on #n ob → {o1/ob...on/ob} ) — Division of all elements of a meta by ob. Tests if o=1.
ˆmetaˆ( Meta ob → Meta&ob&ˆ ) — Elevates expression to a power. If ob=1, just returns the expression. Tests for present of xNEG in the end of meta for integral powers. . Name Descrip
ˆmetapow( Meta2 Meta1 → Meta2ˆMeta1 ) — Elevates expression to a power (any other ex- pression). If length of Meta1 is ONE, calls metaˆ.
ˆMetaPow( Meta2 Meta1 → Meta2ˆMeta1 ) — Power. Checks for infinities then calls metapow.
ˆmetaxroot( Meta2 Meta1 → Meta2&XROOT&Meta1 ) — Root of expression.
ˆmetaneg( meta → meta ) — Checks only for meta finishing by xNEG.
ˆmetackneg( meta → meta ) — Like metaneg but checks for meta=ob ONE.
ˆMetaNeg( Meta → Meta ) — Negates meta. Only checks for metas finish- ing by xNEG.
ˆxSYMRE( meta → meta' ) — Meta complex real part. Expands only + - * / ˆ.
ˆxSYMIM( meta → meta' ) — Meta complex imaginary part. Expands only + - * / ˆ.
ˆaddtABS( Meta → Meta' ) — Meta ABS. Does a CRUNCH first to find sign.
ˆaddtABSEXACT( Meta → Meta' ) — Meta ABS. No crunch, sign is only found us- ing exact methods.
ˆaddtSIGN( Meta → Meta' ) — Meta SIGN.
ˆaddtARG( Meta → Meta' ) — Meta ARG.
ˆaddtXROOT( Meta2 Meta1 → Meta' ) — Meta XROOT. XROOT(o2,o1) is o1ˆ[1/o2], compared to o2ˆo1.
ˆaddtMIN( Meta2 Meta1 → Meta' ) — Meta MIN.
ˆaddtMAX( Meta2 Meta1 → Meta' ) — Meta MAX.
ˆaddt<( Meta2 Meta1 → Meta' ) — Meta <.
ˆaddt<=( Meta2 Meta1 → Meta' ) — Meta <=.
ˆaddt>( Meta2 Meta1 → Meta' ) — Meta >.
ˆaddt>=( Meta2 Meta1 → Meta' ) — Meta >=.
ˆaddt==( Meta2 Meta1 → Meta' ) — Meta ==.
ˆaddt!=( Meta2 Meta1 → Meta' ) — Meta !=.
ˆaddt%( Meta2 Meta1 → Meta' ) — Meta %.
ˆaddt%CH( Meta2 Meta1 → Meta' ) — Meta %CH. Meta2*(1+Meta'/100)=Meta1.
ˆaddt%T( Meta2 Meta1 → Meta' ) — Meta %T.
ˆaddtMOD( Meta2 Meta1 → Meta' ) — Meta MOD.
ˆaddtTRNC( Meta2 Meta1 → Meta' ) — Meta TRNC.
ˆaddtRND( Meta2 Meta1 → Meta' ) — Meta RND.
ˆaddtCOMB( Meta2 Meta1 → Meta' ) — Meta COMB.
ˆaddtPERM( Meta2 Meta1 → Meta' ) — Meta PERM.
ˆaddtOR( Meta2 Meta1 → Meta' ) — Meta OR.
ˆaddtAND( Meta2 Meta1 → Meta' ) — Meta AND.
ˆaddtXOR( Meta2 Meta1 → Meta' ) — Meta XOR.
ˆaddtCONJ( meta → meta' ) — Meta complex conjugate.
ˆaddtLN( Meta → Meta' ) — Meta LN. . Name Description
ˆaddtCOS( Meta → Meta' ) — Meta COS.
ˆaddtSIN( Meta → Meta' ) — Meta SIN.
ˆaddtTAN( Meta → Meta' ) — Meta TAN.
ˆaddtSINACOS( meta → meta' ) — If meta stands for x, meta' stands for sqrt[1- xˆ2].
ˆaddtASIN( Meta → Meta' ) — Meta ASIN.
ˆaddtACOS( Meta → Meta' ) — Meta ACOS.
ˆaddtATAN( Meta → Meta' ) — Meta ATAN.
ˆaddtSINH( Meta → Meta' ) — Meta SINH.
ˆaddtCOSH( Meta → Meta' ) — Meta COSH.
ˆaddtTANH( Meta → Meta' ) — Meta TANH.
ˆaddtATANH( Meta → Meta' ) — Meta ATANH.
ˆaddtASINH( Meta → Meta' ) — Meta ASINH.
ˆaddtACOSH( Meta → Meta' ) — Meta ACOSH.
ˆaddtSQRT( Meta → Meta' ) — Meta SQRT.
ˆaddtSQ( Meta → Meta' ) — Meta SQ.
ˆaddtINV( Meta → Meta' ) — Meta INV.
ˆaddtEXP( Meta → Meta' ) — Meta EXP. Does not apply EXP[- ..]=1/EXP[..].
ˆxSYMEXP( Meta → Meta' ) — Meta EXP. Applies EXP[-..]=1/EXP[..].
ˆaddtD->R( Meta → Meta' ) — Meta D→R.
ˆaddtR->D( Meta → Meta' ) — Meta R→D.
ˆaddtFLOOR( Meta → Meta' ) — Meta FLOOR.
ˆaddtCEIL( Meta → Meta' ) — Meta CEIL.
ˆaddtIP( Meta → Meta' ) — Meta IP.
ˆaddtFP( Meta → Meta' ) — Meta FP.
ˆaddtXPON( Meta → Meta' ) — Meta XPON.
ˆaddtMANT( Meta → Meta' ) — Meta MANT.
ˆaddtLNP1( meta → meta ) — Meta LNP1.
ˆaddtLOG( meta → meta ) — Meta LOG.
ˆaddtALOG( meta → meta ) — Meta ALOG.
ˆaddtEXPM( meta → meta ) — Meta EXPM.
ˆaddtFACT( Meta → Meta' ) — Meta FACT.
ˆaddtNOT( Meta → Meta' ) — Meta NOT.

Trigonometric and Exponential Operators

ˆcos2tan/2( meta → meta' ) — x → (1-(tan(x/2))ˆ2)/(1+(tan(x/2))ˆ2)
ˆ1-xˆ2/1+xˆ2( meta → meta' ) — x → (1-xˆ2)/(1+xˆ2)
ˆsin2tan/2( meta → meta' ) — x → 2 tan(x/2)/(1+(tan(x/2))ˆ2) . Name Description
ˆ2x/1+xˆ2( meta → meta' ) — x → 2x/(1+xˆ2)
ˆtan2tan/2( meta → meta' ) — x → 2 tan(x/2)/(1-(tan(x/2))ˆ2)
ˆaddtTAN/2( meta → meta' ) — x → tan(x/2)
ˆcos2tan( meta → meta' ) — x → 1/sqrt(1+(tan(x))ˆ2)
ˆsin2tan( meta → meta' ) — x → tan(x)/sqrt(1+(tan(x))ˆ2)
ˆtan2exp( meta → meta' ) — x → (exp(i2x)-1)/(i*(exp(i2x)+1))
ˆasin2ln( meta → meta' ) — x → = i*ln(x+sqrt(xˆ2-1))+π/2.
ˆacos2ln( meta → meta' ) — x → ln(x+sqrt(xˆ2-1))/i
ˆsin/cos( meta → meta' ) — x → sin(x)/cos(x)
ˆcos*tan( meta → meta' ) — x → cos(x)*tan(x)
ˆsqrt1-sinˆ2( meta → meta' ) — x → sqrt(1-(sin(x))ˆ2).
ˆsqrt1-cosˆ2( meta → meta' ) — x → sqrt(1-(cos(x))ˆ2).
ˆatan2asin( meta → meta' ) — x → asin(x/sqrt(xˆ2+1))
ˆasin2atan( meta → meta' ) — x → atan(x/sqrt(1-xˆ2))
ˆpi/2-acos( meta → meta' ) — x → π/2-acos(x)
ˆpi/2-meta( meta → meta' ) — x → π/2-x
ˆpi/2-asin( meta → meta' ) — x → π/2-asin(x)
ˆatan2ln( meta → meta' ) — x → i/2*ln((i+x)/(i-x))
ˆ2*1-cos/sin( meta → meta' ) — x → (1-cos(2x))/sin(2x)
ˆ2*sin/1+cos( meta → meta' ) — x → sin(2x)/(1+cos(2x))
ˆsin2exp( meta → meta' ) — x → (eˆ(i*x)-1/eˆ(i*x))/(2i)
ˆcos2exp( meta → meta' ) — x → (eˆ(i*x)+1/eˆ(i*x))/2
ˆsinh2exp( meta → meta' ) — x → (eˆx-1/eˆx)/2
ˆcosh2exp( meta → meta' ) — x → (eˆx+1/eˆx)/2
ˆtanh2exp( meta → meta' ) — x → (eˆ2x-1)/(eˆ2x+1)
ˆasinh2ln( meta → meta' ) — x → ln(x+sqrt(xˆ2+1))
ˆacosh2ln( meta → meta' ) — x → ln(x+sqrt(xˆ2-1))
ˆatanh2ln( meta → meta' ) — x → ln((1+x)/(1-x))/2
ˆxroot2expln( meta1 meta2 → meta' ) — x y → exp(ln(y)/x)
ˆexp2sincos( meta → meta' ) — Returns EXP of meta as EXP[RE]*[COS+i*SIN].

Infinity and Undefs

ˆ1metaundef#( meta → meta # ) — Tests presence of undef in meta. # is the posi- tion of undef.
ˆ2metaundef#( meta2 meta1 → meta2 meta1 # ) — Tests presence of undef in meta2 and meta1. # is the position of undef.
ˆmetaundef( → meta ) — Returns undef meta.
ˆ1metainf#( meta → meta # ) — Finds position of infinity in meta. Metas of length>2 are considered as finite meta. . Name Description
ˆ2metainf#( meta2 meta1 → meta2 meta1 # ) — Finds position of infinity in meta 2 and meta1. Metas of length>2 are considered as finite meta.
ˆmetainftype( meta → # ) — Returns infinity type: 1 for +infinity, 2 for - infinity or 0 for unsigned.
ˆunsignedinf( → meta ) — Returns unsigned infinty.
ˆplusinf( → meta ) — Returns plus infinty.
ˆNDROPplusinf( ob1..obn → meta ) — Replaces meta by plus infinty.
ˆminusinf( → meta ) — Returns minus infinty.
ˆNDROPminusinf( ob1..obn → meta ) — Replace meta by minus infinty.

Expansion and Simplification

ˆmetasimp( Meta → Meta ) — Simplifies a meta object. Non recursive ratio- nal simplification.
ˆDISTRIB*( meta → meta' T ) — ( meta → meta F ) Distribute *. Returns FALSE if no distribution done.
ˆDISTRIB/( meta → meta' T ) — ( meta → meta F ) Distribute /. Returns FALSE if no distribution done.
ˆMETASINEXPA( Meta → Meta' ) — Expands SIN.
ˆSINEXPA+( Meta → Meta' ) — Expands SIN(x+y).
ˆSINEXPA-( Meta → Meta' ) — Expands SIN(x-y).
ˆSINEXPA*( Meta → Meta' ) — Expands SIN(x*y). Expands if x or y is an in- teger.
ˆSINEXPA*1( Meta2 Meta1 → Meta' ) — Expands SIN(x*y). Meta1 is assumed to be an integer.
ˆMETACOSEXPA( Meta → Meta' ) — Expands COS.
ˆCOSEXPA+( Meta → Meta' ) — Expands COS(x+y).
ˆCOSEXPA-( Meta → Meta' ) — Expands COS(x-y).
ˆCOSEXPA*( Meta → Meta' ) — Expands COS(x*y).
ˆCOSEXPA*1( meta2 meta1 → Meta' ) — Expands COS(x*y). meta1 represents an inte- ger.
ˆMETAEXPEXPA( Meta → Meta' ) — Expands EXP.
ˆEXPEXPA+( Meta → Meta' ) — Expands EXP(x+y).
ˆEXPEXPA-( Meta → Meta' ) — Expands EXP(x-y).
ˆEXPEXPA*( Meta → Meta' ) — Expands EXP(x*y).
ˆEXPEXPANEG( Meta → Meta' ) — Expands EXP(-x).
ˆEXPEXPA*1( Meta2 meta1 → Meta' ) — Expands EXP(x*y). meta1 represents an inte- ger.
ˆMETALNEXPA( Meta → Meta' ) — Expands LN.
ˆLNEXPA*( Meta → Meta' ) — Expands LN(x*y).
ˆLNEXPA/( Meta → Meta' ) — Expands LN(x/y).
ˆLNEXPAˆ( Meta → Meta' ) — Expands LN(xˆy). . Name Description
ˆMETATANEXPA( meta → tan[meta] ) — Expands tan[meta].

Tests

ˆmetafraction?( Meta → Meta flag ) — Tests if meta is a fraction of integers.
ˆmetapi?( Meta → Meta# ) — Tests presence of π in a meta. # is the last occurence of π or 0.
ˆmetaCOMPARE( Meta2 Meta1 → Meta2 Meta1 # ) — Comparison of 2 meta. # =0 if undef # =1 if > # =2 if < # =3 if = Assumes generic situation, e.g. Xˆ2 > 0 in real mode. Look below STRICTmetaCOMPARE f
ˆSTRICTmetaCOMPARE( Meta2 Meta1 → Meta2 Meta1 # ) — Comparison of 2 meta. # =0 if undef # =1 if > # =2 if < # =3 if = Unlike metaCOMPARE it does not assume generic situation.
ˆmetareal?( meta → meta flag ) — Tests if IM[meta]==0.

Polynomials

114

Computation with Polynomials

ˆQAdd( o1 → o2+o1 ) — Adds two polynomials.
ˆRADDext( o2 o1 → o2+o1 ) — Internal +. This is the same entry as ˆQAdd.
ˆSWAPRADD( o2 o1 → o1+o2 ) — SWAP, then QAdd.
ˆQSub( o2 o1 → o2-o1 ) — Subtracts two polynomials.
ˆRSUBext( o2 o1 → o2-o1 ) — Internal -. This is the same entry as ˆQSub.
ˆSWAPRSUB( o2 o1 → o1-o2 ) — SWAP, then QSub.
ˆQMul( Q1 Q2 → Q ) — Multiplication of polynomials with extensions.
ˆRMULText( Q1 Q2 → Q ) — Multiplication of polynomials with extensions. This is the same entry as ˆQMul.
ˆSWAPRMULT( Q1 Q2 → Q ) — SWAP, then ˆQMul.
ˆQDiv( o2 o1 → o2/o1 ) — Internal /. . Name Description
ˆRDIVext( o2 o1 → o2/o1 ) — Internal /. This is the same entry as ˆQDiv.
ˆSWAPRDIV( o2 o1 → o1/o2 ) — SWAP, then QDiv.
ˆQMod( Q, Z → Q mod Z )
ˆRASOP( n1/d1 n2/d2 → d1*d2 n1*d2 n2*d1 ) — Used by RADDext and RSUBext for rational in- put.
ˆRP#( o2 # → o2ˆ# ) — Internal power (not for matrices).
ˆMPext( ob # prg* → obˆ# ) — General power with a specified multiplication program.
ˆRPext( o2 o1 → o2ˆo1 ) — Tries to convert o1 to an integer to call RP#, otherwise xˆext.
ˆDISTDIVext( P Q → quo mod T ) — ( P Q → P Q F ) Euclidean division. Assumes P and Q have in- teger coefficientes. Returns FALSE if sparse short division fails.
ˆPTAYLext( P, r → symb ) — Taylor for polynomials.
ˆCARCOMPext( Q1/Q2 → Q1'/Q2' ) — Extracts leading coefficients for the first vari- able from a rational polynomial.
ˆQDivRem( ob2 ob1 → quo mod ) — Polynomial Euclidean division of 2 objects. Dispatchs to DIV2LISText for list polynomi- als.
ˆDIV2LISText( Z0 l1 l2 → div mod ) — Euclidean division, l1 and l2 are list polynomi- als. Test first if l1=l2, then tries fast division, if it fails switch to SRPL division.
ˆPDIV2ext( A B → Q R ) — Step by step Euclidean division for univar poly.
ˆPSetSign( P1 P2 → sign[P2]*P1 ) — Sets sign of P1 according to leading coeff of P2.
ˆModExpa( Zn Fraction → Fraction modulo Zn )
ˆModAdd( Q1 Q2 Zn → Z ) — Modular addition. Z = Q1+Q2 (mod Zn).
ˆModSub( Q1 Q2 Zn → Z ) — Modular subtraction. Z = Q1-Q2 (mod Zn).
ˆModMul( Q1 Q2 Zn → Z ) — Modular multiplication. Z = Q1*Q2 (mod Zn).
ˆModDiv( Z1 Z2 Zn → Z ) — Modular division. Z = Z1/Z2 (mod Zn).
ˆModDiv2( Q1 Q2 Zn → quo mod mod' ) — Modular division. mod' = Q1 mod Q2 mod Zn. If Q1 and Q2 are integers, Q1 mod Q2 mod Zn is always 0.
ˆModInv( Z Zn → Z' ) — Modular inversion. Z' = INV(Z) (mod Zn). NONINTERR if GCD[Z,Zn] 6= 1 or if Z = 0 (other- wise the results would be unpredictable).
ˆModGcd( Q1 Q2 Zn → Q' ) — Modular GCD.

Factorization

ˆBerlekampP( P #prime → P F / P Lf #prime T ) — Berlekamp's algorithm for finding modular fac- tors of a univariate polynomial.
ˆBerlekamp( P → P F / P Lf #prime T ) — Berlekamp's algorithm for finding modular fac- tors of a univariate polynomial with a lead- ing frontend for finding linear factors faster. The input
ˆALG48FCTR?( P → [ meta cst_coeff TRUE | P FALSE ] ) — Factorizes square-free polynomial in Erable format.
ˆMFactTriv( P → meta-factor P' ) — Extracts all trivial power factors of P.
ˆCheckPNoExt( P → P flag ) — Checks that P does not contain any DOCOL (i.e. extensions).
ˆPPP( P → PP PC ) — Computes primitive polynomial and content of non-const P with respect to X1. The results are trimmed (provided P was).
ˆPFactor( P → Lfk Z ) — Does a complete factorization of P. The result is trimmed.
ˆPSqff( P → Lfk ) — Square-free and trivial factorization, including integer content, of P taken positive. Factors of same power are not necessarily merged or adjacent, b
ˆPHFctr( P → Lf ) — Heuristic factorization of polynomial taken positive. LAM FullFact? must be bound. If LAM FullFact? is TRUE, a full factorization is done. If it is FA
ˆPHFctr1( P → Lf ) — Heuristic factorization of primitive polyno- mial. LAM FullFact? must be bound. If TRUE, a full factorization is done. When FALSE, only a square-free
ˆPHFctr0( P → Lf ) — Heuristic factorization of primitive square-free non constant polynomial.
ˆP2P#( P → P' # ) — Extracts trivial power of poly. P must be a valid poly (if list, begin with a non zero coeff).
ˆDeCntMulti( R → L ) — Transforms list with count into simple list. R = { {f1 #k1} ... {fn #kn} } L = { f1 f1 .. fn fn }.
ˆDoLS( L S F → L' ) — Applies program F(Li,S) to every elem of L.
ˆPNFctr( Z → Lf ) — Factorization of positive integer as polynomial. Lf = {} if Z is 1 Lf = { {Z1 #k1} ... {Zn #kn} } o/w.
ˆPSQFF( P → Lsqff ) — Computes the square-free factorization of primitive P. The result is trimmed (provided P was).
ˆLiftZAdic( p z F → L ) — Lift n-1 z-adic factorization into n factoriza- tion.
ˆLFCProd( C L → C P ) — Calculates combination product.
ˆUFactor( P → Lf ) — Factorization of a square free primitive uni- variate polynomial.
ˆUFactor1( P → Lf ) — Factorization of a square free primitive uni- variate polynomial of degree > 2.
ˆMonicLf( Lfp p → Lfp' ) — Converts true modular factorization to monic factorization by dividing by the leading coeffi- cient of factor 1.
ˆDemonicLf( Lfp lc p → Lfp' ) — Converts monic modular factorization to true modular factorization by multiplying factor1 by lcoeff. . Name Description
ˆLiftLinear( #root1 .. #rootn #n → ) — Lifts modular roots of a polynomial to find lin- ear factors of a univariate polynomial. Lflin = list of found true factors Lfplin' = remaining linear
ˆLiftGeneral( → ) — Lifts factorization mod p to factorization mod pˆk where pˆk exceeds the factor bound for succesful true factor extraction. Assumes UFactor lambda var
ˆUFactorDeg2( P → Lf ) — Factorization of a degree 2 polynomial. Polyno- mial is univariate, square free and primitive.
ˆCombineFac( P Lfp p → Tf Tfp ) — Combines modular factors to true factors. P is the polynomial to factor, Lfp is the list of mod- ular factors, and p the modulo. The entry re- turns t
ˆCombProd( lc Lfp p Cb → F ) — Calculates modular combination.
ˆCombInit( #r → Cb ) — Inits modular combination list to value { 1 0 0 0 .. }.
ˆCombNext( Cb → Cb' flag ) — Gets next possible modular combination. As- sumes Cb is valid and is in tempob area.
ˆRmCombNext( Lf Cb → Lfrm Lf' Cb' flag ) — Removes next possible combination after a suc- cessful combination has been found, and re- move the used factors from the factor list.
ˆPFactTriv( P → P' Lf ) — Extracts all trivial power factors of P.
ˆVarFactor( P #var → P #n ) — Calculates what power of the given variable is a factor in P.
ˆPFactPowCnt( P → P Lk flag ) — Calculates trivial power factors in P. flag is TRUE if any of the powers is nonzero.
ˆPDivLk( P Lk → P' ) — Divides polynomial by its trivial powers.
ˆFEVIDENText( P → meta-fact cst coeff ) — Real mode: full factorization over the integer Complex mode: find all 1st order factors of P.

General Polynomial Operations

ˆONE{}POLY( ob → {ob} ob1 → Q ) — Replaces ONE{}N for polynomial building.
ˆTWO{}POLY( ob1 ob2 → Q ) — Replaces TWO{}N for polynomial building.
ˆTHREE{}POLY( ob1 ob2 ob3 → Q ) — Replaces THREE{}N for polynomial building.
ˆTWO::POLY( ob1 ob2 → :: ) — Replaces 2Ob>Seco for polynomial building.
ˆ::POLY( Meta → :: ) — Replaces ::N for polynomial building. As op- posed to the regular ::N code, we do pop the binary number. This is enforced by the entry to the common p
ˆ{}POLY( Meta → Q ) — Replaces {}N for polynomial building. As op- posed to the regular {}N code, we do pop the binary number. This allows us to enter the code here with fi
ˆ>POLY( Meta → Q ) — Builds polynomial.
ˆ>TPOLY( P ob → P' ) — Replaces >TCOMP for polynomial building. . Name Description
ˆ>HPOLY( P ob → P' ) — Replaces >HCOMP for polynomial building.
ˆ>TPOLYN( P ob1 .. obn #n → P' ) — Improved >TCOMP for polynomial building.
ˆ>HPOLYN( P ob1 .. obn #n → P' ) — Improved >HCOMP for polynomial building.
ˆMKPOLY( #n #k → P ) — Makes polynomial of nth variable to the power k.
ˆMAKEPROFOND( ob # → {{{...{o}...}}} ) — Embedds ob in the given number of lists.
ˆTRIMext( Q → Q' ) — Removes unnecessary zeros from polynomial.
ˆPTrim( ob → ob' ) — Trims polynomial.
ˆONE>POLY( Q → Q' ) — Increases variable depth. Constants (Z,Irr,C) are not modified.
ˆTCHEBext( zint → P ) — Tchebycheff polynomial. If zint>0 then 1st kind, if <0 then second kind.
ˆLRDMext( P # → [] ) — Left ReDiMension. Adds 0 to the left of polyno- mial to get a symbolic vector of lenght #+1.
ˆRRDMext( {} # → {} ) — Right ReDiMension: like LRDM but 0 at the right and {}.
ˆDEGREext( {} → degre ) — Degree of a list-polynomial.
ˆFHORNER( P/d r → P[X]_div_[X-r]/d r P[r]/d ) — Horner scheme.
ˆHORNext( P r → P[X]_div_[X-r] r P[r] ) — Horner scheme.
ˆMHORNext( P r → P[X]_div_[X-r] r P[r] ) — Horner scheme for matrices.
ˆLAGRANGEext( M → symb ) — Lagrange interpolation. Format of the matrix is [ [ x1 .. xn ] [ f(x1) .. f(xn) ] ] Returns a polynomial P such that P(xi)=f(xi)
ˆRESULTANT( P1 P2 → P ) — Resultant of two polynomials. Depth of P is one less than depth of P1 and P2.
ˆRESULTANTLP( res g h P1 P2 → +/-res g' h' P1' P2' ) — Subresultant algorithm innerloop.
ˆRESPSHIFTQ( P Q → P' ) — Resultant of P and Q shifted. gcd[Q(x- r),P(x)]!=1 equivalent to r root of P' P' has same depth than P and Q.
ˆADDONEVAR( P → P' ) — Adds one variable just below the main var. works for polynomial, not for fractions.
ˆSHRINKEVEN( P → P' ) — Changes var Y=Xˆ2 in an even polynomial.
ˆSHRINK2SYM( N D → N' D' ) — Shrinks 2 polynomials using symmetry proper- ties.
ˆSHRINKSYM( N → N' ) — Shrinks 1 polynomial using symmetry proper- ties. Degree of N must be even. If it is odd then N should be divided by X+1.
ˆSHRINK2ASYM( N D → N' D' ) — Shrinks 2 polynomials using antisymmetry properties.
ˆSHRINKASYM( N → N' ) — Shrinks 1 polynomial using antisymmetry properties. Degree of N must be even. If it is odd then N should be divided by X+1.
ˆPNMax( P → Z ) — Gets the coefficient of P with max norm.
ˆSWAPNDXF( Qden Qnom → symb ) — Builds a symbolic from rational polynomial. . Name Description
ˆNDXFext( Qnom Qden → symb ) — Builds a symbolic from rational polynomial.
ˆSWAPFXND( symb ob → ob Qnom Qden ) — Converts symbolic to rational polynomial.
ˆFXNDext( symb → Qnom Qden ) — Converts symbolic to rational polynomial.
ˆREGCDext( a b → d u v au+bv=d )
ˆEGCDext( a b → d u v au+bv=d ) — Bezout identity for polynomials.
ˆPEvalFast?( Z Pn → Z Pn F / Pn[Z] T ) — Attempts to evaluate Pn at X1=Z using fast register arithmetic. Fails if any of the follow- ing is true: Pn is not sunivariate; Z is polyno- mial afte
ˆFLAGRESULTANT( symb1 symb2 → symb ) — Resultant of two polynomials in symbolic form.

Tests

ˆUnivar?( P → P flag ) — Tests if polynomial is univariate.
ˆSUnivar?( P → P flag ) — Tests if polynomial is univariate and the coeffi- cients are bounded by register size.
ˆPOLYPARITY( poly → Z ) — Tests if a polynomial (internal rep) is even/odd/none. Z=1 if even, -1 if odd, 0 if neither even nor odd.
ˆPOLYSYM( P → Z ) — Tests symmetry of coefficients of polynomial. Z=1 for symmetric, -1 for anti, 0 otherwise.
ˆPOLYASYM( P → Z ) — Tests "antisymmetry" of coef of polynomial. Z=1 for symmetric, -1 for anti, 0 otherwise.

Root Finding

43

Root Finding and Numerical Solvers

ˆMULMULText( {} % → {}' ) — Multiplies multiplicities in a factor list by co- eff.
ˆMETAMM2( meta % → meta' ) — Multiplies by % all multiplicities of meta.
ˆCOMPLISText( {} → {}' )
ˆMETACOMPRIM( Meta → Meta' ) — Suppresses multiple occurrances of the same factor by adding corresponding multiplicities.
ˆMETACOMP1( f1...fk-1 mk-1 meta-res mk fk # → f1...fk-1 mk-1 meta-res )
ˆADDLISText( {} %n ob → {}' ) — Adds ob with multiplicity %n to the list. Checks if ob is in {}.
ˆDIVISext( ob → {divisors} ) — Returns list of divisors of ob.
ˆFACT1ext( symb-poly → Lvar Q {} ) — {} is the list of root/multiplicity of sym with respect to the current variable.
ˆFACTOext( symb → Lvar Q {} ) — {} is the list of factors/multiplicity of symb.
ˆZFACTO( C → {} C Lfact ) — . Name Description
ˆSOLVext( symb → {} ) — Numeric solver for univariate polynomials. The list contains the roots without multiplic- ity.
ˆFRND( ob → ob') ) — Float rounding for %%, C%% or list of either type. Used by SOLVext to reconstruct fac- tors.
ˆBICARREE?( P #5 → meta cst_coeff T ) — ( P #5 → P #5 F ) ( P # → P # F ) Searches if P is a bisquared 4-th order equa- tion. Returns a meta of factors and the mul- tiplying coeff in that ca
ˆREALBICAR( f1 #1 coef → meta rest T )
ˆIROOTS( P → list ) — Finds integer roots of a polynomial.
ˆEVIDENText( P → meta cst_coeff ) — Returns the roots of a polynomial P. Calls the numeric solver.
ˆEVIDSOLV( P → meta cst_coeff ) — Returns the roots of a 1st, 2nd order and some other poly. Calls the numeric solver if exact solving fails.
ˆDEG2ext( P → {} ) — Returns the roots of a 2nd order polynomial.
ˆMETADEG2( P → P meta ) — Returns the roots of a 2nd order polynomial. P must be of order 1 or 2.
ˆMETADEG1( P → P meta ) — Returns the roots of a 1st order polynomial. P must be of order 1.
ˆDEG1( f → r ) — Root of a first order factor. f is one level depth deeper than r.
ˆFDEG2ext( P → meta-fact cst_coef ) — Returns factors of a 2nd order polynomial and the corresponding multiplying coeffi- cient. tests for 1st order polynomial.
ˆRACTOFACext( r → n d ) — Converts root to factor. Factor is n/d, one level depth deeper than r.
ˆFACTORACext( f → r cst_coef ) — Converts a factor to a root, solving 1st or- der factor. f and cst_coef are one level depth deeper than r.
ˆRFACText( ob # → {} intob meta ) — {} is the list of variables. Meta is made of roots or factors of numerator (N) or denome- nator (D) or both (N/D), depending on #. ZERO for roots N/D;
ˆRFACT2ext( ob {} # → {} intob meta ) — Like RFACText, but the list of variables is given.
ˆRFACTSTEP3( ob → meta-fact ) — Partial square-free factorization w.r.t. the main variable. Extract trivial factors Etape 3 ob → meta-fact.
ˆRFACTSTEP5( %m on → add-to-meta-res ) — Factorization of a square-free polynomial.
ˆMETASOLV( pn cst_coeff → meta cst_coeff ) — Non-integer factorization (sqrt extensions and numeric). multiplicty is in LAM 5,.
ˆMETASOLV2( cst_coeff p → fr1 %m [fr2 %m] # cst_coeff ) — Returns roots/factors of 1st and 2nd order polynomials.
ˆMETASOLV4( cst1 f1 ... fk #k cst2 → fr1 %m ... frn %m #2k cst_coeff ) — Returns factors or convert to roots if needed. #k=1,2 or 4, fk are of order 1 or 2. . Name Description
ˆADDMULTIPL( meta cst_coeff → meta' cst_coeff ) — Adds multiplicities to a meta. Multiplicity is in LAM 5.
ˆFACTOOBJext( { fact mult } flag prg* prgˆ → ob ) — Rebuilds an object from its list of factors (flag=TRUE) or roots (flag=FALSE) using prg* to multiply and prgˆ to take multiplicity power.
ˆALG48MSOLV( Lp → Lidnt Lsol ) — Calculates Groebner basis multivar solution. LAM3 must be bound to Lvar and LAM4 to Lidnt.
ˆGMSOLV( Lp → meta-sol ) — Calculates Groebner basis multivar solu- tions. LAM1 must be bound to the num- ber of vars A solution is a list { o1 ... on } where #n=LAM1 ok embedde
ˆGBASIS( Lp → G ) — Calculate Groebner basis. G = { 1 } if no solutions G = { 0 } if identically true.
ˆGSOLVE( Lp → Lg ) — Calculate factorized Groebner basis. Lg = { Lg1 Lg2 .. Lgn } Lgi = independent solution (probably) Lg = {} if no solutions Lg = { { 0 } } if identical
ˆGFACTOR( Lp fctr? → Lg ) — Calculate Groebner basis or factorized Groeb- ner basis. Redundant bases are not removed.
ˆREDUCE( p G → q ) — Reduces polynomial with respect to given ba- sis.
ˆFASTREDUCE( r P → q T / r P F ) — Assembly version of REDUCE for polynomials with short coefficients. Returns FALSE if an overflow occurs during the reduction. As- sumes r is a genuine
ˆROOTM2ROOT( {}/V → V' ) — Transforms list of root/multiplicites to vector of roots.
ˆPASCAL_NEXTLINE( {} → {}' ) — Finds next line in the Pascal triangle.
ˆDELTAPSOLVE( Q → P ) — Solves P(x+1)-P(x)=Q(x). Internal polynomial function.

Calculus Operations

85

Limits and Series Expansion

ˆSYMTAYLOR( symb id %/z → symb ) — Taylor series expansion around point 0 (McLaurin's series) with regard to given vari- able, and of the given order.
ˆTRUNCDL( DL-l reste-l → truncated_DL ) — Series expansion truncation.
ˆLIMSERIES!( expression X=a|X %|zint → ) — a lim DL-l rest-l num-l/deno-l equiv-l lvar # Series expansion. #=1 for X=a-h or X=-1/h.
ˆLIMIT!( symb → DL-l reste-l num-l/deno-l equiv.-l lim. lvar flag ) — lim. = { symf direction }
ˆLIMSTEP1!( symb → { DL-l reste-l num-l/deno-l equiv.-l } flag )
ˆLIMLIM!( # lvar equiv-l → lvar lim )
ˆLIMCMPL!( reste-1-l reste-2-l → reste-l )
ˆLIMEQUFR!( n/d # → n/d-l equiv % )
ˆLIMEQU!( {} # → {} / {}-equiv-l {}-equiv-l { # # # } )
ˆLIM+-!( DL1...DLn #n op → DL flag ) — DL = { DL-l reste-l num-l/deno-l equiv-l }.
ˆLIMDIVPC!( #ordre num-l deno-l → num-l deno-l )
ˆLIMPROFEND!( num deno #prof → num deno )
ˆLIM%#!( num-l deno-l {%...%} → num-l' deno-l' #prof {%...%} )
ˆLIM#VARX!( lvar lvar → #varx )
ˆHORNEXP!( lim lvar X-l reste-l → lvar DL reste-l )
ˆVARCOMP!( var1 var2 → flag )
ˆVARCOMP32!( var → 0: )
ˆLIMVALOBJ!( ob lvar → symb )
ˆLIMVAL!( ob → coeff val )
ˆEQUIV!( {} lequiv → equiv ordre )
ˆLVARXNX2!( ob → ob lvarx lvarnx )
ˆFindCurVar( symb → symb ) — Sets a new current var if needed.
ˆLIMVAR!( symb → symb lvar )
ˆRISCH13( {}/{}' → {}'' ) — Assuming {}' has length 1, divides all elements of {} by this element. Used by RISCHext and by SERIES to have a nicer output of series.

Derivatives

ˆPDer( {} → der )
ˆDERIVext( ob id → ob' ) — ( ob sym → ob' ) ( ob V → V' ) Calculates the derivative of the object. For a list argument calculates the gradient with respect to the variables in t
ˆDERIVIDNT( ob id → ob' ) — Main entry point for derivative with respect to a identifier.
ˆDERIVIDNT1( ob → ob' ) — Main entry point for derivative with respect to the identifier stored in LAM1.
ˆDERIV( symb → symb' ) — Derivative of symb with respect to the vari- able stored in LAM1.
ˆMETADERIV( Meta → Meta' ) — Derivative of Meta object.
ˆMETADER&NEG( Meta → Meta' ) — Meta derivative and negate.
ˆMETADER+( Meta&+ → Meta' ) — Meta derivative of addition.
ˆMETADER-( Meta&- → Meta' ) — Meta derivative of subtraction.
ˆMETADER*( Meta&* → Meta' ) — Meta derivative of multiplication.
ˆMETADER/( Meta&/ → Meta' ) — Meta derivative of division.
ˆMETADERˆ( Meta&ˆ → Meta' ) — Meta derivative of power.
ˆMETADERFCN( Meta → Meta' ) — Meta derivative of a function.
ˆMETADERDER( symb_id_; sym_fcn_; xDER #3 → Meta' ) — Meta derivative of a derivative of a function.
ˆMETADERI4( Meta → Meta' ) — Meta derivative of a defined integral.
ˆMETADERI3( Meta → Meta' ) — Meta derivative of an undefined integral.
ˆMETADERIFTE( Meta → Meta' ) — Meta derivative of IFTE.
ˆMETADEREXP( Meta → Meta' ) — Meta derivative of EXP.
ˆMETADERLN( Meta → Meta' ) — Meta derivative of LN.
ˆMETADERLNP1( Meta → Meta' ) — Meta derivative of LNP1.
ˆMETADERLOG( Meta → Meta' ) — Meta derivative of LOG.
ˆMETADERALOG( Meta → Meta' ) — Meta derivative of ALOG.
ˆMETADERABS( Meta → Meta' ) — Meta derivative of ABS.
ˆMETADERINV( Meta → Meta' ) — Meta derivative of INV.
ˆMETADERNEG( Meta → Meta' ) — Meta derivative of NEG.
ˆMETADERSQRT( Meta → Meta' ) — Meta derivative of SQRT.
ˆMETADERSQ( Meta → Meta' ) — Meta derivative of SQ.
ˆMETADERSIN( Meta → Meta' ) — Meta derivative of SIN.
ˆMETADERCOS( Meta → Meta' ) — Meta derivative of COS.
ˆMETADERTAN( Meta → Meta' ) — Meta derivative of TAN.
ˆMETADERSINH( Meta → Meta' ) — Meta derivative of SINH.
ˆMETADERCOSH( Meta → Meta' ) — Meta derivative of COSH.
ˆMETADERTANH( Meta → Meta' ) — Meta derivative of TANH.
ˆMETADERASIN( Meta → Meta' ) — Meta derivative of ASIN.
ˆMETADERACOS( Meta → Meta' ) — Meta derivative of ACOS.
ˆMETADERATAN( Meta → Meta' ) — Meta derivative of ATAN.
ˆMETADERASH( Meta → Meta' ) — Meta derivative of ASINH.
ˆMETADERACH( Meta → Meta' ) — Meta derivative of ACOSH. . Name Description
ˆMETADERATH( Meta → Meta' ) — Meta derivative of ATANH.
ˆDERARG( meta-symb → arg1 ... argk der1 ... derk #k op ) — Finds derivative of arguments.
ˆpshder*( Meta1 Meta2 → Meta2&Meta1'&* ) — Meta derivative utility.
ˆSQRTINVpshd*( Meta1 Meta2 → Meta2&SQRT&INV&Meta1'&* ) — Meta derivative utility.

Integration

ˆODE_INT( symb idnt → symb ) — Integration with addition of a constant.
ˆIBP( u'*v u → u*v -u*v' ) — Internal integration by parts. If u is a constant return INTVX(u'*v)+u. If stack 2 is a list it must be of the form { olduv u'*v } then olduv will be
ˆPREVALext( symb inf sup x → symb|x=sup - symb|x=inf ) — Evaluates an antiderivative between 2 bounds Does not check for discontinuities of symb in this interval.
ˆWARNSING( symb inf sup vx → symb inf sup vx ) — Warns user for singularity.
ˆINText( symb x → int[$,x, symb, xt] ) — Return unevaluated integral.
ˆINT3( f(x) x y → F(y) where F'=f ) — Undefined integration. No limit for underdeter- mined form.
ˆINTEGRext( {} → prim )

Partial Fractions

ˆPARTFRAC( o → symb ) — Partial fraction expansion of o with respect to the current variable.
ˆINPARTFRAC( o list → symb ) — Partial fraction expansion of o. lvar must be bound to LAM2, list is =lvar if o is in external format. list is NULL{} if o is still in internal for- m

Differential Equations

ˆDESOLVE( list symb1 → list_sols ) — ( symb symb1 → list_sols ) Solves ordinary differential equation. For some ode's returned level2 is not symb1.
ˆLDECSOLV( 2nd_member char_eq → solution ) — Linear differential equation with constant coef- ficients.
ˆLDEGENE( eq. carac → sol generale )
ˆLDEPART( 2nd membre, eq carac → eq. carac, sol part )
ˆLDSSOLVext( V M → V' ) — M is the matrix of the system. V is the vector of the 2nd members.
ˆODETYPESTO( type → ) — Store ode type in variable ODETYPE. . Name Description
ˆODE_SEPAR( symb → symb symb-y symb-x T ) — ( symb → symb F ) Tries to separate symb as a product of a function of y and a function of x.

Laplace Transformation

ˆLAPext( symb → symb' ) — Laplace transform for polynomial*exp/sin/cos. Re- turns LAP() for unknown transforms.
ˆILAPext( symb → symb' ) — Inverse Laplace transform for rational fractions. Delta functions for the integral part.
ˆILAPEXP( ck rk → ck*exp[rk*x] )

Summation

16

Reference

ˆSUM( sym idnt → sym ) — Internal SUM. The variable can be specified.
ˆSUMVX( sym → sym ) — Internal SUMVX. Works always with respect to the current variable.
ˆRATSUM( sym → sym ) — Discrete rational sum.
ˆFTAYL( f shift → f' ) — Taylor shift for rational fractions.
ˆCSTFRACTION?( ob → ob flag ) — Taylor shift for rational fractions. Returns TRUE if ob is a cst fraction.
ˆHYPERGEO( symb → symb ) — Tests and does hypergeometric summation.
ˆNONRATSUM( z/symb → symb ) — Discrete summation (hypergeometric case).
ˆmeta_cst?( meta → meta flag ) — Tests for meta to be cst with respect to cur- rent var.
ˆZEILBERGER( f(n,k) n k d → C T ) — ( f(n,k) n k d → F ) Zeilberger algorithm * NOT IMPLE- MENTED YET*. . Name Description
ˆSYMPSI( sym → Psi(x) ) — Digamma function.
ˆSYMPSIN( sym int → Psi(x,n) ) — Digamma function.
ˆ%%PSI( %%x → %% ) — Digamma function.
ˆIBERNOULLI( #/zint → Q ) — Bernoulli numbers.
ˆNDEvalN/D( num deno n d → num' deno' ) — Evals list poly over a list fraction.
ˆPEvalN/D( P n d → num d # ) — Evals list poly over a list fraction.
ˆvgerxssSYMSUM( Meta2 Meta1 → meta ) — Symbolic sum with tests for two zints. lam'sumvar bound to 'id/lam' and lam'sumexpr to 'expr'.

Modular Operations

51

Modulo Operations

ˆFLAGFACTORMOD( symb → symb ) — FACTOR modulo.
ˆMFACTORMOD( M → M' ) — FACTOR modulo for amtrices.
ˆLIFCext( {contfrac} → fraction ) — Converts continued fraction to rational.
ˆPEvalMod( Q Z Zn → Q' ) — Computes value of polynomial mod Zn.
ˆQAddMod( Q1 Q2 Zn → Q' ) — Polynomial addition modulo Zn.
ˆQSubMod( Q1 Q2 Zn → Q' ) — Polynomial subtraction modulo Zn.
ˆQMulMod( Q1 Q2 Zn → Q' ) — Polynomial multiplication modulo Zn.
ˆQDivMod( Q1 Q2 Zn → Qquo Qrem ) — Polynomial division modulo Zn. In regular di- vision the coefficients in the remainder can increase very quickly to tens of digits, thus it is importa
ˆQInvMod( Q Zn → Q' ) — Polynomial inversion modulo Zn.
ˆQGcdMod( Q1 Q2 Zn → Q' ) — Polynomial GCD modulo Zn for univariate polynomials. The result is made monic.
ˆISOL1( symb id → id symb' )
ˆISOLALL( symb id → id {} ) — Internal SOLVE.
ˆISOL2ext( symb id → symb' ) — ( symb id → {} ) Like ISOL1 if isolflag is set. Otherwise re- turns the list of all found solutions.
ˆBEZOUTMSOLV( Lpoly Lidnt → Lidnt sols ) — If no extension in Lpoly, calls ALG48 GSOLVE Otherwise, solves by Bezout "Gaussian" elim- ination. In the latter case, if system seems underdetermined
ˆROOT{}N( meta of roots → list of roots ) — Drops tagged roots.
ˆMHORNER( poly-l {r1...rk} # → P[r1...rk] ) — Top-level call. Poly-l might be a matrix.
ˆMHORNER1( P { r } → P[..r..] )
ˆSQFFext( Q → { F1 mult1 .. Fn multn } )
ˆMSQFF( Q → F1 mult1 .. Fn multn #2n ) — Full square-free factorization of object. The result is given as a Meta object.
ˆ%1TWO( ob → ob %1 #2 ) — Square free factorization of unknown (?) ob- ject. See MSQFF.
ˆMZSQFF( Z → Z1 mult1 .. Zn multn #2n ) — Full factorization of an integer.
ˆMZSQFF1( Meta curfac %n newfac T → Meta curfac %n+1 ) — ( Meta curfac %n newfac F → Meta' newfac %1 ) Adds integer factor to factor list. If the factor is the same as the last time, only the multiplicity is
ˆMLISTSQFF( P → Meta ) — Full square-free factorization of a polynomial with a recursive call on the GCD of all coeffi- cients.
ˆMETASQFFext( P-list → S1 %1 ..Se-1 %e-1 %e ee Te Re ) — Square-free factorization.
ˆLIDNText( ob → {} ) — Gets list of all ids present in ob.
ˆLVARXNXext( symb → symb x lvarnx lvarx ) — Finds variable of symb depending on current variable and other variable. Using LVAR is impossible here because of sqrt.
ˆISPOLYNOMIAL?( ob → flag ) — Returns TRUE if symb is polynomial with re- spect to current variable.
ˆ2POLYNOMIAL?( symb1 symb2 → symb1 symb2 flag ) — Returns TRUE if symb1 and symb2 are poly- nomial with respect to current variable.
ˆVXINDEP?( symb → symb flag ) — Returns TRUE if symb is independent of cur- rent variable.
ˆRLVARext( ob → {} ) — Recursive search of all variables.
ˆLLVARDext( o → #depth o lvar )
ˆVXLVARext( symb → symb lvar )
ˆLVARext( ob → ob {} ) — List of variables. Square roots are included in the list of rational operators. . Name Description
ˆVX>LVARext( ob → ob {} ) — Like LVARext but the current variable is added using >HCOMP. Square roots are in- cluded in the list of rational operators.
ˆVX>( {} → {}' ) — If VX is in the list then moves it to the begin- ning of the list. Otherwise does nothing.
ˆVX!( {} → {} ) — If VX is in the list then moves it at the begin- ning. Otherwise VX is added to the beginning of the list.
ˆLIDNTLVAR( symb lidnt → symb lidnt lvar ) — lvar is the list of variables in symb, but ele- ments of lidnt are moved to the beginning of lvar.
ˆLISTOPRAC( → {} ) — Returns the list of rational operator with sqrt appended to the list.
ˆLISTOPext( → {} ) — List of basic "rational" operators without square root.
ˆLISTOPSQRT( → {} ) — List of basic "rational" operators with square root.
ˆLVARDext( ob listop → lidnt ) — ( Meta listop → lidnt ) Determines list of variables in ob (or Meta) using the given list of basic "rational" opera- tors.
ˆDEPTHext( ob → # ) — Returns the max number of embedded lists in ob.
ˆDEPTHOBJext( objet # → depth )
ˆTRIMOBJext( ob → ob ' ) — Trims object.
ˆNEWTRIMext( Q → Q ) — Recursively tests if Q is a list of one con- stant element. This is much faster than TRIMOBJext and sufficient for the output of programs which are tr
ˆ>POLYTRIM( meta → {} ) — Equivalent to {}POLY TRIMOBJext.
ˆELMGext( ob → ob' ) — Trims small numbers (less than epsilon).
ˆIsV>V?( v1 v2 → flag ) — Returns TRUE if v1 is lexicographically after v2.
ˆPZadic( Q Z → Q' )
ˆLISTMAXext( P → P Z T depth ) — ( P → P ? F #0 ) Step 1 for gcdheu: Returns FALSE if gcd- heu can not be applied (e.g. if P contains irrquads). Returns TRUE otherwise, Z is the max o
ˆGCDHEUext( A B → a b c pr[pgcd] A'/G' B'/G' flag ) — Heuristic GCD.

Sign Tables

23

Reference

ˆSIGNE( symb → sign ) — Compute the sign table of the expression with respect to the current variable. Internal ver- sion of the UserRPL command SIGNTAB.
ˆSIGNE1ext( expr → sign ) — Sign table of a polynomial or rational expres- sion.
ˆSIGNUNDEF( → sign ) — Returns undefined sign table.
ˆSIGNPLUS( → sign ) — Returns always positive sign table.
ˆSIGNMOINS( → sign ) — Returns always negative sign table.
ˆSIGNELN( sign → sign ) — Returns ln of a sign table.
ˆSIGNEEXP( sign → sign' ) — Returns exp of a sign table.
ˆSIGNESIN( sign → sign' ) — Returns sin of a sign table.
ˆSIGNECOS( sign → sign' ) — Returns cos of a sign table.
ˆSIGNETAN( sign → sign' ) — Returns tan of a sign table.
ˆSIGNEATAN( sign → sign' ) — Returns atan of a sign table.
ˆSIGNESQRT( sign → sign' ) — Returns sqrt of a sign table.
ˆSUBSIGNE( sign min max → sign' ) — Truncates a sign table.
ˆSIGNERIGHT( sign ob → sign' ) — Places ob at the end of a sign table.
ˆSIGNELEFT( sign ob → sign' ) — Places ob at the beginning of a sign table.
ˆ>SIGNE( sign → sign' ) — Prepends { -infinity ? } to a sign table.
ˆSIGNE>( sign → sign' ) — Appends { ? +infinity } to a sign table.
ˆSIGNMULText( sign1 sign2 → sign' ) — Multiplies two sign tables.
ˆPOSITIFext( ob → ob flag ) — Tries to determine if ob is positive. In internal representation, this depends on increaseflag so that x-1 is positive if increaseflag is cleared, neg
ˆZSIGNECK( ob → ob flag ) — Returns sign of an expression. Error if unable to find sign. . Name Description
ˆZSIGNE( ob → zint ) — Returns sign of an expression. zint=1 for +, -1 for -, 0 for undef. Expression does not need to be polynomial/rational.
ˆzsigne( meta → zint ) — Returns sign of a meta symbolic. zint=1 for +, -1 for -, 0 for undef. Expression does not need to be polynomial/rational.
ˆCHECKSING( symb inf sup vx → symb inf sup vx flag ) — Checks for singularities in expr.

Errors

4

Reference

ˆERABLEERROR( # → ) — Calls CAS Error.
ˆGETERABLEMSG( # → $ ) — Get string in erable messages table. 090006 ˆErrInfRes Error 305h Generates "Infinite Result" error. 091006 ˆErrUndefRes Error 304h Generates "Undefin
ˆERR$EVALext( seco → action )
ˆSys1IT( ob → ) — Execute object if display flag is set.

CAS Configuration

50

Reference

ˆCFGDISPLAY( → ) — Display current configuration of the CAS.
ˆNEWVX( → ) — Input new current variable from the user.
ˆNEWMODULO( → ) — Input new modulo from the user.
ˆSWITCHON( #flag → ) — Asks the user if a certain mode may be switched on by toggling system flag #flag. Er- rors if the user does not want to switch.
ˆSWITCHOFF( #flag → ) — Asks the user is a certain mode may be switched off by toggling system flag #flag. Er- ror if the user does not want to switch.
ˆFLAGNAME( # → # $ ) — Find the name of a flag.
(ˆPUSHFLAGS)( → ) — Internal version of User PUSH command: stores the current flag settings and path in the CASDIR/ENVSTK variable. . Name Description
(ˆPOPFLAGS)( → ) — Internal version of User POP command: pops the last pushed flag settings and path from the CASDIR/ENVSTK variable.
ˆCOMPLEXON( → ) — Turns complex mode on. Depending on sys- tem flag 120, the user is asked first.
ˆCOMPLEXOFF( → ) — Turns complex mode off. Depending on sys- tem flag 120, the user is asked first.
ˆEXACTON( → ) — Turns exact mode on. Depending on system flag 120, the user is asked first.
ˆEXACTOFF( → ) — Turns exact mode off. Depending on system flag 120, the user is asked first.
ˆCOMPLEXMODE( → ) — Set complex mode, refresh configuration dis- play.
ˆSETCOMPLEX( → ) — Set complex mode.
ˆCOMPLEX?( → flag ) — Test complex mode.
ˆREALMODE( → ) — Set real mode, refresh configuration display.
ˆCLRCOMPLEX( → ) — Set real mode.
ˆEXACTMODE( → ) — Set exact mode, refresh configuration display.
ˆSETEXACT( → ) — Set exact mode and gcd mode.
ˆNUMMODE( → ) — Set numeric mode, refresh configuration dis- play.
ˆCLREXACT( → ) — Clear exact mode.
ˆEXACT?( → flag ) — Test exact mode.
ˆSTEPBYSTEP( → ) — Set step by step flag, refresh display.
ˆNOSTEPBYSTEP( → ) — Clear step by step flag, refresh display.
ˆVERBOSEMODE( → ) — Set verbose mode, refresh configuration dis- play.
ˆSILENTMODE( → ) — Set silent mode, refresh configuration dis- play.
ˆRECURMODE( → ) — Set recursive mode, refresh configuration dis- play.
ˆNONRECMODE( → ) — Set nonrecursive mode, refresh configuration display.
ˆPLUSAT0( → ) — Set positive mode, refresh configuration dis- play.
ˆSETPLUSAT0( → ) — Set positive mode.
ˆPLUSATINFTY( → ) — Set positive infinity mode, refresh configura- tion display.
ˆCLRPLUSAT0( → ) — Set positive infinity mode.
ˆSPARSEDATA( → ) — Set full data mode, refresh configuration dis- play.
ˆFULLDATA( → ) — Set sparse mode, refresh configuration dis- play.
ˆRIGORMODE( → ) — Set rigorous mode, refresh configuration dis- play.
ˆSLOPPYMODE( → ) — Set sloppy mode, refresh configuration dis- play. . Name Description
ˆSLOPPY?( → flag ) — Test sloppy mode.
ˆSAVECASFLAGS( → ) — Saves CAS flags and current var.
ˆRESTORECASFLAGS( → ) — Restore CAS flags and current var.
ˆCASFLAGEVAL( → ) — Execute next runstream object with flag pro- tection.
ˆRCLMODULO( → Z ) — Fetch MODULO from the home directory.
ˆRCLPERIOD( → sym ) — Fetch PERIOD from the home directory.
ˆRCLVX( → id ) — Fetch VX from home directory.
ˆSTOVX( ob → ) — Store object in VX.
ˆSTOMODULO( ob → ) — Store object in MODULO.
ˆRCLEPS( → % ) — Fetch EPS from home directory.
ˆISIDREAL?( id → id id T ) — ( id → id F ) Test if id is in the REALASSUME list.
ˆADDTOREAL( id → ) — Add idnt to the list of real var.
ˆRESETCASCFG( → ) — Reset CAS config.
ˆVERNUMext( → %version ) — CAS version number.

CAS Menus

13

Reference

ˆMENUXYext( #2 #1 → {} ) — Make list of Erable commands between the given numbers.
ˆMENUext( $6...$1 → ) — If the CAS quiet flag is not set, displays the six strings as menu keys. Otherwise does nothing.
ˆMENUCHOOSE?( → prg flag ) — Return best CHOOSE command.
ˆMENUCHOOSE( {} → ) — Offers a selection to the user. If Flag -117 is set, only installs a menu. If not, offer a CHOOSE box.
ˆMENUGENE1( → {} ) — Menu for CAS.
ˆMENUBASE1( → {} ) — Base algebra menu.
ˆMENUCMPLX1( → {} ) — Complex operations menu.
ˆMENUTRIG1( → {} ) — Trigonometric operations menu.
ˆMENUMAT1( → {} ) — Matrix operations menu. . Name Description
ˆMENUARIT1( → {} ) — Arithmetic operations menu.
ˆMENUSOLVE1( → {} ) — Solver menu.
ˆMENUEXPLN1( → {} ) — Exponential and logarithmic operations menu.
ˆMENUDIFF1( → ) — Differential calculus menu.

Internal Versions of User RPL

93

Reference

ˆISPRIME( z/% → %0/%1 ) — Internal ISPRIME.
ˆFLAGEXPAND( symb → symb' ) — Internal xEXPAND. Expands symbolic expres- sion.
ˆFLAGFACTOR( symb → symb' ) — ( z → symb ) Internal xFACTOR. Factors symbolic or num- ber.
ˆFLAGLISTEXEC( symb {} → symb' ) — Internal xSUBST for the case that level 1 is an array or a matrix.
ˆFLAGSYMBEXEC( symb symb' → symb'' ) — Internal xSUBST for the case that level 1 is a symbolic.
ˆFLAGIDNTEXEC( symb id → symb' ) — Internal xSUBST for the case that level 1 is an id or a lam.
ˆFLAGINTVX( symb → symb' ) — Internal xINTVX. . Name Description
ˆDERVX( symb → symb' ) — Internal xDERVX.
ˆSOLVEXFLOAT( % → {} ) — Internal xSOLVEVX for a float.
ˆSYMLIMIT( symb symb' → symb'' ) — Internal xLIMIT for scalars.
ˆFLAGMATRIXLIMIT( [] symb → []' ) — Internal xLIMIT for matrices.
ˆTAYLOR0( symb → symb' ) — Internal xTAYLOR0.
ˆFLAGSERIES( symb id z → {} symb' ) — Internal xSERIES.
ˆPLOTADD( symb → ) — Internal xPLOTADD.
ˆFLAGIBP( symb1 symb2 → symb3 symb4 ) — Internal xIBP.
ˆFLAGPREVAL( symb1 symb2 symb3 → symb4 ) — Internal xPREVAL. Evaluates symb1 at the points symb2 and symb3 and takes the dif- ference.
ˆMATRIXRISCH( [] id → symb' ) — Internal xRISCH for matrix arguments.
ˆFLAGRISCH( symb id → symb' ) — Internal xRISCH for non-matrix argumetns.
ˆFLAGDERIV( symb id → symb' ) — Internal xDERIV.
ˆFLAGLAP( symb → symb' ) — Internal xLAP.
ˆFLAGILAP( symb → symb' ) — Internal xILAP.
ˆFLAGDESOLVE( symb symb' → symb'' ) — Internal xDESOLVE.
ˆFLAGLDSSOLV( symb1 symb2 → symb3 ) — Internal xLDEC.
ˆFLAGTEXPAND( symb → symb' ) — Internal xTEXPAND.
ˆFLAGLIN( symb → symb' ) — Internal xLIN.
ˆFLAGTSIMP( symb → symb' ) — Internal xTSIMP.
ˆFLAGLNCOLLECT( symb → symb' ) — Internal xLNCOLLECT.
ˆFLAGEXPLN( symb → symb' ) — Internal xEXPLN.
ˆFLAGSINCOS( symb → symb' ) — Internal xSINCOS.
ˆFLAGTLIN( symb → symb' ) — Internal xTLIN.
ˆFLAGTCOLLECT( symb → symb' ) — Internal TCOLLECT.
ˆFLAGTRIG( symb → symb' ) — Internal xTRIG.
ˆFLAGTRIGCOS( symb → symb' ) — Internal xTRIGCOS.
ˆFLAGTRIGSIN( symb → symb' ) — Internal xTRIGSIN.
ˆFLAGTRIGTAN( symb → symb' ) — Internal xTRIGTAN.
ˆFLAGTAN2SC( symb → symb' ) — Internal xTAN2SC.
ˆFLAGHALFTAN( symb → symb' ) — Internal xHALFTAN.
ˆFLAGTAN2SC2( symb → symb' ) — Internal xTAN2SC2.
ˆFLAGATAN2S( symb → symb' ) — Internal xATAN2S.
ˆFLAGASIN2T( symb → symb' ) — Internal xASIN2T.
ˆFLAGASIN2C( symb → symb' ) — Internal xASIN2C.
ˆFLAGACOS2S( symb → symb' ) — Internal xACOS2S.
ˆSTEPIDIV2( z1 z2 → z3 z4 ) — Internal xIDIV2.
ˆFLAGDIV2( symb1 symb2 → symb3 symb4 ) — Internal xDIV2. . Name Description
ˆFLAGGCD( symb1 symb2 → symb3 ) — Internal xGCD for the case with two symbol- ica arguments.
ˆPEGCD( symb1 symb2 → symb3 symb4 symb5 ) — Internal xEGCD for polynomials.
ˆABCUV( symb1 symb2 symb3 → symb4 symb5 ) — Internal polynomial xABCUV.
ˆIABCUV( z1 z2 z3 → z4 z5 ) — Internal integer xIABCUV.
ˆFLAGLGCD( {} → {} symb ) — Internal xLGCD.
ˆFLAGLCM( symb1 symb2 → symb3 ) — Internal xLCM.
ˆFLAGSIMP2( symb1 symb2 → symb3 symb4 ) — Internal xSIMP2.
ˆFLAGPARTFRAC( symb → symb' ) — Internal xPARTFRAC.
ˆFLAGPROPFRAC( symb → symb' ) — Internal xPROPFRAC.
ˆFLAGPTAYL( P(X) r → P(X+r) ) — Internal xPTAYL.
ˆFLAGHORNER( symb1 symb2 → symb3 symb4 symb5 ) — Internal xHORNER.
ˆEULER( z → z' ) — Internal xEULER.
ˆFLAGCHINREM( A1 A2 → A3 ) — Internal xCHINREM.
ˆICHINREM( A1 A2 → A3 ) — Internal xICHINREM.
ˆSOLVE1EQ( symb id → {} ) — Internal xSOLVE for single equations.
ˆSOLVEMANYEQ( [] []' → {}'' ) — Internal xSOLVE for arrays of equations.
ˆZEROS1EQ( symb id → {} ) — Internal xZEROS for single equations.
ˆZEROSMANYEQ( [] []' → {} ) — Internal xZEROS for arrays of equations.
ˆFCOEF( [] → symb ) — Internal xFCOEF.
ˆFROOTS( symb → [] ) — Internal xFROOTS.
ˆFACTORS( symb → {} ) — Internal xFACTORS.
ˆDIVIS( symb → {} ) — Internal xDIVIS.
ˆrref( M → A M' ) — Internal xrref.
ˆMADNOCK( M → symb1 []' []'' symb3 ) — Internal xMAD.
ˆSYSTEM( [] []' → []'' {} []''' ) — Internal xLINSOLVE.
ˆVANDERMONDE( {} → M ) — Internal xVANDERMONDE.
ˆHILBERTNOCK( z → M ) — Internal xHILBERT.
ˆCURL( [exprs] [vars] → [] ) — Internal xCURL.
ˆDIVERGENCE( [exprs] [vars] → symb ) — Internal xDIV.
ˆLAPLACIAN( [expr] [vars] → symb ) — Internal xLAPL.
ˆHESSIAN( symb A → M A' A'' ) — Internal xHESS.
ˆHERMITE( z → symb ) — Internal xHERMITE.
ˆTCHEBNOCK( %degree → symb ) — Internal xTCHEBYCHEFF.
ˆLEGENDRE( z → symb ) — Internal xLEGENDRE.
ˆLAGRANGE( A → symb ) — Internal xLAGRANGE.
ˆFOURIER( symb z → C% ) — Internal xFOURIER. . Name Description
ˆTABVAR( symb → symb {{}} grob ) — Internal xTABVAR.
ˆFLAGDIVPC( symb1 symb2 z → symb3 ) — Internal xDIVPC.
ˆFLAGTRUNC( symb1 symb2 → symb3 ) — Internal xTRUNC.
ˆFLAGSEVAL( symb → symb' ) — Internal xSEVAL.
ˆXNUM( symb → symb' ) — Internal xXNUM.
ˆREORDER( symb id → symb' ) — Internal xREORDER.
ˆUSERLVAR( symb → symb [] ) — Internal xLVAR.
ˆUSERLIDNT( symb → [] ) — Internal xLNAME.
ˆADDTMOD( symb1 symb2 → symb3 ) — Internal xADDTMOD for scalars.
ˆMADDTMOD( M M' → M'' ) — Internal xADDTMOD for matrices.
ˆSUBTMOD( symb1 symb2 → symb3 ) — Internal xSUBTMOD for scalars.
ˆMSUBTMOD( M M' → M'' ) — Internal xSUBTMOD for matrices.
ˆMULTMOD( symb1 symb2 → symb3 ) — Internal xMULTMOD.

Miscellaneous

115

Verbose Mode Display Routines

ˆVerbose1( $ → ) — Display message on line 1 if verbose mode on.
ˆVerbose2( $ → ) — Display message on line 2 if verbose mode on.
ˆVerbose3( $ → ) — Display message on line 3 if verbose mode on.
ˆVerboseN( $ # → ) — Display message on given line if verbose mode on.

Evaluation

ˆEvalNoCKx*( ob ob' → ob'' )
ˆEvalNoCKx+( ob ob' → ob'' )
ˆEvalNoCKx-( ob ob' → ob'' )
ˆEvalNoCKx/( ob ob' → ob'' )
ˆEvalNoCKxˆ( ob ob' → ob'' )
ˆEvalNoCKxCHS( ob → ob' )
ˆEvalNoCKxINV( ob → ob' )
ˆEvalNoCKxMOD( ob ob' → ob'' ) — . Name Description
ˆEvalNoCKxPERM( ob ob' → ob'' )
ˆEvalNoCKxCOMB( ob ob' → ob'' )
ˆEvalNoCKxOR( ob ob' → ob'' )
ˆEvalNoCKxAND( ob ob' → ob'' )
ˆEvalNoCKxXOR( ob ob' → ob'' )
ˆEvalNoCKxXROOT( ob ob' → ob'' )
ˆTABVALext( fnct x {} → {}' ) — Table of values.

Conversion

ˆTOLISText( o1..on #n → Lvar Q1..Qn ) — Convert meta of symbolic objects to internal form.
ˆFROMLISText( Lvar Meta L → L' ) — Conversion of elements of Meta objec to user format. Meta does not contain the #n number of element. L is the list of depth of the elements of Meta. F

Qpi

ˆQPI( ob → ob' ) — Internal xXQ.
ˆQpiZ( ob → symb ) — Calls ˆQpi% and converts the resulting (real) inte- gers into zints.
ˆQpiSym( symb → symb' ) — Internal xXQ for symbolics.
ˆQpiArry( [] → []' ) — Internal xXQ for arrays. Converts each element of the array.
ˆQpiList( {} → {}' ) — Internal xXQ for lists. Converts each element of the list.
ˆQpi( %/C% → symb ) — Internal xXQ for real and complex numbers.
ˆQpi%( % → symb ) — xXQ for reals, but does not convert numbers to zints.
ˆGetRoot( %' → %' %'' ) — Tries to find a square number which is a factor of the argument. The algorithm only tries num- bers smaller than 1024ˆ2-1 and assumes that % is an int
ˆApprox( % → %' %'' ) — Approximates a real number with a fraction. Re- turns numerator %' and denominator %''. The ac- curacy of the approximation is determinated by the cur

Infinity

ˆINFINIext( → '∞' )
ˆMINUSINFext( → '-∞' )
ˆPLUSINFext( → '+∞' ) — 2E5006 ˆ?ext '?' Pushed the undefined symbolic.
ˆPOSINFext( symb → symb # ) — Returns #1 if the symbolic contains '∞'.
ˆTESTINFINI( ob → ob flag ) — Test if object contains infinity. . Name Description
ˆPOSUNDEFext( symb → symb # ) — Returns #1 if the symbolic contains the unde- fined symbolic '?'.

Built-In Constants

ˆpi( → 'π' )
ˆmetapi( → π #1 )
ˆmeta-pi( → π xNEG #2 )
ˆpisur2( → 'π/2' )
ˆmetapi/2( → π 2 x/ #3 )
ˆpisur-2( → '-π/2' )
ˆmeta-pi/2( → π 2 x/ xNEG #4 )
ˆmetapi/4( → π 4 x/ #3 )
ˆmeta-pi/4( → π 4 x/ xNEG #4 )
ˆpifois2( → '2*π' )
ˆ'xPI( → xPI )
ˆbase_ln( → 'e' )
ˆmeta_e( → e #1 )
ˆ'xi( → xi )
ˆmetai( → i #1 )
ˆipi( → 'i*π' )
ˆmetaipi( → i π x* #3 )
ˆmetapi*2( → π 2 x* #3 )
ˆdeuxipi( → '2*i*π' )

List Application

ˆDIVOBJext( {o1...on} ob → {o1/ob...on/ob} ) — Division of all elements of a list by ob. Tests if ob=1.
ˆLOPDext( {o1...on} ob → {o1/ob...on/ob} ) — LOPDext calls QUOText for the division, unlike DIVOBJ which calls RDIVext.
ˆLOP1ext( {} ob binop → {}' ) — Applies non-recursively << ob binop >> to the elements of the list.
ˆLOPAext( {} ob binop → {}' ) — Applies recursively << op binop >> to the el- ements of the list (not the list elements them- selves).
ˆLOPMext( ob {} → {}' ) — Multiplies each element of the list by the given object.
ˆLISTEXEC( ob {} → ob' ) — ( ob {} → {}' ) The list should be of the form { 'X=1' 'Y=2' ... } in the first case or { 'X=1' 'X=2' } in the sec- ond case. In the first case, all o
ˆLISTEXEC1( {} objet → {}' )
ˆSECOEXEC( {} prog → {} ) — Executes prog on each element of ob.
ˆPFEXECext( symb prg → symb )
ˆLISTSECOext( composite → composite ) — Applies 1LAM non-recursively to all elements of the list.
ˆCK1TONOext( ob → ob' ) — Applies prg to ob, recursively for lists. prg is fetched from runstream.

Irrquads

ˆTYPEIRRQ?( ob → flag ) — Is ob an irrquad?
ˆDTYPEIRRQ?( ob → ob flag ) — DUP, then ˆTYPEIRRQ?.
ˆQXNDext( irrq → a b c ) — b=0 and c=1 if stack level 1 is not an irrq. . Name Description
ˆNDXQext( a b c → irrq )
ˆIRRQ#ULTIMATE( ob → # c ) — Finds « depth and returns ultimate c of an irrq.
ˆQCONJext( irrq → irrq' ) — irrq-conjugate of an irrq. This is not the com- plex conjugate.
ˆQABSext( irrq → irrq sign ) — Finds the sign of an irrq. Work always if irrq is made of Z.
ˆQNORMext( Zirr → aˆ2-b*cˆ2 ) — Irrq-norm of an irrquad. This is not the com- plex modulus.
ˆSECOSQFFext( :: x<< a b c x>> → { fact1 mult1 ... factn multn } ) — Factorization of irrquads and Gauss integers.
ˆPREPARext( o1 o2 → a1 b1 c1 a2 b2 c2 ) — Returns irrquad decomposition of o1 and o2. with either c1=c2 or c1 and c2 have no fac- tors in comon. c1<c2, ordering handled by LESSCOMPLEX? is made
ˆLISTIRRQ( ob {} → {}' ) — Add the C-part of all irrquads of object to the list.

Miscellaneous

ˆPSEUDOPREP( o2 o1 → o2*a1.nˆ o1 a1.nˆ )
ˆHSECO2RCext( ob → ob' ) — Conversion of constants from internal to user form.
ˆSECO2CMPext( seco → symb ) — Back conversion of complex. polarflag should be disabled if not at the top level of rational expressions.
ˆVALOBJext( # {..{Q}..} {var1..varn} → {..{ob}..} ) — Back conversion of objects embedded at depth # in lists. Simplifies var1..varn.
ˆVAL2ext( # {..{Q}..} {var1..varn} → {..{ob}..} ) — Back conversion of objects embedded at depth # in lists. Does not simplify var1..varn. Con- version is done in asc. power if positivfflag is set, whic
ˆINVAL2( P # → symbpoly ) — LAM2 must contain Lvar, # is the depth.
ˆMETAVAL2( # Meta_list → Meta_symb ) — LMA2 must contain Lvar, LAM1 is modified.
ˆVAL1( ob → ob ) — LAM2 must contain Lvar, LAM1 is modified.
ˆVAL1M( ob → Meta_symb ) — LAM2 must contain Lvar, LAM1 is modified.
ˆIDNTEXEC( symb idnt → symb' ) — Tries to find idnt such that symb=0. Return a solution as an equality 'idnt=..' in symb'.
ˆMP0( ob → ob 1 ) — Returns number 1 of the selected type. The symbolic/ROMPTR one looks very strange it is used to avoid infinityˆ0/undefˆ0 to return 1.
ˆrpnQOBJext( ob → ob' ) — prg is fetched from the stack. Looks for all d1, d2, ... at the beginning of the name of idnt to determine if idnt represents a derivative of a user f
ˆSIMPIDNT( idnt → ob ) — Evaluates idnt (looks recursively for its con- tent if defined). Does not error for circular definition, but displays a warning.
ˆRCL1IDNT( idnt/lam → ob ) — Recursive content of an idnt. LAM1 to LAM3 must be bound.
ˆSWPSIMPNDXF( ob2 ob1 → ob1/ob2 ) — Simplified fraction (internal).
ˆSIMPNDXFext( ob2 ob1 → ob2/ob1 ) — Simplified fraction (internal).
ˆCMODext( C2 C1 → C1 C2_mod_C1 )
ˆSQFF2ext( l1...ln #n-1 → l1'...ln' #n-1 )
ˆPPZ( p → p/pgcd pgcd ) — ob is the gcd of all constant coefficients of P (integer, Gauss integers, irrquads with the implementation of the "gcd" for irrquads).
ˆPPZZ( ob → ob zint ) — PPZ with further check to ensure returning a zint.
ˆPZHSTR( a z → a mod z )
ˆHORNER1ext( P r → P[r] )
ˆPEval( P r → P[r] ) — P must be a list polynomial.
ˆSQRT_IN?( {} → {} flag ) — Returns TRUE if one element of {} is a symb containing a sqrt.
ˆIS_SQRT?( symb → flag )
ˆIS_XROOT?( symb → flag )
ˆSTOPRIMIT( symb → ) — Stores antiderivative in PRIMIT variable.
ˆCONTAINS_LN?( symb → symb flag )
ˆFOURIERext( symb n → cn ) — Computes n-th Fourier coefficient of a 2 π pe- riodic function.
ˆLESSCOMPLEX?( ob1 ob2 → ob1 ob2 flag ) — Compares objects by type and then by CRC. flag is true if ob1 is less complex than ob2 (ob1>ob2). If ob1 or ob2 is an irrq, find first ultimate type o
ˆTABLECOSext( → {} ) — Table of special COS values (k*pi/12).
ˆTABLETANext( → {} ) — Table of special TAN values (k*pi/12).
ˆLINEARAPPLY( symb nonrat_prg rat_prg → symb ) — Applies linearity. nonrat_prg is applied for a non rational part symb → symb. rat_prg is applied for a rational part symb → symb. Lin- earity is appli
ˆA/B2PQR( A B → P Q R ) — Writes a fraction A/B as E[P]/P*Q/E[R]. Q and positive shifts of R are prime together.
ˆGOSPER?( P Q R → P R Y T ) — ( P Q R → F ) Solves P = Q E[Y] - R Y for Y.
ˆFRACPARITY( fr → Z ) — Tests if a fraction (internal rep) is even/odd/none. Z=1 if even, -1 if odd, 0 if neither even nor odd.
ˆFR2ND%( fraction-l → N D % ) — Extract trivial power of fraction.
ˆMSECOSQFF( ob → Meta ) — Factorization of an extension. Part V Appendices

Worked Example — the smiley you can drive

the book's parameterized-outer-loop program (§32.8), taken apart block by block

Section 32.8 of Programming in System RPL is the book’s one complete application, and the place most people first meet a parameterized outer loop. It puts a small smiling face on the screen and lets you push it around with the arrow keys: one pixel a press, ten if you hold left-shift first, and the same four moves again on the menu keys. ON or the Quit menu key ends it.

Nothing in it is advanced. What makes it hard to read cold is that four System RPL habits arrive at once — objects that are pushed rather than run, case words that return from the whole program, tests fused into branches, and arithmetic done in bints. Taken one block at a time it is about ninety lines of genuine code and a hundred of repetition. Below, every block with what it actually leaves on the stack.

Line numbers refer to the listing on pp. 218–223. The four arrow handlers and the four menu keys are near-identical, so one of each is shown.

19 × 19 — the sprite, decoded from the GROB literal on line 21. It starts at (56, 18): dead centre of the 131 × 56 text display.

1Names, and taking over the screen

::
  DEFINE kpNoShift    BINT1
  DEFINE kpLeftShift  BINT2
  DEFINE kcUpArrow    BINT10
  DEFINE kcLeftArrow  BINT14
  DEFINE kcDownArrow  BINT15
  DEFINE kcRightArrow BINT16
  DEFINE kcLeftShift  BINT37
  DEFINE kcOn         BINT47

  CK0NOLASTWD         (no arguments wanted)
  RECLAIMDISP         (clear and resize display)
  ClrDA1IsStat        (temporarily disable clock)

DEFINE is a MASD compile-time macro — plain text substitution, free at run time. Two kinds of name are being defined: kp… are key planes (BINT1 unshifted, BINT2 left-shifted) and kc… are key codes. Both arrive as bints, which is why the constants are BINTn and not reals.

CK0NOLASTWD is the argument check: “I take nothing.” The NOLASTWD half means it will not save the command name for an error message — cheaper, and there is no name worth saving here.

RECLAIMDISP claims the text display, clears it, and resizes it to the default 131 × 56 pixels. Remember that number; every odd-looking constant later in the program is derived from it. ClrDA1IsStat suspends the ticking clock, which would otherwise redraw itself over the top line.

2The sprite, and four local variables

  GROB 7C 310003100008F000060300810C00400010400010200020…

  FIFTYSIX            (initial x coordinate)
  EIGHTEEN            (initial y coordinate)
  FALSE               (initial exit condition)
  {
    LAM MrSmile
    LAM x
    LAM y
    LAM exit?
  } BIND              (binds local variables)

The GROB literal is one long line of hex — the book warns it must not be wrapped. Read as an object body it is: 7C, then two five-nibble little-endian fields 31000 31000 (each reverses to 00013 = 19) for height and width, then 114 nibbles of pixels — 19 rows of three bytes, since grob rows pad up to a whole byte and inside each nibble the low bit is the leftmost pixel — see Anatomy. The arithmetic closes: 0x7C = 124 = 5 + 5 + 114.

FIFTYSIX and EIGHTEEN are named bint constants — the ROM keeps dozens of them, 2.5 bytes each, cheaper than assembling the number. They are (131 − 19) ÷ 2 and (56 − 19) ÷ 2: the sprite starts centred.

BIND takes the four objects off the stack into named lams. The order catches everyone: binding works from the deepest stack level towards level 1, so the first name in the list gets the deepest object. MrSmile ← the grob, x ← 56, y ← 18, exit?FALSE. From here the four names are the program’s entire state.

3AppDisplay — the only code that draws

  ' ::
      CLEARVDISP      (clear display)
      LAM MrSmile     (recall smiling face grob)
      HARDBUFF        (recall current display)
      LAM x LAM y     (smile coordinates)
      GROB!           (REPL)
      DispMenu.1      (display menu)
    ;

The leading ' is the whole trick: it quotes the secondary, pushing it on the stack as an object instead of running it. This one becomes the loop’s AppDisplay parameter, and the loop evaluates it before every keypress.

That is why no key handler ever touches the screen: the keys only move numbers in x and y, and this object redraws from them. Clear, blit, done — no dirty-rectangle bookkeeping, and no way for the picture and the variables to disagree.

HARDBUFF ( → dispgrob ) hands you the live display grob, so writing to it writes to the screen. GROB! ( grob1 grob2 #x #y → ) stores grob1 into grob2 at (x, y) and returns nothing — a “bang” word that edits in place. If you go looking for a result grob to store back, there isn’t one.

4AppKeys — the dispatch skeleton

  ' ::
      kpNoShift #=casedrop ::
        DUP#<7 casedrpfls        (let the softkeys through)
        kcUpArrow    ?CaseKeyDef :: … ;
        kcDownArrow  ?CaseKeyDef :: … ;
        kcLeftArrow  ?CaseKeyDef :: … ;
        kcRightArrow ?CaseKeyDef :: … ;
        kcOn         ?CaseKeyDef :: TRUE ' LAM exit? STO ;
        kcLeftShift  #=casedrpfls
        DROP 'DoBadKeyT
      ;
      kpLeftShift #=casedrop :: … ;
      2DROP 'DoBadKeyT
    ;

The AppKeys contract is ( #KeyCode #Plane → KeyDef TRUE ) if you handle the key, or ( #KeyCode #Plane → FALSE ) if you don’t. So this object is read outside-in: first pick the plane, then the key.

Three case words do all the work, and each one returns from the entire secondary when it fires — not just from its clause:

#=casedrop( #m #n → … ) equal: drop both, run the following object, exit. Not equal: drop only #n and carry on. Inside the clause only the keycode is left.
?CaseKeyDef( # #'ob T ) the specialist: equal → drop both, quote the next object, return it with TRUE and exit. It is exactly #=casedrop :: ' <keydef> TRUE ; in one entry.
casedrpfls( ob TF ) if the flag is TRUE, drop the object and return FALSE.

So DUP#<7 casedrpfls reads: copy the keycode, is it under 7 — a softkey? — then bail out with FALSE. FALSE means “not mine.” The loop then runs the standard definition for that key, which is how the menu keys and the shift key keep working at all. 'DoBadKeyT ( → DoBadKey T ) is the opposite: “mine, and the answer is a beep.”

5One arrow key, traced on the stack

  kcUpArrow ?CaseKeyDef
    ::
      LAM y DUP
      BINT1 #<ITE
        :: DROP ERRBEEP ;
        :: #1- ' LAM y STO ;
    ;
LAM yy
DUPy y
BINT1y y #1
#<ITEy — the test ate the copy and the 1, then chose one of the two following objects
DROP ERRBEEP— empty; beep
#1- ' LAM y STO— empty; y−1 stored

The DUP is not decoration. #< consumes both its arguments, so without the copy the branch would have nothing to work on. This copy-test-consume shape is everywhere in ROM code.

#<ITE is a fused compare-and-branch, and like ITE it takes the next two objects out of the runstream. ' LAM y STO quotes the lam so STO ( ob lam → ) receives the name; drop the quote and you would hand it y’s contents instead.

6The shifted twin — and why the store moves out

  kcUpArrow ?CaseKeyDef
    ::
      LAM y DUP
      BINT10 #<ITE
        :: DROPZERO ERRBEEP ;
        :: BINT10 #- ;
      ' LAM y STO
    ;

Same shape, one structural difference: ' LAM y STO is now after the branch, shared by both paths — so both branches must leave a number behind. That is what DROPZERO ( ob → #0 ) is for: throw away y, push 0, beep. Shift-↑ near the top edge therefore slides you to the edge rather than refusing to move, which is the better behaviour and costs one word.

In the right-arrow version the else-branch is a bare #10+ with no :: wrapper at all. That is legal because ITE takes two objects, and a single word is one object. It is also, reliably, the line that stops people reading ROM listings.

7Where the magic numbers come from

A 19-pixel sprite on a 131 × 56 display fits while x ≤ 112 and y ≤ 37. Every limit in the program is one of those two numbers, tested one below:

Upy < 1 → beep · shifted y < 10 → 0
Downy > 36 → beep · shifted y > 2727
Leftx < 1 → beep · shifted x < 10 → 0
Rightx > 111 → beep · shifted x > 102 → 112

“Beep when x > 111” lets x reach 112, and “beep when y > 36” lets y reach 37 — both exactly the last fitting position. The shifted Right clamp of 112 agrees.

The shifted Down clamp does not. BINT27 #>ITE :: DROP BINT27 ERRBEEP ; snaps y back to 27, so from anywhere in 28–37 a shift-↓ jumps the face upwards. The same action in the menu list two pages later clamps to 37, which is what the hard key should do. It is not in the published errata — it is simply the one line in the listing worth not copying.

8The menu, and why it works

  {
    { "Up" {
        ::                        (unshifted: one step)
          LAM y DUP BINT1 #<ITE
            :: DROP ERRBEEP ;
            :: #1- ' LAM y STO ;
        ;
        ::                        (left-shift: ten steps)
          LAM y DUP BINT10 #<ITE
            :: DROPZERO ERRBEEP ;
            :: BINT10 #- ;
          ' LAM y STO
        ;
      }
    }
    { "Down"  { … } }
    { "Left"  { … } }
    { "Right" { … } }
    NullMenuKey
    { "Quit" :: TRUE ' LAM exit? STO ; }
  }

A menu key is { label action }. When the action is itself a list, the list is indexed by plane: first entry unshifted, second left-shifted. The bodies are the hard-key handlers copied verbatim — which is why the listing is 195 lines for a 90-line program. NullMenuKey holds the empty fifth slot so Quit lands under the rightmost softkey.

Two things away from here make the menu work. DUP#<7 casedrpfls at the top of each plane returns FALSE for keycodes 1–6 — the softkeys — and the NonAppKeyOK? parameter is TRUE, so the loop falls back to the standard definition for them. The standard definition of a softkey is the menu entry. Set either of those the other way and the menu goes dead.

Quit does the only thing that ends the program: store TRUE into exit?.

9Nine parameters, seven words

    TrueTrue            (NonAppKeyOK? · DoStdKeys?)
    { … the menu … }    (AppMenu)
    ONEFALSE            (first menu row, no suspended envs)
    ' LAM exit?         (exit condition)
    'ERRJMP             (error handler)
    ParOuterLoop        (run the par outer loop)

    RECLAIMDISP         (resize and clear display)
    ClrDAsOK            (redraw display)
  ;

ParOuterLoop wants nine arguments, in this order: AppDisplay · AppKeys · NonAppKeyOK? · DoStdKeys? · AppMenu · #AppMenuPage · SuspendOK? · ExitCond · AppError. Count the words in front of it and you find seven — because TrueTrue ( → T T ) and ONEFALSE ( → #1 F ) each push two. Fused constants like these are all over the ROM; recognising them is most of what makes ROM listings readable.

' LAM exit? is quoted for the same reason AppDisplay was: the loop wants the recall-object to evaluate before each key, not the flag’s value now. 'ERRJMP as AppError means “don’t handle it, re-raise” — ParOuterLoop wraps itself in ERRSET and has already restored the saved interface by the time your handler runs.

When ExitCond finally evaluates TRUE the loop returns, and the last two words give the screen back to the stack display.

10What actually trips people up

' obpushes the object; without the quote it runs. Three of the nine loop parameters are quoted secondaries — miss one and you execute your own display code at setup time.
case…every case word exits the whole secondary, not the clause. There is no “break”, and nothing after a matched case ever runs.
ITE #<ITEtake the next two objects from the runstream. A bare #10+ is a complete branch; a :: … ; is one object too.
bintscoordinates, counts and keycodes are bints, not reals: #1+, #-, #10+, #< — never the % words.
GROB!bang words return nothing and edit in place. So do CLEARVDISP and DispMenu.1.
FALSEfrom AppKeys means “not my key” — it is how you keep standard behaviour, not how you suppress it.
no ABNDthe BIND on line 32 never gets a matching ABND. Chapter 18 is explicit that every BIND needs one and that nothing checks it for you. Add it before the final ; if you adapt this program.
nothing checksCK0NOLASTWD is the only guard in 195 lines. That is the bargain: no seatbelts, and a program that redraws a sprite faster than User RPL can parse the request.

Listing: Programming in System RPL, 2nd ed., Kalinowski & Dominik, §32.8 “An Example”, pp. 218–223; parameter descriptions from §32 and ch. 18, entry diagrams from the index above. Code shown in fragments, with the four near-identical arrow handlers and menu keys collapsed to one of each.