SV-FIG_20230826
Followup
Learning CoSy
  • 4th.CoSy
  • Planetary Temperature
  • CoSy/Life ; CoSy/Liberty
  • © Bob Armstrong


    Accounting-useful Vocabulary & Methods in CoSy



    Presentation Text ( script , executed lines )

     | ======================== | Sun.Aug,20230820 | ======================== |
    | 1032 | | 1154 |* 
            Intelligent Paper . Possible in Forth but not in C

               IF YOU ARE GOOD AT NUMBERCRUNCHING
                 NO MATTER YOUR `DRUTHERS
                THE MOST VALUABLE TO CRUNCH
             ARE ONES WITH CURRENCY SYMBOLS ATTACHED


        > ENTERPRIZES ARE ACCOUNTING STRUCTURES WITH PEOPLE ATTACHED <
                    BOARD ROOM SYSTEMS
                   
                  https://www.cosy.com/BobA/vita.htm   
        APL level tasks : Xerox , RGE , Manhattan APL+PC.CoSy , MEJA Trust

     o So far have avoided renaming Forth words     | exception | alias: $ swap |
     
      Thu.Aug,20230824 BAA Zoom comparison w https://dyalog.com APL showed
       how much simpler w equivalent ` power 
       but more immediate transparent documentation 4th.CoSy is

          THERE'S NO QUESTION WHETHER YOU CAN OR CAN'T DO SOMETHING
              It's all open code so you can always roll your own
     
            | ================================================== |
    | ACOUNTING USEFUL VOCABULARY & METHODS
    |
    | DAILY INLINE LOG LEDGER ENTRIES 

     ` C:\CoSyBob\BobA.csy F>/\ ` text v@   s" | Sun.Jan,20230101 | "  prt>=f

    rShow R0
     ` .\CoSy\AcntFns.f F>  `( rUpdate  Eval )` 1 _at Eval

    : ledgerlns lfVM s" (' " con ['] dlb 'm  s" (' " in  { s" ')" prt<=l } 'm ;
     
     t0 ' Eval 'm >t0>     fmt rUpdate
     t0 flip >t0>     fmt rUpdate
     t0 fmttbl|  rUpdate

     t0 3 _at  ' +/ 'm ,/ +\ enc' enc t0 $ cL fmttbl| rUpdate | append running balance
     
    | CONVERSION OF ACCOUNT .CSV DOWNLOADS
       
     ` C:\CoSyBob\acnts\y23\BobA\Chase4301ytd.CSV F>  >t0>
      t0  rUpdate
      t0    "lf ` , ,L   csv>DT >t1>
      t1 #
      t1 #'
      t1 dsc 
      t1 1 _at
      t1 fmtDT rUpdate
      t1 dsc { "bl ssd } 'm enc t1 0 _at!   t1 dsc
    |  t1 dsc blMV |>| TransactionDate PostDate Description Category Type Amount Memo
     
     t1 `( TransactionDate  Description Amount Memo Category Type PostDate )` dsel >t1>
     t1 1th ' reverse 'm enc t1 1 _at!   t1 DT>lst flip fmttbl| rUpdate
     
     t1 >T0>

     T0  fmtDT rUpdate
     T0 1th >t1>

     t1 fmttbl| rUpdate
      t1 dsc  ' m/d/y>ts 'm  enc t1 0 _at! 
      t1 2 _at  ' str>f 'm  enc t1 2 _at! 
     
    |  ` C:/CoSyBob/acnts/y22/BobA/AmazonChase.cdt F>/\ 1th flip -1 _at 3 _at |>| -43.21

      (' 20230101 _i s" Opening Balance " -43.21 _f -43.21 _f ec ec ec  ')
      R0 enc   T0 1th flip cL flip >t1>  fmttbl|

    | ( tbl (' DataCol ResCol ') -- insert running total of DataCol in ResCol ) | 20230705 | from ` acnts work
    : tblbal 2p> dsc at ,/ +\ enc' enc L@ R@ 1th at! 2P ;

       t1 i( 2 3 )i tblbal

       t1  fmttbl|  rUpdate
      t1 enc T0 1 _at!
       ` Balance enc T0 dsc 3 _at!
     
     `( date description amount balance )` T0 dsc 4 _iota at!
     
      T0 fmtDT  rUpdate
    |  T0 ` C:/CoSyBob/acnts/y23/BobA/AmazonChase.cdt \/>F 
     ` C:/CoSyBob/acnts/y23/BobA/AmazonChase.cdt F>/\ fmtDT rUpdate
     *| 1218 | 
     



    In after-chat about the possibility of High Level Language in Forth .  I commented that APLs , array programming languages are the highest , in a class by themselves , And CoSy is one . They extract the most generic computing structures and operations into a concise vocabulary .

    Don Golding in particular raised the question of learning yet another language .

    This is a classic issue in APL which has evolved and generalized from matrix algebra .
    It is worth noting that therefore the vocabulary and the expression of algorithms tends to be intrinsically parallel .

    Mathematics is a matter of learning language ; learning a vocabulary where many of the definitions may be difficult and ` strange . But the effort to learn is repaid by the abilities the words provide .
    This has been aptly said about APL , I believe even by Ken Iverson himself , -- and can be well applied to Forth .

    The impromptu comparison at the British APL Association Zoom Thursday 20230824 between  Adám Brudzewsky of Dyalog APL demonstrating the parameters to ⎕CSV and ( 1200 ⌶ ) something to me showed the significant simplicity and immediacy of understanding provided by CoSy's open definitions and simple ` help vocabulary particularly ` :?? which finds the definitions of words in the scripts making up CoSy and returning surrounding text delimited by totally empty lines . Definitions of words themselves provide examples of usage of all the words defining them .

    As an example , here are the definitions of all the words used in Saturday's demo in order of their use , starting with the text being copied in to T0 . It is important to understand that CoSy is just a vocabulary in Forth and when you tap F6 it executes directly in ( Reva ) Forth .

     T0 (' "lf "bl ') ssr blVM >t0> #  |>| 476
    | replace linefeeds w blanks split on blanks to create list words . There are 476 .

     t0 nub ' dab 'm dae >t1> #   |>| 136
    | extract the uniques . delete all blanks and then delete any resulting empty rows .

      t1  ec Words membv >t2> #    |>| 67
    | ` Words returns all CoSy defined words containing the phrase passed .
    | ` ec , an empty char list returns all .
    | ` membv returns all members of the left argument which are members of the right .
    |
    67 are
    CoSy words .

     t2  ' :?? 'm  >t3
    | get the definition and surrounding lines delimited by totally blank lines around each .

     ` |--  "lf braket  t2 blpad pad s"    |  " s"   | " ,L  ' braket 'L ' cL 'R t3 ,L flip fmt >t4>
    | do some fancyfying around eacj names and to the definitional material & format to string

     t4 .+  lfVM ,L #' ,/ |>| 35165 1243 

    I see there are 35165 characters in 1243 lines in the result so I've put it in a scrolling window .
    You will see there are often families of similar words which , for instance , return an underlying boolean ` vector of occurrences where a tested condition is true , the corresponding indexes , and the actual values .

    Words that are in the underlying Reva Forth scripts don't follow the empty line convention so whole surrounding blocks of code are returned .

    It is clear many words need to be better documented . Any dates refer to dates in my Worklogs on which the word was defined or modified .


    Error: Embedded data could not be displayed.   See online

    I trust this  gives some indication of the facilities for learning the meanings and usages of CoSy words . A top priority is replacing the development GUI with more standard web browser interface & tools , in fact making CoSy webspaces available as a ` service . Then it would be reasonable to have the help on a word appear in a tool tip when hovering on it .

    I also hope this gets across what a powerful environment CoSy is for Forth development itself .
    See αlphas for charter subscription offer .

    Bob A | 20230828.2020 |

     Email<>BradN , SV-FIG

    Brad ,
    I very much appreciate your well intentioned feedback .

    After I get accounting in order the rest of this month , upgrading the documentation will be a priority .

    CoSy has been brought this far as a solo effort ( upon the Reva Forth base ) despite some rather significant difficulties and with revenue which rounds to $0  .  It has been , first of all a matter of bushwhacking a path from open-to-the-chip ( x86 ) Forth to the dynamic lists of APL/K .

    The CoSy.f you reference is the main CoSy script , and what order you see comes from order of definition as needed structures or vocabulary are defined . For instance  ` operators , aka adverbs , verbs which take ` ticked ( addresses of ) verbs , are defined pretty much together , eg: all the ` each adverbs : 'm 'd 'L 'R `( monadic dyadic Left Right )`  .  As are more everyday level definitions in furniture.f .  You will see a number of families of words ,  in APLs relegated to separate libraries like the venerable Finnish idiom list . I contend far more meaningful names can be created with Chuck Moore's brilliant simplicity of whitespace being the prime delimiter than trying to stuff everything useful into a rich but limited number of symbols . ( I like symbols otherwise I never would have gotten into APL ; I look forward to the openness of Unicode . ) K and J are a step backwards trying to make do with ASCII , but without the clarity of the whitespace rule .

    For instance , the vocabulary which returns portions of lists before or after , either including or excluding the delimiter :
    | 20190203 | \/ | vocabulary found useful over the years | \/ |
    : prt<f ( str tok -- PaRT_Before_First ) 2p> ss1st L@ swap take 2P> ;
    : prt<=f ( str tok -- PaRT_Before_Firstincluding )
    2p> ss1st R@ rho +i L@ swap take 2P> ;
    : prt>=l 2p> ['] reverse on2 prt<=f reverse 2P> ;
    : prt>l 2p> ['] reverse on2 prt<f reverse 2P> ;

    : prt>f 2p> ss1st R@ rho +i L@ swap cut 2P> ;
    : prt>=f 2p> ss1st L@ swap cut 2P> ;
    : prt<=l 2p> ['] reverse on2 prt>=f reverse 2P> ;
    : prt<l 2p> ['] reverse on2 prt>f reverse 2P> ;
     I think they are rather self-explanatory and such names are only possible in Forth . The alternative  would be names like part_before_including_first . If you want to make a set of such aliases be my guest .

    There is no question programming in CoSy , even for me , is often finding the word which does some task rather than reinvent the process . 

    Early on , when definitely still in K.CoSy , I made a table of all the Reva .Forth words , linked in the F1 help .  And definitely a cheat sheet is needed . I went to Antwerp to get one for K😉: https://cosy.com/language/index.html#K , https://cosy.com/views/APL94.txt :
            At his workshop, Arthur handed out a 2-sided, 8-panel, K
    Language Summary card, which displays a remarkable breadth and depth of
    understanding of the fundamental invariants of programming.
    I'd contend that math notation in general just started out as " personal shorthand " , eg: Dirac bra and ket ( which I dislike ) . Donald McIntyre  in particular used to give talks at APL conferences on such things as the history of ` + .
    I'm not against having more verbose aliases for anything found to be cryptic .  But having a set of related words like
     ` memb Words
    (
     ~membv
     ~memb
     membv
     memb
     )

    for membership , either returning booleans or values or their complements would get too prolix for me .
    Ironically , if I could think of good mnemonic symbolic ` abbreviations for ` reverse and ` take I would have .

    A couple of other words you mention , like VM  ( vector to matrix ) , are more historical idiosyncrasies .

    Transliteration tables are trivial at the array level .

    But while I think the fundamental notions underlying languages are best products of single heads , it then takes a community to winnow a most mutually understandable vocabulary .

    I don't know that I would call APLs or K " domain specific " . One of the brilliances was to extend array structures to characters , and nests of arrays themselves . The idea of simplifying to lists-of-lists goes back at least to Backus . Their limitation is closing off " lower level " sequential item-by-item processing .  That's where CoSy  being simply a vocabulary in open Forth is in a class by itself .

    What it needs now is more heads -- and the accounting structures to manage their contributions -- and calculate the vig for the governments  .

    Current CoSy is only the trail bushwhacked from coast to coast . There's lots to be done before it's a smooth autobahn -- simply a facility available on the cloud or mated to particular hardware .

    Thank you for your very useful and needed feedback .

    Bob A


    | --

    On 2023-08-28 22:49, Brad Nelson wrote:
    Hi Bob,

    Do you have or have you considered a cheat sheet for CoSy?
    Something like this APL one.

    When I've tried to decode your CoSy one liners, I find I end up having to traverse the whole dependency tree for each word.
    (Usually throughout this file).
    I think a frequent point of confusion, for me at least, is which words are meant to be at that APL level of abstraction and which are implementation details / type specific. I wonder if calling out the core operators might help with that?

    As I think I told you once before, APL at least casually is easier for me to glean meaning from as the separate character set has a high percentage of operators that are trivially mnemonic. CoSy + K using multi-character operators makes it really hard to guess at the majority of operators. Having tooltips can help, but misses on the chance to have names stand on their own so to speak.
    There may be some shared conventions in the names, but I've struggled to recognize them. Names like "reverse", "take", and "partition" are just so much easier to grasp than "membv", ">t1>", and "blVM" for someone that doesn't have the operator set burned in their head.

    A point I managed to convey poorly in the meeting is I think while you're trying to aim for the pithy crisp set of operators in APL, you're ending up instead falling into what feels like a personal shorthand.
    Historically I think a number of wise Forth-y folks have encouraged using real whole words over abbreviations for this reason (which is a danger with Forth code in general). This is why Forth standards are filled with fully spelled out words, even when they are long by the standards of other languages (e.g. VARIABLE, CONSTANT, IMMEDIATE, INVERT, VOCABULARY).

    I think finding a clear + composible domain specific language for arrays in Forth is important for a lot of problems.

    Please take my feedback as well intentioned.
    I want to understand + follow along with how you're applying CoSy, but it's often a challenge and maybe something a small tweak in style could help with.

    Cheers

    -BradN

    On Mon, Aug 28, 2023 at 8:04 PM Bob Armstrong <bob@cosy.com> wrote:
    I've upload an answer to well taken questions , particularly by Don Golding on learning a ` strange vocabulary like CoSy .

    Also , it happens , I got a link to
     On why a vector database is essential to scale generative AI apps. Q&A with James Corcoran, Chief Growth Officer, KX

    CoSy , as I've often mentioned , evolves from Arthur Whitney's K and thus has essentially the same data structures and much vocabulary .

    The ability to " pick up " where I left off on the precursors of much of AI " in the `70s in notation succinct enough to fit my brain is a major motivation underlying CoSy .

    And with the open mapping to hardware only Forth provides , CoSy is in a unique position to rapidly develop such algorithims .

    Bob A

    Peace thru Freedom
    Honesty enforced thru Transparency ,

    -- 28124 State Highway 67 Woodland Park CO 80863-9711
    _______________________________________________
    http://zork.net/mailman/listinfo/svfig
    neither public nor private,
    this membership of correspondence
    _________________________________________


    Peace thru Freedom
    Honesty enforced thru Transparency ,

    -- Bob@CoSy.com -- Bob Armstrong Vita -- 719.337.2733
    CoSy  The Simplest Most ` Powerful Computing Language Environment
    I reserve the right to post all communications I receive or generate to CoSy website for further reflection
    -- 28124 State Highway 67 Woodland Park CO 80863-9711

    _______________________________________________
    http://zork.net/mailman/listinfo/svfig
    neither public nor private,
    this membership of correspondence





    Disqus allowed HTML



    --

       
    Whole CoSy
    Locations of visitors to this page
    CoSy
     I reserve the right to post all communications I receive or generate to CoSy website for further reflection .
    Contact : Bob Armstrong ; About this page : Feedback ; 719-337-2733
    Coherent Systems / 28124 Highway 67 / Woodland Park , Colorado / 80863-9711 
    /\ /\ Top /\ /\