MidSummer
2023

Please let me know by return mail if you want to be removed from this list

Sat.Aug,20230805.1400 ---
Saturday , August 5 , 2pm til ... whenever

Watching the ` straights on the Pikes Peak 2023 Hillclimb

An afternoon at Altitude
Invite your friends . Bring your kids . 12 interesting acres ( 12. 2.47 2_f %f  |>| 4.86 | hectares ) to wander
Catch some grasshoppers for Sal , the salamander
Visiting CO ?     Camp in the dell by the well
We'll smoke some meat , have a variety of liguids , BYO if you've got something interesting
28124 Highway 67 / Woodland Park , Colorado / 80863-9711 | Bob Armstrong ; 719-337-2733
Note: there's some renovation & upgrading of the property going on .
RSVP




An email exchange :
-------- Forwarded Message --------
Subject:              How would you do it in COSY
Date: Fri, 7 Jul 2023 10:04:00 -0400
From: avi.e.gross@gmail.com
To: Bob@CoSy.com

https://www.r-bloggers.com/2023/07/array-languages-r-vs-apl/
 
Avi

from Avi Gross ,  a fellow very long term investor in a ` smart glass company " in development " about as long as CoSy ,  triggered my following the link he mentioned , eventually to Conor Hoekstra's  APL vs BQN vs J vs Q vs NumPy vs Julia vs R prompting the email below which ended up not getting sent until now  :

Conor ,

While 4th.CoSy is still only my creation , the product of an adult life in APL , evolved and simplified thru K , as an open vocabulary in Forth , it is at the same level of expressive power as the languages you demonstrate but far simpler being Forth RPN -- and radically more flexible being open code all the way to the ` silicon . Chuck Moore's simple use of whitespace as the prime delimiter is an unappreciated brilliance .

  Here's a rather complete answer to Avi's question which in r-bloggers  is :

    Find the GCD (greatest common divisor) of the smallest and largest numbers in an array

and the solution given in Dyalog APL is

    ⌈/∨⌊/

I believe ` or , , was extended to also be gcd after I split with traditional APL following Arthur Whitney into K because of its greater simplicity and transparency of structure . Thus CoSy is purely lists of lists . In fact , at the Forth ( hardware ) level the 3 cell header of a CoSy object is simply `( Type Count refCount )` . Thus it intrinsically follows your " Leading Axis " notion .

I wasn't sure whether I had implemented gcd in 4th.CoSy so I checked old K.CoSy . This is the definition I used there :
gcd
 Greatest Common Divisor . From Eugene McDonnell's Kidioms list

{ * | 1 + & &/' 0 = x !/: 1 + ! &/ x }

It works on whole lists . When I examine it , it's not terribly efficient .

I see that I do have a gcd in the current https://cosy.com/4thCoSy/Code/CoSy/math.f script :
: _gcd ( a b -- c) | Jack Browns recursive  greatest common divisor | raw Forth
    dup if swap over mod _gcd else drop then ;
 | From https://ronware.org/reva/wiki/index.php/Intermediate_Tutorial
 
: gcd ' >_ on2 _gcd _i ;     | ' gcd at CoSy level
Brown's algorithm looks pretty efficient . I don't think the recursion could ever go very deep . Here are the definitions and  the x86 for mod and /mod which get called .

       `( mod /mod )` { dup Help $ See ,L } 'm
    (
     (
      mod ( a b -- n ) 'forth
    Context: ~
    Source in: src/reva.f
        Divide a by b, and put the modulus (remainder) on TOS: n=a%b
    See also: * */ + - / /mod 1+ 1- 2* 2/ << >>

    0061BEE8  E8 E3 FF FF FF              call /mod
    0061BEED  8B 06                       mov eax,[esi]
    0061BEEF  8D 76 04                    lea esi,[esi+04]
    0061BEF2  C3                          ret

     ) (
      /mod ( a b -- rem quo ) 'forth
    Context: ~
    Source in: src/reva.f
        Divide "a" by "b", place remainder and quotient on stack
    See also: * */ + - / 1+ 1- 2* 2/ << >> mod

    0061BED0  89 C3                       mov ebx,eax
    0061BED2  8B 06                       mov eax,[esi]
    0061BED4  99                          cdq
    0061BED5  F7 FB                       idiv ebx
    0061BED7  89 16                       mov [esi],edx
    0061BED9  C3                          ret

     ) )

One of CoSy's brilliances is that all indexing is modulo . This subsumes such notions as scalar extension and eliminates all length errors .

Another brilliance of Forth is that the single quote , ' , returns the address of the next word , even if its a verb . Thus defining verbs which take both nouns and verbs as arguments ( I like Iverson & Hui's use of adverb for such words ) is trivial . For instance , the phrase in ' gcd above
' >_ on2
  applies  >_
: >_ ( disclose  non-nested  and free if 0 refs ) dup 0 i@ swap ref0del ;
to each of the top 2 CoSy level stack items to get the raw numbers the Forth level _gcd needs .

Anyway , here's an answer to the original problem
  i( 18 24 32 0 )i >t0
  t0  .+   ' maxi ./ $  ' mini ./  gcd    
| dup the list , apply ' max across ,
|  swap ( aka commute ) , apply ` min across , then ' gcd between them
32
: minmaxgcd .+   ' maxi ./ $  ' mini ./  gcd ;    | make it a word

  t0 -1 _cut  minmaxgcd            | drop that trailing 0 . Do again .
2

Conor , I think you can see that CoSy , immature and in need of more heads as it is , is on a level comparable to those other array languages , but far simpler -- and being simply a vocabulary in open Forth , is unmatched in flexibility . CoSy as it stands is just a starting point -- a bridge between brilliances of Iverson and Moore .

All the best ,

Bob A

ps ( continuing watching your vid ) | 20230708.0039 | :
Your example of Q , shows it is far more prolix than the K it evolved from after it was clear working with the Whitneys was a dead end and I had to figure out how to roll my own APL in Forth was my only path to what , since I learned of Forth 40 years ago , I saw was possible .

pps :  I really should do the problem in your vid .
: Imat >a i1 i0 cL a@ i1 +i fill a> 2 _take take ;     | function ( verb ) to create Identity matrices
 `i 4 Imat .+ ' reverse 'm ori >t0>     | make the canonical X matrix
(
 1 0 0 1
 0 1 1 0
 0 1 1 0
 1 0 0 1
 )

  i( 2 0 0 1 0 3 1 0 0 5 2 0 4 0 0 2 )i i( 4 4 )i take >t1>    | create data matrix
(
 2 0 0 1
 0 3 1 0
 0 5 2 0
 4 0 0 2
 )

  t1 -0+i    | at Forth level : sn ( n -- -1 | 0 | 1 ) dup 0 >I $ 0 <I - ;  | sign of n , signum
(
 1 0 0 1
 0 1 1 0
 0 1 1 0
 1 0 0 1
 )

  R0 t0 ==   | R0 always contains last result .
1

ppps : | 0201 | I strongly recommend anyone watching Conor's not miss the end , the C++ approach .
 


Add CoSy to your talents , and your talents to CoSy  , A Fresh Paradigm in programming language and interface .
See αlphas


Most recent activity has been on Facebook & Twitter and linked in  my Daily Blog

See particularly the extended discussion at Reply to Roy Spencer including :
 
Bob Armstrong
Any HONEST , I repeat HONEST quantitatively educated person can see thru this anti-science wannabe Tyrannical Global Statist Cult demonizing the very molecular basis of LIFE .

Al Gore Warming and its even Stupider claims of Climate Catastrophe FAILS HONEST SCIENCE across the board , from Biology to Geology to Physics .

It is the most destructive ` Useful Stupidity in history . When you target the molecule all life has been built on for over 2,000,000,000 years , since before that life it enabled it was ~ 30% , 3000 molecules out of every 10k , of the atmosphere ,
now bouncing along at a near plant starvation 3 or 4 ,
YOU WILL LOSE .

" Science " brought to us by the same people who can't count the number of strands in a DNA double helix and condone the castration and spaying of children .

Contribute to K12 Honest Science

Cirriculum , get a CO2+H2O=LIFE tee shirt

When all else fails REALITY prevails .


Check the Daily Blog for more , and links on these and other topics .
Coming : premium daily Blog updates : winnowed links to news , commentary & tek
 
If you are running CoSy, the ` Job is downloadable at https://cosy.com/y23/blog.csy giving you all the tools for searching , extracting , etc that the CoSy vocabulary provides .


Error: Embedded data could not be displayed.   See online


Previous
§ Mon.Jul,20200713 § Wed.Aug,20200812 § Wed.Sep,20200902 § Wed.Sep,20200916 § Wed.Sep,20200930
§ Wed.Oct,20201014 § Wed.Oct,20201028 § Wed.Nov,20201111 § ThanksGiving 2020 § Christmas 2020
§ Wed.Jan,20210113 § Wed.Jan,20210127 § Wed.Feb,20210210 § Wed.Feb,20210224 § Wed.Mar,20210310
§ Wed.Mar,20210324 § Wed.Apr,20210407 § Wed.Apr,20210421 § Wed.May,20210505 § Wed.May,20210519
§ Wed.Jun,20210602 § Wed.Jun,20210616 § Wed.Jun,20210630 § Wed.Jul,20210714 § Wed.Jul,20210728
§ Wed.Aug,20210804_MMM_special        § Wed.Aug,20210818 § Wed.Sep,20210901 § Wed.Sep,20210915
§ Wed.Sep,20210929 § Wed.Oct,20211013 § Thu.Oct,20211021 § Sun.Oct,20211031 § Sun.Nov,20211114
§ Sun.Nov,20211128 § Sun.Dec,20211212 § Special Wed.Dec,20211222 § Special Wed.Dec,20211229
§ Wed.Jan,20220112 § Sun.Jan,20220130 § Sun.Feb,20220213 § Sun.Feb,20220227 § Sun.Mar,20220320
§ Wed.Apr,20220420 § Wed.May,20220525 § Mon.Jul,20220704 § Sun.Jul,20220731 § Thu.Sep,20220901
§ Wed.Dec,20221214 § Wed.Dec,20221224 § Sat.Feb,20230204 § Mon.May,20230501


#Top
| Note , the whole of this blogPost , it's mailing list , and all of  the CoSy website is created by me ,
 Bob Armstrong , using 
CoSy and a wysiwyg editor .

| BobA | 20230508.1247 |

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