From: wndalouise@aol.com (WndaLouise)
Newsgroups: comp.sys.hp48
Subject: STO with AI...!
Lines: 387
Message-ID: <1998070320573200.QAA15206@ladder01.news.aol.com>
NNTP-Posting-Host: ladder01.news.aol.com
X-Admin: news@aol.com
Date: 3 Jul 1998 20:57:32 GMT
Organization: AOL http://www.aol.com
Xref: republic.btigate.com comp.sys.hp48:12841


->Sto                   ( gx version ) 
------------------------------------------o
New ( & Improved ) = Store =
------------------------------------------o

By TinyWanda              July '98


->Sto works, kind of, like STO...

Kind of like...In the sense that it's function is to Store Variables & other
Objects of all kinds...

...And mostly; Not at all like, In how it goes about doing it.

Oddly...???
Normal STO does one thing that ->Sto doesn't do, 
And it's exactly the sort of thing that it SHOULD do...!!!
...But this version doesn't!
i was thinking...
...This is an evolutionary form from the 'sx' version, In which STO did not do
this special thing...
...specifically;
2:   { 1 2 3 }
1:   { A B C } !

And as a rationalization, This form of ->Sto is meant to be used by the user in
an interactive Stack sort of way, And the above situation seems very contrived
to me...???

In defense, What ->Sto does allow is;
4:           1
3:           2
2:           3
1:   { A B C }

--PLUS-- 
If any of The Variable Names in the list are Strings, 
Then ->Sto will convert them to 'Names' before using them...
Which means that you can use -Illegal- Names with ->Sto,
Such as '+3' or ':Add' or '*7*'... And others...

This new version is intended to store everything on the stack, 
And do so in a Reasonably Logical Manner...???

The amount of 'Reasonably Logicalness' is derived from what the first object on
the stack is...
->Sto takes it's cue from that object.

------------------------------------------o

There are several object types which DO NOT need a name associated with them.
If the object on 1: is either;
A Real Number, A Complex Number, A Binary Number or a Tagged Object then ->Sto
will check every object on the Stack to see if it's one of these kinds of
objects, And if it is, Then that object will be stored using the object itself
as the name!
->Sto tries to use Illegal names, Only, If it's absolutely necessary...

( Because they're slightly more difficult to PURGE )

...So that Real Numbers are stored as the number with a little dot prefixed to
the front ( CHR(183) ).

Complex and Binary numbers are made into Illegal Object Names and stored under
that name...
i.e., (2,3) is stored under the name '(2,3)'.

Tagged objects use the Tag as the Name, Irregardless whether the Tag would form
a Legal or Illegal Name.

If an object is on the stack that is not one of these four kinds, then that
object is ignored, and left on the stack.

Unit Objects behave very oddly when you try to ->STR them, so they were left
out...
It certainly wouldn't be ImPossible to adapt the program to deal with them, But
i hardly ever work with Unit Objects, And this is; After all, My damn
program...!

Also; Arrays & Algebraics were thought to be too complicated, So they were left
out too.
You'll just have to store them in a Less Instantaneous &/or Painless manner...!

------------------------------------------o
 
If the Object on 1: is a String;
Then that String is used as the name for what is on 2:
2:       Any Object
1:         "String"

------------------------------------------o

If the Object on 1: is a List;
And all the Objects on the list are either a Name or a String,
And there are Enough objects on the Stack,
Then those Names in the List will be used to Store the Objects on the Stack.
Such that:
4:               1
3:               2
2:               3
1:   { A "+:B" C }

1 will be stored in 'A'
2 will be stored in '+:B'
3 will be stored in 'C'

------------------------------------------o

If the Object on 1: is a perfectly ordinary 'Name', Either of the Global or
Local varieties;
Then ->Sto examines the stack to see if there are a group of names at the
bottom of the stack, And a group of non-name objects at the top of the stack,
And if so, The objects at the top are stored in the names at the bottom.
Such that:
6:              123
5:        << 2 + >>
4:          "Hello"
3:              'a'
2:              'b'
1:              'c'

123 will be stored in 'a'
<< 2 + >> will be stored in 'b'
"Hello" will be stored in 'c'

------------------------------------------o

Because ->Sto allows you to store objects under Illegal Names,
And since Illegal Names are marginally difficult to PURGE,
In that; Either you have to; 
Recreate the Illegal name and then PURGE that, 
Or do a; VARS, And Edit the list with SUB or GET, 
Or OBJ-> that list, And then DROP the objects that you don't want to PURGE and
then PURGE the ones you do want to PURGE when they come to 1:, 
Or exclude all the objects that you don't want to purge from the stack, Reform
the list with ->LIST, And then purge them...!
Or...
Do a { 1 10 } TVARS and then Edit that list, If necessary, Without bringing it
down to the command line, And then PURGEing those items...

Or...!
Use the Interactive/Semi-Automatic Purgerizer that is built into
->Sto...!

Simply hit ->Sto when there is Nothing on the Stack, 
And a prompt will come up asking you if you want to Purge Stuff...???
( in case you entered that functionality mistakenly...! )
Then if you do, Hit [YES] and then either YES or NO when all the Names in that
Directory are brought up in the Prompt...!

------------------------------------------o

Also:
Also included with ->Sto at No Extra Charge...!
Is ->Dir which is kind of an interactive VIEW, Which puts everything in that
given Directory that you're in, Into a CHOOSE menu, 
Listing the Name of the Object, And it's contents, 
Or a small quantity of the contents, before they're cut off the right hand edge
of the screen...!

Anyway...It should give you some idea of what is stored in the variable, If
you've forgotten...
Selecting that item; Will then bring it to the Stack.

Directories, Grobs & Programs are listed as Drctry, Grob or Prgrm, Rather than
trying to list their entire contents...!

If you've got some kind of Strange-Ass object stored in the Directory, Then
it's listed in the Choose Menu as; ?.

------------------------------------------o

CheckSums:

Name:             ->Sto
CheckSum:       # 6750h
Size:            1130.5

Name:             ->Dir
CheckSum:        # 1D2h
Size:               352

------------------------------------------o

SubPrograms:

Name:             ->Nam
WARNING...!!! CONTAINS SISSYVALVES...!
BE SURE AND CHECK THE CHECKSUM...!
THIS WAS IMPLEMENTED ON A GX...BUT I THINK ??? THAT IT WILL WORK ON THE SX
TOO...ALTHOUGH...THERE ARE SEVERAL GX FUNCTIONS USED BY ->Sto SO YOU'LL HAVE TO
MODIFY ->Sto ANYWAY...!!! (!)
CheckSum:       # 3C01h
Size:             115.5
  Converts a String to a Name, or vice versa.

Name:               Bep
CheckSum:       # 74BFh
Size:             350.5
  Takes a 1, 2, 3, 4 or 5 and returns a Bep!

Name:             Blink
CheckSum:       # 8C73h
Size:             137.5
  No Input, Blinks the Screen and Beps!

------------------------------------------o
Directory Listing:

Name:            ->STO
CheckSum:       # 9ABh
Size:             2101
------------------------------------------o

%%HP: T(3)A(D)F(.);
DIR
  \->Sto
    \<< DEPTH DUP
      \<< OVER TYPE
        \<< Bl\161nk
"Ugh!
Bad SomeThing!!!"
DOERR
        \>> \-> \GD \Ga \GW
        \<< { 0 1 2 5
6 7 10 12 } \Ga POS
          \<<
            CASE {
0 1 10 12 } \Ga POS
              THEN
1 \GD
START DUP TYPE \-> \Gb
  \<<
    CASE 0 \Gb ==
      THEN "\183" OVER
+ OBJ\-> STO
      END { 1 10 }
\Gb POS
      THEN DUP \->STR
\->Nam STO
      END 12 \Gb ==
      THEN OBJ\->
\->Nam STO
      END DEPTH
ROLLD
    END
  \>>
NEXT
              END 2
\Ga ==
              THEN
\GD 1 >
\<< \->Nam STO
\>> \GW IFTE
              END 5
\Ga ==
              THEN
DUP SIZE 1 + \GD \<=
\<< DUP 1
  \<< { 2 6 7 } SWAP
TYPE POS
  \>> DOLIST 0 POS \GW
  \<< DUP SIZE 1
    FOR \pi DUP \pi GET
DUP TYPE 2 ==
'\->Nam' IFT ROT SWAP
STO -1
    STEP
  \>> IFTE
\>> \GW IFTE DROP
              END {
6 7 } \Ga POS
              THEN
\GD \->LIST DUP REVLIST
1
\<< { 6 7 } SWAP TYPE
POS
\>> DOLIST 0 POS 1 -
DUP 2 * \GD \<=
\<< \-> \162
  \<< OBJ\-> DROP \162
\->LIST REVLIST \162 1 +
ROLLD \162 \->LIST
REVLIST SWAP STO
  \>>
\>>
\<< DROP2 OBJ\-> DROP \GW
\>> IFTE
              END
            END
          \>> \GW IFTE
        \>>
      \>>
      \<< DROP # 15h
# 8h BLANK DUP DUP2
{ "YES"
        \<< 1 CONT
        \>> } { "NO"
        \<< 0 CONT
        \>> } 6 \->LIST
TMENU CLLCD
"Purge Stuff?" 3
DISP 3 FREEZE HALT
        \<< VARS
REVLIST OBJ\-> 1 SWAP
          START 3
Bep "PURGE : " OVER
" ?" + + 3 DISP 3
FREEZE HALT ::
PURGE :: DROP IFTE
          NEXT
        \>>
        \<< Bl\161nk
        \>> IFTE 0
MENU TEXT
      \>> IFTE
    \>>
  \->Dir
    \<< PATH TAIL
\->STR VARS 1
      \<< DUP DUP ":"
SWAP RCL { 0 1 2 3
4 5 6 7 9 10 13 18
19 20 21 22 24 }
OVER TYPE POS
        \<< \->STR + +
SWAP 2 \->LIST
        \>>
        \<< { "?"
"Prgrm" "Grob"
"Drctry" } { 8 11
15 } ROT TYPE POS 1
+ GET + + SWAP 2
\->LIST
        \>> IFTE
      \>> DOLIST 1
CHOOSE
      \<< EVAL
      \>> IFT
    \>>
  \->Nam
    \<< DUP TYPE \-> \Ga
      \<<
        CASE \Ga 2 ==
          THEN
# 5B15h SYSEVAL
          END \Ga 6
==
          THEN
# 5BE9h SYSEVAL
          END
        END
      \>>
    \>>
  Bep
    \<< DUP TYPE 5 ==
      \<< EVAL
      \>>
      \<< 1 SWAP
      \>> IFTE \-> \Ge \GD
      \<< { { 20 15
.5 } { 100 20 .1 }
{ 2000 500 .02 } {
4000 1000 .005 } {
8000 10 .04 } } \GD
GET EVAL \-> a b c
        \<< RCLF -56
CF 1 \Ge
          START
RAND a * b + c BEEP
          NEXT STOF
        \>>
      \>>
    \>>
  Bl\161nk
    \<< RCLF -56 CF
PICT RCL LCD\-> PICT
STO { # 0h # 0h }
PVIEW PICT NEG RAND
3000 * 500 + .07
BEEP TEXT PICT STO
STOF
    \>>
END
