CoSy
BlogPost
Wed.Sep,20200902

  • 4th.CoSy
  • Planetary Temperature
  • CoSy/Life ; CoSy/Liberty
  •  FaceBook ; Twitter 
         ; YouTube ;

  • © Bob Armstrong
    Forth is the only Truly Open code .
    CoSy is the only APL in Open to the chip Forth
    For anything from the everyday business of life to modeling the planet
    Please let me know by return mail if you want to be removed from this list

     >> CoSyZoom : Sat.Sep,20200905.1000-6 <<  ( pw : CoSy )

    CoSy is first and foremost my tool in the everyday business of life .  Across all these tasks , accounting overall has highest priority .

    If you are good at number crunching  , no matter what your druthers the greatest return is on crunching numbers with currency symbols attached . ( That's what caused me , been an APLer , to do 2 decades within walking distance of Wall St )

    Thus , the highest use for CoSy is taking care of everyday accounting . But that also requires the most time and tools .

    So , while CoSy's accounting vocabulary and procedures continually evolve , these ` marketing activities frequently take precedence since building a cash flowing ecosystem around CoSy is essential to having the numbers with currency symbols attached to crunch .

    CoSy's mailing list handling capabilities over the last few  weeks  have been  getting well sorted out and efficient .  I've been working hard to set up this periodic Blog/Newsletter and following Zoom on a fortnightly schedule .  My mailing list procedures will be a topic for this week's Zoom linked above .

    Very simple lists of strings is a powerfully flexible structure at this personal level of information .
    I'm implementing ` tags to categorize people's interests in these newsletters since I know some may be only interested in our MidSummer Mountain Mela parties , others  mainly in Earth temperature physics ( aka : AlGoreWarming aka ClimateChange ) , and , of course , the essential topic : CoSy the language .

    I'm initially setting up 3 categories :
     ` tags enc `( MidSummerMountainMela CoSy PlanetaryPhysics )` ,L
    (
     (
      tags
     ) (
      MidSummerMountainMela
      CoSy
      PlanetaryPhysics
     ) )

    Reply with a note containing any set of the tags and I'll only send you posts which include those topics .
    ( MMM will suffice for just party announcements . )  No tags will imply all topics . And , of course , just drop me a note to be removed completely .

    I tend to spend far too much time arguing against the anti-science global statist fraud of AlGoreWarming , particularly on FaceBook . I spend far too much time engaged in Climate Change Battle Royale . At least it's a group where both sides are actively debating ( to be polite ) rather than just " speaking to their choir " . But , the level of understanding of what I would consider the most essential math and physics to actually calculate anything is pathetic -- which is what diverted me into the controversy in the first place .  I've in fact been diverted into spending too much time on the battle just today .
     
    WRT:
    CoSy the language , I've given and made comments on 2 recent Zooms ,
    • SVFIG - 2020 Aug - Cosy - Bob Armstrong  Ended up being ~ 40min rather than 20 , and elicited the comment " Totally awesome " .
      I've finally been induced to get an Android ARM ( Moto G6 ) phone and drop AT&T for Ting . The demo is about slicing and dicing selecting strings with the example of selecting the items I need to shop for , marked with ` * , from my personal ToDo list on ` lst>stk .

    • I also gave a brief demo of editing multi-line functions and scripts at the end of a discussion of doing such things in Dyalog APL on the most recent British APL Association Zoom . But it's not been posted yet .

    • Finally , for now , a post on the SV-FIG ( Silicon Valley Forth Interest Group ) mail list : Bill Ragsdale posted a list  list of proposed Forth language challenges ( linked in the email below )  .  One challenge :
      1. Print a table heading by 240 to 249 across by 170 to 179 down. At each intersection show the
         Largest Common Divisor. See Art of Computer Programming V 2, pp 316-321.

       was too ` APLish to pass up . Wanting to do it in the most natural way I wanted to write it ended up revealing a problem with reference counting in the word ` lst>stk which is a  unique  bridge between CoSy lists and the Forth stack . As such , no higher level ref counting vocabulary fit the situation of decrementing the top level list and freeing if its refs go to 0 ,  but not decrementing or freeing the component lists . It's still 1 line , but it gets all the way down to the fundamental ` free word .

      But , after posting , it occurred to me that perhaps more consequential in its implications is the simplicity of encapsulating the raw Forth gcd greatest common divisor verb as a CoSy list function gaining all the attributes and applicable vocabulary acting on any CoSy integer list .

        : GCD ' gcd eachDir ; | make list version .

      Subject: Re: [svfig] FIG Meeting Programming Challenge
      From: Bob Armstrong <bob@cosy.com>
      Date: 2020-09-01, 22:26
      To: Silicon Valley Forth Interest Group <svfig@zork.net>, Kevin Appert <forther@comcast.net>

      I can't pass up an interesting challenge . Also , they tend to be important tests of aspects of CoSy
      Bill Ragsdale's GCD problem is too APLish to ignore .  I've taken the liberty of posting his .docx to http://www.cosy.com/CoSy/y20/BillRagsdale%20SV%20FIG%20Challenge.odt for reference .
      It is interesting to compare these Forth problems with the sort Dyalog poses in its student-competition .

      Anyway , the creation of a table is essential APL . And I happen to have a GreatestCommonDenominator function 
        ` C:/4thCoSy/CoSy/math.f F> Eval     | read in and eval math script including ' gcd

      : gcd    ( a b -- c) | Jack Browns recursive  greatest common divisor
          dup if swap over mod gcd else drop then ;
      | From http://ronware.org/reva/wiki/index.php/Intermediate_Tutorial

      in http://cosy.com/4thCoSy/Code/CoSy/math.f . ( Sorry for just finessing that bit . )

      I think it worth comparing with the K version :
      gcd
       Greatest Common Divisor . From Eugene McDonnel's Kidioms list
      { * | 1 + & &/' 0 = x !/: 1 + ! &/ x }

      The !/: is pairwise modulo , so at the core it uses the same modulo computation . The difference is , it operates over whole lists . Eg :
      gcd  12 36 42   />/ 6
      But back to the problem at hand . 
      I after a bit of futzing , I found it simplest to just make a CoSy list cover function like all the basic integer operations
      : GCD ' gcd eachDir ; | make list version .
      Jumping to the complete construction of the table :
        10 _iota i( 170 240 )i ' +i 'R lst>stk ' GCD 'L
      (
       10 1 2 1 2 5 2 1 2 1
       3 1 1 9 1 1 3 19 1 3
       4 1 2 1 4 1 2 1 4 1
       1 1 1 1 1 1 1 1 1 1
       6 1 2 3 2 1 6 1 2 3
       5 1 1 1 1 35 1 1 1 1
       16 1 22 1 4 1 2 1 8 1
       3 1 1 3 1 1 3 1 1 3
       2 1 2 1 2 1 2 1 2 1
       1 1 1 1 1 1 1 1 1 1
       )
      I'm not going to bother making it look fancy .  The crucial point is that that line returns a list of 10 lists of 10 integers each . It has not just printed them out leaving no result for further use .  Another line or two could have prettified it however desired , or do analytics on it , etc  .

      I'll just dissect a crucial bit of the line now and focus on the word which took me some hours to ` fix when I found it didn't handle reference counting correctly when used as in that line . ( If someone is interested I'll go thru it in the Zoom planned for Saturday . )

      The first bit create the two lists of ranges using 'R , each Right .  (  I could have avoided the splitting problem discussed below if I had simply created each of the 2 lists separately . But the ability to split lists into separate stack items is worthwhile getting right . )
       10 _iota i( 170 240 )i ' +i 'R
      (
       170 171 172 173 174 175 176 177 178 179
       240 241 242 243 244 245 246 247 248 249
       )

      The deep problem came in ' lst>stk . That list of the 2 ` axes need to be split in 2 arguments to pass on to ' GCD 'L .
      ' lst>stk is a relatively new word . But a rather important bridge between the APL and the Forth domains .
        ` lst>stk :??
      (
       ./CoSy/CoSy.f
       
      | ( v -- ( v i# items on stack ) ) splits v into separate items on stack .
      : lst>stk >a> i# 0 ?do a@ i _at loop a- ;     | 20190422
       
      : lst>stk_ >a> i# 0 ?do a@ i i@ loop a- ;     | raw version for chars & ints
       )
      That definition is fine if passed a list with a greater than 0 ref count . But ' free s the split lists of the original has a 0 ref count . Solving it caused me to get all the way down to the elemental ' free instruction .  Without comment , here's the final result :
      : lst>stk >aux> i# 0 ?do aux@ i i@ refs-ok> loop aux> dup refs@ 0if free then ;
      From the APL perspective , I think this is a good example of the enormously greater flexibility provided by being open in Forth than possible in any C based APL .

      And CoSy is just a zitty teen looking to light up the party .

      BobA

      --

      On 2020-08-31 19:06, Kevin Appert wrote:
      Here is Bill Ragsdale's proposal for the FIG Programming Challenge, attached as a DocX document.

      Please let me know if you don't see the attachment and I'll send it in-line.


      Peace thru Freedom
      Honesty enforced thru Transparency ,
      CoSy  The Shortest Path from the Chip to the Math
      I reserve the right to post all communications I receive or generate to CoSy website for further reflection
      --

    `nuff for now .  Comment below . or stop by the Zoom .

    BobA  | 20200903.2320 |


    CoSy αlpha Membership just $25
     

    Join the development discussion Inclusion or simply to support this most powerful language
    Access to Member simple open email list , cc not bcc . + Members archive directory

      CoSy is arguably the simplest and hardest programming language 
    Ask Me Anything

    Disqus allowed HTML
    comments powered by Disqus


    --

       
    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 /\ /\