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 . | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 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 These are distinctly APL level words :
`( scanI convo )` ' :?? 'm 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
" 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 .
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 .
|