Thu.Sep,20220901
  • 4th.CoSy
  • Planetary Temperature
  • CoSy/Life ; CoSy/Liberty
  •   
    © Bob Armstrong
    Extreme Simplicity , Extreme Capability
    your forever intelligent diary in
     if you can think it ,it's done
    language
     8 _iota .. ..  { bool -3 _0fill } 'm  $  { gray -3 _0fill } 'm ,L cL   fmttbl| lfMV
     0   | 0 0 0   | 0 0 0 
     1   | 0 0 1   | 0 0 1 
     2   | 0 1 0   | 0 1 1 
     3   | 0 1 1   | 0 1 0 
     4   | 1 0 0   | 1 1 0 
     5   | 1 0 1   | 1 1 1 
     6   | 1 1 0   | 1 0 1 
     7   | 1 1 1   | 1 0 0 

    | Rather obscene demo of new ' bool & ' gray verbs
    Skip to : #4th.CoSy  #PlanetaryTemperature  #misc
    Please email me to be added to this CoSy list
    Please let me know by return mail if you want to be removed from this list


    Waiting for perfection , this never got published earlier 😞    20221130.1930


    Minimalist Computing Wed.Oct,20221005
    Jonas S Karlsson |  Minimalistic parsing of CSV values
    It actually works in spite of what you may think, and it does the job better than any small codes I've found, and that others have pointed to.
    Yes, it's very "compact" code,  and not how you'd professionaly do it at work,. but we're not at work. I do it for fun, so please keep it nice and focus on good qualities, and minimalism!
    PS:  seems everyone wants to critizie, please don't. I don't need to hear about "professional" programming etc. This is for fun.\
    PSS: Keep in mind that this is "one minimalistic" style that I've choosen, I program on a mobile phone screen, so I like functions to fit on one screern. It's a sport of sorts, but not compromising functionality or correctness.
    And yes I know how to write extreemly clear corporate code that will pass stringent code reviews. But that "costs" much much more.
      . . .

    Jonas S Karlsson Author
    KDB+ is APL influenced, and it's a challenge for many. But it has find it's place and people... (And visualizing GUI )

    Vitaly Lugovskiy
    Jonas S Karlsson   btw., the interesting part with KDB+ here is not even how typical K code looks like, but the underlying C code written by Arthur Whitney. Behold the examples: https://kparc.com/b/ - and this is the kind of code that works in production and is driving multi-trillion $ industry daily.
    KPARC.COM Index of /b/

    Bob Armstrong
    Jonas S Karlsson Arthur knew Ken Iverson from childhood . As I remember his father & Ken were classmates in Alberta . He's ~ the same age as Ken's sons . He created his first APL variant , A+ , at Morgan Stanley and I believe it's still used .
    When Ken , with Roger Hui implementing , split from traditional , tho 2nd generation ( ragged arrays as well as rectangular ) , APL to create the very mathy informed J , Arthur went a more transparent minimalist route with K . K.CoSy , http://cosy.com/K/CoSy.htm , was the perhaps the only notebook/IDE environment built w/i K's dictionary ( list of 2 lists : `( names values )` ) structure .
    4th.CoSy has evolved from that , so is intrinsically a database language --tho tuned to my human size needs rather than the BigData APLs including K generally find as their market . CoSy's purpose is much more as my Tool of Thought to use Ken's Turing lecture title . It's evolved from the original notion of an APL workspace .

    Participating in https://confengine.com/.../CoSy, evolved from APL via K in open Forth last spring made me appreciate just how much more integrated defining and using language is in CoSy than , so far as I have seen , any other language . It's all a reason why in the bit of script I posted yesterday , 14 one line verbs pretty much cover the vocabulary useful for conversion of .csv files to CoSy lists-of-lists -- and the inverse .
    Similar vocabulary exists for conversion of HTML , XML and similar ` bracketing fornats . If they don't exist , they can be created with similar succinctness .
    Many here can appreciate the quantum difference between written in and executing directly in open Forth rather than in C now and for the future . Sorry to have gone off in this tangent , but I've been needing to write a current view to support the implementation of a licensed supported level of CoSy at a price comparable to other APLs .
    https://CoSy.com seeks to , and has been accused of , taking minimality , simplicity , to the extreme at every level from the chip to the math .

    Bob Armstrong
    My goal is minimalism in the amount of code and thought it takes for me to get things done . That implies a large more human level vocabulary of small definitions . I hate FB's lack of a fixed font to display code & said that in a survey they recently sent me ( for all the impact it will have ) .
    Anyway , here's my main vocabulary for converting csv's and similar structures .
    The code is at http://cosy.com/4thCoSy/Code/CoSy/Furniture.f .
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
    | \/ | DictionaryTable > < .csv text | ~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~ |

    | I've used the term , abbreviated ' DT , in K.CoSy with a rather substantial
    | vocabulary . It is the fundamental form of a Kdb columnar data base .
    | A DT is a Dictionary whose first item is a list of column labels and second is
    | a corresponding set of correlated lists of values . This vocabulary converts
    | back and forth between CoSy DTs and standard .CSV strings , the most
    | universal format for bank ledger downloads . See 20171212 .
     
    : csv>lst ( csv d0,d1 -- lst ) 2p> dsc VM dae R@ 1 _at ['] VM 'L 2P> ;
    | Splits string first on d0 then each on d1 .
    | Example |  t1  "nl "ht ,L  csv>lst
    | see also 20180719
    : lst>DT ( lst -- DT ) 1p> dsc R@ 1 _cut flip ,L 1P> ;
    : csv>DT ( csv d0,d1 -- DT ) csv>lst lst>DT ;

    | Splits each of list of strings on commas which are not in quotes
    : ,svMsk >a> "msk 0=i a> ` , =c mini ;  | mask of commas not in quotes | 20200421 |
    : ,sv>lst { >a> dup ,svMsk & 0cut ' dl, 'm a- } 'm  ;
     
    | \/ | Example | \/ |
    | s" C:/CoSy/acnts/y17/CHK.CSV" F> >T0> -2 _take c>i     |>| 13 10
    |  read in and check if line delimiter is "lf or "cr "lf , ie: "nl
    | which is generally the trailing element .  Win uses "nl . most others "lf
     
    | T0 "nl "ht ,L csv>DT >T1     | splits on "nl then each on "ht
    |  | Note the combining of the line and item delimiters by ' ,L
     
    | And the inverse
    : DT>lst  >a> dsc a> 1th { cL enc } 'd ; | redefined 20220926 | appends names back onto columns of values .
    : lst>csv ( lst d0,d1 -- csv ) 2p> dsc ['] MV 'L R@ 1 _at MV 2P> ;
    : DT>csv ( DT d1,d0 -- csv ) 2p> --aba dnames swap MV 2P> ;
     
    |  | Note that the delimiters have to be reversed .
    | T1 "nl "ht ,L reverse DT>csv
     
    | related | 20191006 |
    | executes lists of lines which produce lists , eg: ledger lists w lines like
    |  (' 20190825.1322 _f ` lilBarn ` cash 200. _f  s" Nate " ') 
    | and flips them into column form
    : str>tbl ( strlst -- table ) dae ['] ^eval 'm flip ;

    | splits lst of strs , eg: dirs , on white space | 20191009 | 20191019 |
    : blTbl dup Type@ TypeC =if lfVM then { drb blVM } 'm flip ;

    | /\ | DictionaryTable > < .csv text | \~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\ |
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |

     
    Doug Cree
    Be warned that there is no “CSV standard”; there are dozens of “CSV standards” each with one or more aggravating hair-pulling modifications.

    Simon Krix
    Doug Cree the day I hit Excel format files with embedded newlines inside quotes I died a little inside

    Bob Armstrong
    Simon Krix That's the purpose of my ` ,sv words .
    | Splits each of list of strings on commas which are not in quotes
    : ,svMsk >a> "msk 0=i a> ` , =c mini ; | mask of commas not in quotes | 20200421 |
    : ,sv>lst { >a> dup ,svMsk & 0cut ' dl, 'm a- } 'm ;
    Built on
    | Mask of ` quoted portions of strings . single symmetric delimiter | 20200202
    | given bool of occurrences of delimiter , eg: | str ` " =c | returns bool covering quoted sections
    : qmsk I>M ['] <> scanI 0<i >a> 1 1 2 s>iv { *i ['] maxi ./ >_ } convo a> dsc swap cL ;
    : "msk ` " =c qmsk ;

    These are distinctly APL level words :
    `( scanI convo )` ' :?? 'm
    (
    (
    ./CoSy/CoSy.f
    : scanI local[ RA fn | R -- R ] | raw scan over interger vecs .
    RA i# intVecInit to R RA 0 i@ R 0 i!
    RA i# 1 ?do R i 1- i@ RA i i@ fn execute R i i! loop
    RA ref0del R ;
    | done | NB : it might be possible to move this before , and use it in refs- .
    ) (
    ./CoSy/CoSy.f
    : convo ( LA RA fn -- res ) | Applies RA fn across LA RA rho at a time | 20200130
    | must return naked value , eg: naked ints . Note that string search is a convolution .
    >lpstk 2p R@ rho iota >a
    L@ i# R@ i# - L@ Type@ VecInit >lpstk> i# 0 ?do
    L@ i _i a@ +i at R@ lpstkx@ execute lpstk@ i i! loop
    a- lpstk> lpstkdrop 2P> ;
    ) )

    Incidentally , there is now a supported level of CoSy at an APL level price .

      https://www.facebook.com/groups/minimalistcomputing/posts/778438629912934/

    Bob Armstrong
    The heart of https://cosy.com/4thCoSy/Code/CoSy/CoSy.f supplying an APL>K level environment in Forth is its reference counted memory management . Almost any command you give , eg: simply asking for help on a word -- which returns all occurrences of the word in the scripts -- creates and destroys thousands or tens of thousands of lists ( everything's a list ) . It's some of the first code defined . There's a switch to compile logging of all mallocs & frees for debugging . And a bit of script in https://cosy.com/4thCoSy/Code/CoSy/WorkLog.csy Job to analyze the logs .
    Overall , I astounded how fast everything is on a , currently , Inte i5-8259U CPU @ 2.30GHz . And that's with modulo indexing on all references . If I had realized how much speed I had , I might have made some different design decisions .
    But even so , the major factor , other than the unoptimized modulo indexing , in CoSy undoubtedly being perhaps an order of magnitude slower than http://Kx.com is that I simply used the OS malloc & free , rather than implementing a 2^n slot inventory ala Arthur Whitney in which nothing ever moves . It doesn't look that complicated , and when moving to a stand alone bare metal Forth based system , I expect it not to be difficult to implement .


    CoSy is the simplest most productive programming environment
    for ` ordinary people , built on the most ` powerful ideas from APL & Forth




    The Code is the Theory
    CoSy is arguably the Simplest and Hardest programming language
    Send me Comments or Ask Me Anything
    I greatly appreciate feedback on any topic


    Add CoSy to your talents , and your talents to CoSy , The Fresh Paradigm in programming language and interface . Details


    #PlanetaryTemperature #Top


    " What we will be leaving our grandchildren is not a planet damaged by industrial progress, but a record of unfathomable silliness as well as a landscape degraded by rusting wind farms and decaying solar panel arrays. "
    Richard Lindzen
    The hundred ton concrete & rebar plugs embedded in lands across the land will last those thousands of years .
    See Daily Blog for continuing comments & reactions to posts




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


    #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 | 20220707.0834 |

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