#] #] ********************* #] "$d_Qndfs"'QNial [symbol, arg] changes/0_0_QNial symbol notes.txt' - #] mass changes to [symbol name, arg [order, number]]s # www.BillHowell.ca 11Nov2021 initial # view this file in a text editor, with [constant width font, tab = 3 spaces], no line-wrap # 10Feb2022 Note : 'QNial symbol changes.ndf' is the starting point for the 'QNial [symbol, arg] changes/' project temporary operators to use while the core QNial is messed up "working" operators, when completed, are moved into : [types, faults, boolean, arrays, lists, strings, file_ops].ndf # Instructions : # '0_QNial symbol notes.txt' # '1_QNial symbol plan.txt' # '3_QNial symbol - draft listings to use for changes.txt' # for the project to revamp all my QNial symbol [name, arg[order, number]] : # "$d_Qtest"'QNial [symbol, arg] changes/' # 'Qndfs optr symbol changes - develop tests.txt' # 'Qndfs optr symbol changes - tools, ToDos.txt' # other .ndf test [files, subDirs] # For testing, see "$d_Qtest"'QNial test notes.txt' 48************************************************48 24************************24 # Table of Contents, see ToC file - not listed [here, screen] as it's too large! : # $ grep "^#]" "$d_Qndfs"'QNial [symbol, arg] changes/0_QNial symbol notes.txt' | sed 's/^#\]/ /' ********************* "$d_Qndfs"'QNial [symbol, arg] changes/0_QNial symbol notes.txt' - mass changes to [symbol name, arg [oreder, number]]s ToDos 16Feb2022 bring back old, working] [lists, strs].ndf - I need something that I can rely on now 15Feb2022 string [test, fix] boolL_cut_ary_test IS - res ipsa loquitor 13Feb2022 revamp test optrs, see "$d_Qtest"'QNial test notes.txt' 12Feb2022 status- tests on [type, fault, boolean, array, list, string, file_op, window]s 11Feb2022 from yesterday's loaddefs, array issues : 10Feb2022 restart project : setup ndfs for 'QNial [symbol, arg] changes/', Fix current loaddefs errors 11Dec2021 slcIndxL_splitSeparate_ary IS OP slcIndxL ary - ary is split at each slcIndx boolA_cut_ary IS OP boolA ary - extract an ary (array) of subArys from boolA ary of atoms (eg [strings, integer, real, complex, phrase, boolean]) must be made solitary if needed very tricky - this will be hard to use for complex arys, mayeven for simple arys? 11Dec2021 sub_checkFitIntoTop_ary 05Dec2021 tstDatStd, revamped sub_posnA1stItmInTop_ary 02Dec2021 string tests 28Nov2021 revamp position (posn) optrs - all [lst, str] are ary-based 22Nov2021 revamp tests lstL_linkSortCullByCommonItmsTo_lstIndxL IS OP lstL - finds indexs of common items lstL_linkSortCullByCommonItmsTo_lstIndxL_tests IS 19Nov2021 revert back to [list, string]s.ndf - NOT the same as for arys!!! lst_takeBetween_subP IS OP lst subP - extract between lstFront & lstEnd str_isBlank IS OP Str - test that string is entirely "whitespace" (space, tab, CR, NL) str_isWhite IS OP line - tests if a line is all "whitespace" [space, tab, CR, \n] write_testStr IS OP t_name t_input t_standard t_result - means of testing string answers str_isOf_chrSet IS OP str chrSet - true if all chrs in str are in chrSet str_eachChrIs_white IS OP Str - boolean list of text - l for whitespace, o for other ary_strip_slc IS OP ary slc - removes slc from ary boolL_hold_lst IS OP boolL lst - boolean list link adjacent l sublists, returns lst lst_indxL_to_boolL IS OP indxL lst - boolL = l (true) for all indxL, otherwise o (false) boolL_keep2_lst IS OP boolL - keep lst according to boolean = l (true), returns lstL lst_keep_itmL IS OP lst itmL - cut lst at each itmL, retain itmL, omit non-itmL, returns a LIST! itmL_cut_lst IS OP itmL lst - cut a lst at each itm, omitting itm, returns a LIST! 15Nov2021 move sed/grep stuff to [file_ops.ndf, 'fileops/fileops- test.ndf'] ary_replaceAll_pair IS OP ary pair - aryOld is replaced by aryNew in ary subL_splitSeparate_ary IS OP subL ary - recursively separate ary where each subL occurs, subL_splitAtFront_ary IS OP subL ary - splits ary at each point that an item of subL occurs subL_anyInTop_ary IS OP sub ary - returns true if ANY of sub are in ary itmL_cut_ary IS OP itmL ary - cut ary at each itm, omitting itm, returns a LIST! aryL_keep_itmL IS OP aryL itmL - cut each aryL by including itmL, omitting non-itmL, 11Nov2021 how many .ndf files are in d_Qndfs subdirectories? 24************************24 08********08 #] ToDos - see "d_Qndfs"'QNial [symbol, arg] changes/1_QNial symbol plan.txt' 08********08 #] ??Apr2023 08********08 #] ??Apr2023 08********08 #] ??Apr2023 08********08 #] ??Apr2023 08********08 #] ??Apr2023 08********08 #] 08Apr2023 LST_STRIP_SUB $ find "$d_Qndfs" -maxdepth 4 -type f -name "*.ndf" | grep --invert-match "z_Old\|z_Archive" | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number "lst_strip_sub" "FILE" +--+ /home/bill/web/Qnial/MY_NDFS/lists.ndf:53:#l lst_strip_sub IS OP lst sub { fault '?lst_strip_sub undefined (QNial setup header.ndf)' } /home/bill/web/Qnial/MY_NDFS/file_ops.ndf:168: ELSE subDir fname := ((pth ary_getAfter_sub dirBase) lst_strip_sub fname) fname /home/bill/web/Qnial/MY_NDFS/file_ops.ndf:513: pthShortL := pthL EACHLEFT lst_strip_sub (link d_Qtest 'fileops/') ; /home/bill/web/Qnial/MY_NDFS/QNial [symbol, arg] changes/QNial symbol header.ndf:283: 'str_strip_subStr' 'lst_strip_sub' '' /home/bill/web/Qnial/MY_NDFS/QNial [symbol, arg] changes/QNial userWkspSymbol.ndf:125: dirBaseL := (pndfL EACHLEFT lst_strip_sub d_Qndfs) ; /home/bill/web/Qnial/MY_NDFS/QNial [symbol, arg] changes/QNial userWkspSymbol.ndf:254: adjectiveStr:= argStr lst_strip_sub nounStr ; /home/bill/web/Qnial/MY_NDFS/QNial [symbol, arg] changes/QNial userWkspSymbol.ndf:257: adjectiveStr := lst_strip_sub adjectiveStr adjective ; +--+ Next few days, worked on [types, arrays]: changes to fault handline (added to most optrs) all core: symbol updates See individual develop files... 08********08 #] 16Feb2022 bring back old, working] [lists, strs].ndf - I need something that I can rely on now This is going to take forever in the most general form!!! I am wasting far too much time! Some reference points to optr code when it worked? Last good test of strings.ndf : finish time : Fri Nov 5 15:26:26 2021 211101 09h10m29s boolean.ndf What a messy mess!!!?? Take a look tommorow and see what can be salvaged. A lot of great code on all sides, and I'm stuck in the middle of a great transition. 08********08 #] 15Feb2022 string [test, fix] strings_clusterTest results: +--+---------------------+-------+------+-----+ |OK|test (group) |correct|faults|total| +--+---------------------+-------+------+-----+ | o|str_isIn_groupTest | 31| 31| 35| +--+---------------------+-------+------+-----+ | o|str_cleanup_groupTest| 2| 2| 12| +--+---------------------+-------+------+-----+ | o|str_convert_groupTest| 0| 0| 6| +--+---------------------+-------+------+-----+ | o|str_unicode_groupTest| 0| 0| 6| +--+---------------------+-------+------+-----+ finish time : 220215 13h17m12s looking at str_removeExtra_SpcTab, key optr is : strSplit := boolL boolA_cut_ary str ; >> good lesson, should start by [test, fix] boolean.ndf Does boolL_cut_ary appear awhere in my QNial code, other than : d_Qtest 'boolean/boolean- testOptrs.ndf' from : d_Qndfs 'QNial [symbol, arg] changes/QNial userWkspSymbol.ndf' # List usage of one of Howells QNial [optr,var,etc]s - bash command line, substitute for # actually good for any text in .ndf files $ find "$d_Qroot" -name "*.ndf" | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | sort | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number 'boolL_cut_ary' "FILE" /media/bill/Dell2/Website - raw/Qnial/code develop_test/boolean/boolean- testCluster.ndf:50: boolL_cut_ary_test /media/bill/Dell2/Website - raw/Qnial/code develop_test/boolean/boolean- testCluster.ndf:74: 'boolL_cut_ary_test' /media/bill/Dell2/Website - raw/Qnial/code develop_test/boolean/boolean- testOptrs.ndf:97:IF flag_debug THEN write 'loading boolL_cut_ary_test' ; ENDIF ; /media/bill/Dell2/Website - raw/Qnial/code develop_test/boolean/boolean- testOptrs.ndf:99:#] boolL_cut_ary_test IS - res ipsa loquitor /media/bill/Dell2/Website - raw/Qnial/code develop_test/boolean/boolean- testOptrs.ndf:102: boolL_cut_ary_test := /media/bill/Dell2/Website - raw/Qnial/code develop_test/boolean/boolean- testOptrs.ndf:104:"boolL_cut_ary >> Hah! it doesn't exist but the tesstill runs >> Remove it +-----+ olde code IF flag_debug THEN write 'loading boolL_cut_ary_test' ; ENDIF ; #] boolL_cut_ary_test IS - res ipsa loquitor # 15Feb2022 doesn't exist anymore,t executes? boolA_cut_ary_test does this? # $ boolL_cut_ary_test := "tstSimple 2 "boolL_cut_ary d_boolTests ( "t01 llllolllll "cut 'abcdefghij' ('abcd' 'fghij') '?comment?' "t02 ollllllllll "cut 'abcdefgdefj' ['bcdefgdefj'] '?comment?' "t03 llllllllllo "cut 'abcdefgdefj' ['abcdefgdef'] '?comment?' "t04 lllolllolll "cut 'abcdefgdefj' ('abc' 'efg' 'efj') '?comment?' "t05 lllllllolllll "cut 'abcd /* sdgb' ('abcd /' ' sdgb') '?comment?' "t06 lllllllollllllollllolllllllllllol "cut 'abcd /* sdgb */ /*dkrifggkgfg*/' ('abcd /' ' sdgb ' '/ /' 'dkrifggkgfg' '/') '?comment?' "t07 lllllllollllllllollllllooolollllllolllllloll "cut 'abcd /* sdgb /*jhkjk *** */ sd/*zfes /*fr' ('abcd /' ' sdgb /' 'jhkjk ' ' ' '/ sd/' 'zfes /' 'fr') '?comment?' "t10 llllolllll "cut (tell 10) ((0 1 2 3) (5 6 7 8 9)) '?comment?' "t20 lllllllollllll "cut (transpose mix (0 1 2 3) (5 6 7 8 9)) (fault '?booleanL_cut_ary error, ~= (EACH (gage shape) booleanL list)') '?comment?' "t21 llllolllll "cut (tell 2 5) (fault '?booleanL_cut_ary error, ~= (EACH (gage shape) booleanL list)') '?comment?' "t22 ((llllo)(lllll)) "cut (2 5 reshape (tell 10)) (fault '?booleanL_cut_ary error, ~= (EACH (gage shape) booleanL list)') '?comment?' ) ; 08********08 #] 13Feb2022 revamp test optrs, see "$d_Qtest"'QNial test notes.txt' 08********08 #] 12Feb2022 status- tests on [type, fault, boolean, array, list, string, file_op, window]s see "$d_Qtest"'1_status- tests on [type, fault, boolean, array, list, string, file_op, window]s.txt' 08********08 #] 11Feb2022 from yesterday's loaddefs, array issues : not defined yet? : ary_invert_slcindxA - used ary_invert_slcIndxL as ghost ary_invert_slcindxA global_axisSplitL - rename as global g_axisSplitL used to reduce overhead in [repeat, nest]ed calcs slc_splitSeparate_ary - missing! I do have slc_split[AtFront, AtEnd]_ary These are defined but seem mis-named? : indxA_slice_ary -> rename as slcIndx_splitSeparate_ary slcindxA_axis_slice_ary -> rename as defined, but depend on one of undefined above : sub_splitSeparate_ary - should be replaced by ary_subP_splitSeparateTo_midIndxs_subL - also used by strings.ndf +-----+ either [fix, fudge] operators to silence errors for now remake ToC! 08********08 #] 10Feb2022 restart project : setup ndfs for 'QNial [symbol, arg] changes/', Fix current loaddefs errors +-----+ move Howell's symbol [name, arg[order, number]] files to QNial [symbol, arg] changes added symbols project to start.sh, create 'start_QNial_mySyms.sh' start qnial - mostly array problems see "$d_Qndfs"'QNial [symbol, arg] changes/0_QNial symbol notes.txt' +-----+ loaddefs problems, for notes see : "$d_Qtest"'arrays/array- develop.txt' 08********08 #] 11Dec2021 slcIndxL_splitSeparate_ary IS OP slcIndxL ary - ary is split at each slcIndx # qnial> ary := 3 4 reshape (tell 50) 0 1 2 3 4 5 6 7 8 9 10 11 qnial> ((1 2) cart (tell 4)) +---+---+---+---+ |1 0|1 1|1 2|1 3| +---+---+---+---+ |2 0|2 1|2 2|2 3| +---+---+---+---+ qnial> ary#((1 2) cart (tell 4)) 4 5 6 7 8 9 10 11 qnial> ary|[1 2, ] 4 5 6 7 8 9 10 11 qnial> ary|[,1 2 ] 1 2 5 6 9 10 qnial> a|[0,] ary|[1 2, ] +-------+---------+ |5 6 7 8|4 5 6 7| | |8 9 10 11| +-------+---------+ Is there a form of slicing that I can use with a transformer? >> can't find it, must make my own? >> easiest way is to use FOR loop... >> OR define slc_slice_ary then use standard QNial transformrs (best way) +-----+ olde code 14Dec2021 # qnial> ary := 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' qnial> sub := 'Subject: ' qnial> sub_posnAAllItmInTop_ary sub ary +--------------------------+ |38 39 40 41 42 43 44 45 46| +--------------------------+ qnial> a := ary EACHRIGHT ary_indexA_convertTo_boolA (sub_posnAAllItmInTop_ary sub ary) +----------------------------------------------------------------------+ |oooooooooooooooooooooooooooooooooooooolllllllllooooooooooooooooooooooo| +----------------------------------------------------------------------+ qnial> OR (ary EACHRIGHT ary_indexA_convertTo_boolA (sub_posnAAllItmInTop_ary sub ary)) oooooooooooooooooooooooooooooooooooooolllllllllooooooooooooooooooooooo qnial> b := (OR (ary EACHRIGHT ary_indexA_convertTo_boolA (sub_posnAAllItmInTop_ary sub ary))) oooooooooooooooooooooooooooooooooooooolllllllllooooooooooooooooooooooo qnial> b sublist ary Subject: qnial> (NOT b) sublist ary Fauci, Anthony (NIH/NlAID) (E] <{-----Coronavirus on surfaces # sub := 'zebra' IF flag_debug THEN write 'loading boolA_cut_ary' ; ENDIF ; #] boolA_cut_ary IS OP boolA ary - extract an ary (array) of subArys from boolA #] ary of atoms (eg [strings, integer, real, complex, phrase, boolean]) must be made solitary if needed #] very tricky - this will be hard to use for complex arys, mayeven for simple arys? # 30Sep2021 initial # boolA_cut_ary_test # 30Sep2021 should be able can use boolA_cut_ary to knock out [row, col]s of array!!! (tricky) boolA_cut_ary IS OP boolA ary { IF (~= (TWIG (gage shape) boolA ary)) THEN fault '?boolA_cut_ary error: ~= (EACH (gage shape) boolA ary)' ELSE boolA EACHBOTH boolA_cut_ary ary ENDIF } 08********08 #] 11Dec2021 sub_checkFitIntoTop_ary +-----+ olde code # tstDatStd sub_checkFitIntoTop_ary_testDatStd # qnial> a := sub_checkFitIntoTop_ary '[#=; backtrack ;=#]Howell - Mega-Life, Mega-Death and the Sun, the rise and f_lstl of civilisations.pdf' '[#=; backtrack ;=#]' ?scfa2 qnial> gage shape a >> null # "null_null01 qnial> a := sub_checkFitIntoTop_ary null null >> null? qnial> gage shape a 0 >> interesting - what is a? qnial> type a >> null qnial> type null >> null qnial> diagram a + | + qnial> b := single null o+ || ++ qnial> type b o+ || ++ qnial> diagram b o-+ |+| ||| |+| +-+ >> I've never found out what this is!!???!! # "atm_lst01 qnial> a := sub_checkFitIntoTop_ary ` 'the bigg fat cow' >> space (not null!!) qnial> type a >> space (not null!!) qnial> diagram a +-+ | | +-+ qnial> a = [null] o qnial> a = ` o qnial> a = ' ' l # "atm_null01 qnial> a := sub_checkFitIntoTop_ary 4 null ?scfa2 qnial> diagram a ?scfa2 qnial> shape a >> null? # "atm_lst02 qnial> a := sub_checkFitIntoTop_ary 4 (tell 10) 4 qnial> qnial> shape a 1 qnial> isinteger a o qnial> diagram a +-+ |4| +-+ qnial> diagram 4 4 qnial> a = [4] l # "atm_atm02 qnial> a := sub_checkFitIntoTop_ary 4 4 4 qnial> diagram a 4 qnial> shape a >> null? # "atm_atm01 qnial> a := sub_checkFitIntoTop_ary `g `g g qnial> a = `g l # "atm_ary01 qnial> a := sub_checkFitIntoTop_ary 4 (4 5 reshape (tell 30)) 4 qnial> shape a 1 1 # "lst_ary01 qnial> a := sub_checkFitIntoTop_ary (5 6 7 8) (4 5 reshape (tell 30)) 5 6 7 8 qnial> shape a 1 4 08********08 #] 05Dec2021 tstDatStd, revamped sub_posnA1stItmInTop_ary 05Dec2021 tstDatStd IS OP tstInputs - really simple test of operators 07Dec2021 revamped sub_posnA1stItmInTop_ary - now 17/17 tests OK!!! +-----+ olde code # 28Nov2021 qnial> sub_posnAAllItmInTop_ary (4 5) (tell 10) +---+ |4 5| +---+ qnial> sub_posnAAllItmInTop_ary (4 5) (link (tell 10) (tell 10)) +---+-----+ |4 5|14 15| +---+-----+ qnial> sub_posnAAllItmInTop_ary '[#=; backtrack ;=#]' '[#=; backtrack ;=#]Howell - Mega-Life, Mega-Death and the Sun, the rise and fall of civilisations.pdf' +----------------------------------------------+ |0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18| +----------------------------------------------+ # 30Nov2021 qnial> tstSimple sub_posnAAllItmInTop_ary_test >> 8/10 OK - not bad... # 03Dec2021 qnial> a := sub_splitAtEnd_ary 'o' 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' +------------+-------------------------------------+--+---------+----------+ |Fauci, Antho|ny (NIH/NlAID) (E] <{-----Subject: Co|ro|navirus o|n surfaces| +------------+-------------------------------------+--+---------+----------+ qnial> b := link ('Subject: ' EACHRIGHT sub_splitAtEnd_ary a) +------------+-----------------------------------+--+--------------------------------------------------------- |Fauci, Antho|ny (NIH/NlAID) (E] <{-----Subject: |Co|?boolA_splitJoin_ary error : (~= EACH (gage shape) boo +------------+-----------------------------------+--+--------------------------------------------------------- ~~:~~ --------+---------+----------+ lA ary)|navirus o|n surfaces| --------+---------+----------+ >> 'r' becomes a char !! qnial> e := link ('Subject: ' EACHRIGHT sub_splitAtEnd_ary a) # olde code IF (AND (isstring sub) (1 = (gage shape sub))) THEN aryL#subIndxL := (gage shape subIndxL) reshape [sub] ; ENDIF ; IF (null = (gage shape aryL)) THEN aryL := [aryL] ; ENDIF ; subIndxL := ((first sub) EACHRIGHT = aryL) sublist (tell shapeAryL) ; IF (= null subAry) THEN subAry := aryL@(i) ; ELSE subAry := aryL@(i) ; ENDIF ; # qnial> a := subL_splitAtFront_ary ('Anthony ' 'Subject: ') 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' # qnial> 'Anthony ' EACHRIGHT sub_splitAtFront_ary 'Fauci, Anthony (NIH/NlAID) (E] <{-----' 'Subject: Coronavirus on surfaces' +-----------------------------------------++ |+-------+-------------------------------+|| ||Fauci, |Anthony (NIH/NlAID) (E] <{-----||| |+-------+-------------------------------+|| +-----------------------------------------++ # qnial> a := subL_splitAtEnd_ary ('Anthony ' 'Subject: ') 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' # qnial> 'Anthony ' EACHRIGHT sub_splitAtEnd_ary 'Fauci, Anthony (NIH/NlAID) (E] <{-----' 'Subject: Coronavirus on surfaces' +-----------------------------------------++ |+-------+-------------------------------+|| ||Fauci, |Anthony (NIH/NlAID) (E] <{-----||| |+-------+-------------------------------+|| +-----------------------------------------++ # 03Dec2021 qnial> a := sub_splitAtFront_ary 'o' 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' +-----------+-------------------------------------+--+---------+-----------+ |Fauci, Anth|ony (NIH/NlAID) (E] <{-----Subject: C|or|onavirus |on surfaces| +-----------+-------------------------------------+--+---------+-----------+ qnial> b := link ('Subject: ' EACHRIGHT sub_splitAtFront_ary a) +-----------+---------------------------+----------+---------+-----------+ |Fauci, Anth|ony (NIH/NlAID) (E] <{-----|Subject: C|onavirus |on surfaces| +-----------+---------------------------+----------+---------+-----------+ # qnial> a := sub_splitSeparate_ary 'o' 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' +-----------+-+------------------------------------+-+-+-+--------+-+----------+ |Fauci, Anth|o|ny (NIH/NlAID) (E] <{-----Subject: C|o|r|o|navirus |o|n surfaces| +-----------+-+------------------------------------+-+-+-+--------+-+----------+ qnial> b := link ('Fauci' EACHRIGHT sub_splitSeparate_ary a) +-------+--------+-----------------------+---------+-----------------------+ |Fauci, |Anthony |(NIH/NlAID) (E] <{-----|Subject: |Coronavirus on surfaces| +-------+--------+-----------------------+---------+-----------------------+ qnial> b := link ('NIH' EACHRIGHT sub_splitSeparate_ary a) +-----------+-+----+---+-----------------------------+-+-+-+--------+-+----------+ |Fauci, Anth|o|ny (|NIH|/NlAID) (E] <{-----Subject: C|o|r|o|navirus |o|n surfaces| +-----------+-+----+---+-----------------------------+-+-+-+--------+-+----------+ qnial> a := sub_splitSeparate_ary 'zebra' 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' +----------------------------------------------------------------------+ |Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces| +----------------------------------------------------------------------+ qnial> a := sub_splitSeparate_ary null 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' +----------------------------------------------------------------------+ |Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces| +----------------------------------------------------------------------+ # develop : sub_posnA1stItmInTop_ary IS OP sub ary - addr of 1st item of sub in TOP level of ary, qnial> ary := 3 3 5 reshape tell 50 0 1 2 3 4 15 16 17 18 19 30 31 32 33 34 5 6 7 8 9 20 21 22 23 24 35 36 37 38 39 10 11 12 13 14 25 26 27 28 29 40 41 42 43 44 qnial> shaper := 1 2 4 1 2 4 qnial> tellShaper := EACH tell shaper +-+---+-------+ |0|0 1|0 1 2 3| +-+---+-------+ qnial> point := 1 1 1 1 1 1 qnial> slicer := point EACHBOTH + tellShaper +-+---+-------+ |1|1 2|1 2 3 4| +-+---+-------+ qnial> sub := first ary|slicer DON'T do this! - want to retain valence of ary in sub!! qnial> sub := ary|slicer 21 22 23 24 26 27 28 29 qnial> shape sub 1 2 4 >> perfect qnial> boolA1stSubItmInAry := (first sub) EACHRIGHT = ary ooooo ooooo ooooo ooooo olooo ooooo ooooo ooooo ooooo qnial> sub_posnA1stItmInTop_ary sub ary +-----+ |1 1 1| +-----+ >> OK, correct # 29Nov2021 qnial> (4 5) (4 5 6 7) (8 9) EACHLEFT sub_posnA1stItmInTop_ary (tell 10) +-+-+-+ |4|4|8| +-+-+-+ qnial> sub_posnA1stItmInTop_ary ((4 5) (4 5 6 7) (8 9)) (link (tell 10) (tell 10)) +----+----+----+ |4 14|4 14|8 18| +----+----+----+ # 29Nov2021 qnial> tstSimple sub_posnA1stItmInTop_ary_test ?sub_checkFitIntoTop_ary error = null fitIndxPairLL >> oops... # 30Nov2021 qnial> tst_simple sub_posnA1stItmInTop_ary_test >> all OK! # posn_dat sub_posnA1stItmInTop_ary_resCom # atm_atm01 atm_atm02 atm_lst01 atm_lst02 lst_lst01 lst_lst02 lst_lst03 lst_lst04 lst_lst05 lst_lst06 lst_lst07 atm_atm01 atm_atm02 atm_lst01 atm_lst02 lst_lst01 lst_lst02 lst_lst03 lst_lst04 lst_lst05 lst_lst06 lst_lst07 lst_lst08 lst_lst09 lst_lstL01 lstL_lst01 lstL_lst02 lstL_lst02 lstL_lstL01 lst_lst08 lst_lst09 lst_lstL01 lstL_lst01 lstL_lst02 lstL_lstL01 # 07Dec2021 qnial> sub_posnA1stItmInTop_ary 'f' 'the bigg fat cow' 9 qnial> sub_posnA1stItmInTop_ary 'f' 't' >> null qnial> sub_posnA1stItmInTop_ary 'f' 'f' 0 qnial> sub_posnA1stItmInTop_ary `f `f ?sp1a1 qnial> sub_checkFitIntoTop_ary `f `f >> null 09Dec2021 sub_checkFitIntoTop_ary # olde code, maybe for later 29Nov2021 : % ; IF flag_break THEN BREAK ; ENDIF ; % is there any combination of axis that can accommodate sub within ary? ; % also - build up sequences of axis that can be searched ; % move down from highest shapes ; fitAxisPairLL := null ; FOR subAxis with shapeSub DO FOR aryAxis WITH shapeAry DO IF (subAxis <= aryAxis) THEN fitAxisPairLL := link fitAxisPairLL [aryAxis subAxis] ; ENDIF ; ENDFOR ; ENDFOR ; % ; IF (~= null faultL ) THEN faultL ELSEIF ( = null fitAxisPairLL) THEN fault '?sub_checkFitIntoTop_ary error = null fitAxisPairLL' ELSE fitAxisPairLL ENDIF # # 29Nov2021 qnial> (4 5) (4 5 6 7) (8 9) EACHLEFT sub_posnA1stItmInTop_ary (tell 10) +-+-+-+ |4|4|8| +-+-+-+ qnial> sub_posnA1stItmInTop_ary ((4 5) (4 5 6 7) (8 9)) (link (tell 10) (tell 10)) +----+----+----+ |4 14|4 14|8 18| +----+----+----+ 08********08 #] 02Dec2021 string tests 02-04Dec2021 +-----+ # olde code 02Dec2021 sub_splitAtFront_ary IS OP sub ary { LOCAL i aryL aryL_len aryLOut ; aryL := sub_splitSeparate_ary sub ary ; aryL_lenLess1 := (gage shape aryL) - 1 ; subIndxL := (sub EACHRIGHT = aryL) sublist (gage shape aryL) ; subIndxL := (NOT (aryL_lenLess1 = subIndxL)) sublist subIndxL ; boolL := ary_indexA_convertTo_boolA ary subIndxL ; boolA_link_ary boolL aryL } # 02Dec2021 bad version - what was I thinking? sub_splitAtFront_ary IS OP sub ary { LOCAL i aryA aryA_len aryAOut ; aryA := sub_splitSeparate_ary sub ary ; aryA_lenLess1 := (gage shape aryA) - 1 ; (sub EACHRIGHT = aryA) sublist aryA } # strL := ['Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces'] # subStr := 'Subject: ' # subStrL := link (strL EACHLEFT str_splitAtFront_subStr subStr) # subStrL := strL EACHLEFT str_splitAtFront_subStr subStr # 04Nov2021 olde code subL_splitAtFront_ary IS OP subL ary { LOCAL aryA sub subsub ; aryA := [ary] ; FOR sub WITH subL DO FOR ary_remain WITH aryA DO IF (sub in ary_remain) THEN subsub := ary_remain sub_splitAtFront_ary sub ; % move all to one level ; aryA := null ; FOR i WITH (tell gage shape subL) DO IF (isLst subsub@i) THEN aryA := link aryA [subsub@i] ; ELSE aryA := link aryA (link subsub@i) ; ENDIF ; ENDFOR ; ENDIF ; ENDFOR ; ENDFOR ; aryA } # str := 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' # subStr := 'Subject: ' # a := str sub_splitAtFront_ary subStr # 02Dec2021 qnial> sub_splitAtFront_ary 'def' 'abcdefghij' +---+-------+ |abc|defghij| +---+-------+ >> OK # str := 'Fauci, Anthony (NIH/NlAID) (E] <{-----slcject: Coronavirus on surfaces' # slcStr := 'slcject: ' # a := str slc_splitAtFront_ary slcStr qnial> a := subL_splitAtFront_ary ('Anthony ' 'Subject: ') 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' +-------------------------------+--------------------------------+ |Anthony (NIH/NlAID) (E] <{-----|Subject: Coronavirus on surfaces| +-------------------------------+--------------------------------+ >> nyet - missing lead 'Fauci, ' qnial> subL_splitAtFront_ary ('/*' '*/') 'abcd /* sdgb */ /*dkrifggkgfg*/' +--------+----+-------------+--+ |/* sdgb |*/ |/*dkrifggkgfg|*/| +--------+----+-------------+--+ >> nyet - missing lead 'abcd ' qnial> subL_splitAtFront_ary ('' 'Subject: ') 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' >> null! subL_splitAtFront_ary change : +.....+ aryA := [ary] ; +.....+ To : +.....+ aryA := ary ; +.....+ # qnial> sub_splitAtFront_ary 'Subject: ' 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' +--------------------------------------+--------------------------------+ |Fauci, Anthony (NIH/NlAID) (E] <{-----|Subject: Coronavirus on surfaces| +--------------------------------------+--------------------------------+ >> OK, so problem is within subL_splitAtFront_ary? >> maybe sub_split[Separate, AtFront]_ary return null f sub not in it? - bad! THEN aryLOut := ary ; qnial> sub_splitSeparate_ary 'zebra' 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' +----------------------------------------------------------------------+ |Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces| +----------------------------------------------------------------------+ 03Dec2021 # olde code sub_splitAtFront_ary IS OP sub ary { LOCAL i aryL aryL_len aryLOut subPosns ; aryL := sub_splitSeparate_ary sub ary ; aryLOut := null ; FOR i WITH (tell (gage shape ary)) DO IF (aryL@i = sub) THEN aryLOut := aryLOut append (link link (i (i + 1) EACHLEFT pick aryL)) ; i := i + 2 ; ELSE aryLOut := aryLOut append aryL@i ; i := i + 1 ; ENDIF ; ENDFOR ; aryLOut } sub_splitAtFront_ary IS OP sub ary { LOCAL i aryL aryL_len aryLOut ; aryL := sub_splitSeparate_ary sub ary ; aryL_lenLess1 := (gage shape aryL) - 1 ; aryLOut := null ; i := 0 ; WHILE (i < aryL_lenLess1) DO IF (AND (aryL@i = sub) (i < aryL_lenLess1) ) THEN aryLOut := aryLOut append (link link (i (i + 1) EACHLEFT pick aryL)) ; i := i + 2 ; ELSE aryLOut := aryLOut append aryL@i ; i := i + 1 ; ENDIF ; ENDWHILE ; aryLOut } # olde code <01Dec2021 { LOCAL in_sub i j sub_length ary_length sub_tell head tail result_back aryLOut ; aryLOut := [ary] ; IF (~= null sub) THEN sub_length ary_length := EACH tally sub ary ; IF (sub_length < ary_length) THEN sub_tell := tell sub_length ; FOR j WITH tell (- ary_length sub_length + 1) DO in_sub := l ; FOR i WITH sub_tell DO IF sub|[i] ~= ary|[j+i] THEN in_sub := o ; EXIT null; ENDIF ; ENDFOR ; IF in_sub = l THEN head tail := [tell j, j + sub_length + (tell (ary_length - j - sub_length))] EACHLEFT choose ary ; result_back := sub_splitSeparate_ary sub tail ; aryLOut := (head sub (first result_back)) link (rest result_back) ; EXIT null ; ENDIF ; ENDFOR ; ENDIF ; ENDIF ; aryLOut } % ouch! - needed for char in [sub, ary] - this will cause other problems!! ; IF (= null (gage shape sub)) THEN subr := [sub] ; ENDIF ; IF (= null (gage shape ary)) THEN aryr := [ary] ; ENDIF ; # sub_splitSeparate_ary IS OP sub ary - sub [splits ary, separate] # 04Nov2021 initial from strings.ndf (~identical) # 01Dec2021 haven't started new coding yet # ??? := ary_indexL_convertToBoolL ary (sub_posnAAllItmInTop_ary sub ary ; # 02Dec2021 problem - end-to-end sub creates a block of l's to select, should be distinct!! 10Dec2021 # 06Dec2021 olde code sub_posnAAllItmInTop_ary IS OP sub ary { LOCAL aryPoint arySliceL subVolume ; IF flag_break THEN BREAK ; ENDIF ; IF ((gage shape sub) > (gage shape ary)) THEN ary ELSE subVolume := EACH tell (gage shape sub) ; arySliceL := null ; FOR aryPoint WITH (sub_posnA1stItmInTop_ary sub ary) DO arySlice := aryPoint EACHBOTH + subVolume ; arySliceL := link arySliceL (aryPoint EACHBOTH + subVolume) ; ENDFOR ; arySliceL ENDIF } 08********08 #] 28Nov2021 revamp position (posn) optrs - all [lst, str] are ary-based strings.ndf - handy to build programmer's aide to select optrs : sub_splitSeparate_str IS sub_splitSeparate_lst str_subP_splitSeparateTo_midIndxs_subL IS lst_subP_splitSeparateTo_midIndxs_subL +-----+ # olde code # +-----+ # split strings : # 25Oct2021 this section was pulled from strings.ndf # 21Nov2021 put back in IF flag_debug THEN write '+-----+' ; ENDIF ; IF flag_debug THEN write 'split strings : ' ; ENDIF ; # aryList_extractMulplicate_subArys IS OP selectOp strL - find mulplicates in strL by selectOp # see d_Qroot 'setup.ndf' - works with strLs, or any array type (in form of list) # 14Dec2020 initial IF flag_debug THEN write 'loading str_subL_getLenMatchesTo_subPL' ; ENDIF ; # str_subL_getLenMatchesTo_subPL IS OP str subL - returns a list subString pairs of matching length # 20Jun2021 initial, 22Jun2021 make optr very specific & clear # should this return a result : # if str is in subStrs? NO!?? (at present this doesn't happen) # if null is in subStrs? Definite NO! I think the null will cause problems!? eliminate that possibility str_subL_getLenMatchesTo_subPL IS lst_subL_getLenMatchesTo_subPL # EACH (gage shape) iL indxs pairs keepL result # iL indxs pairs keepL result IF flag_debug THEN write 'loading subL_splitAtFront_str' ; ENDIF ; # subL_splitAtFront_str IS OP subL str - splits str at each point that an item of subStrL occurs # each subStr in strLOut as a separate item # 16Jun2021 initial # each segment starts with subStr, if subStr doesn't appear - returns entire str subL_splitAtFront_str IS subL_splitAtFront_lst IF flag_debug THEN write 'loading sub_splitAtFront_str' ; ENDIF ; # sub_splitAtFront_str IS OP sub str - splits str at each point that subStr occurs # subStr in strLOut combined with next item # formal tests - see link d_Qtest 'strings/strings- tests.ndf' # 16Jun2021 legacy optrs MUST be changed to reverse position of [str, subStr] arguments!!! sub_splitAtFront_str IS sub_splitAtFront_lst # str := 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces' # sub := 'Subject: ' # splits := sub sub_splitAtFront_str str IF flag_debug THEN write 'loading sub_splitAtEnd_str' ; ENDIF ; # sub_splitAtEnd_str IS OP sub str - split str where subStr occurs, subStr @end of each split # formal tests - see link d_Qtest 'strings/strings- tests.ndf' # 11Jun2021 adapted from earlier [string_split_by_string, string_splitWith_string, subStr_splitWith_subStr] # 16Jun2021 Do legacy optrs must be changed to reverse position of [str, subStr] arguments??!!! sub_splitAtEnd_str IS sub_splitAtEnd_lst # sub_splitAtEnd_str 'def' 'abcdefghij' >> 16Jun2021 WRONG! # str := 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject : Coronavirus on surfaces' # sub := 'Subject : ' qnial> sub_splitAtEnd_str sub str +--------------------------------------+--------------------------------+ |Fauci, Anthony (NIH/NlAID) (E] <{-----|Subject: Coronavirus on surfaces| +--------------------------------------+--------------------------------+ >> 04Nov2021 wrong! IF flag_debug THEN write 'loading str_subP_splitSeparateTo_midIndxs_subL' ; ENDIF ; # str_subP_splitSeparateTo_midIndxs_subL IS OP str subP - split str, return [indxs, subL] # by paired [left, right]-end-marks, return [Indxs of mids, strL] # 31Oct2020 IMPORTANT - use [strL, NOT indxs] for shape-related optrs, as atomic indxs screw up # 20Oct2020 # a strLft right at the beginning of the line isn't picked up! # 19Oct2020 initial, based on str_subP_splitSeparateTo_midIndxs_subL # strRgt must be 2 positions from strLft or that strHead is not valid ; # in real life, some strRgt will occur in the next split, without a "middle" (null) # this does not account for nesting of [strLft, strRgt] # 06Oct2020 essentially assumes every strLft has only one strRgt # 16Nov2020 fudge to cover "unique", versus "convoluted" strRgt str # eg [' a := itm_posnL1stIn_lstL 'the bigg fat cow' ([' '] 'atg' 'g') +++---+ |||6 7| +++---+ qnial> b := first a >> null? not really! qnial> diagram b + | + >> what is b? not [solitary, ??] qnial> type b (null showing...) what is this? qnial> solitary null ++ || ++ >> oops, didn't have (6 7) in stdResult, won't solve problem, but it has to be there # plog := link d_Qtest 'strings/' timestamp_YYMMDD_HMS ' alltest strings.txt' # a := test_simple itm_posnL1stIn_lstL_test # change stdResult from (null null (6 7)) # to ([' '] 'atg' 'g') >> save to '0_QNial special problems.txt' # test t08 : qnial> a := chr_cut_str 'abcd /* sdgb /*jhkjk *** */ sd/*zfes /*fr' '' +--------------------------------------------+ |abcd /* sdgb /*jhkjk *** */ sd/*zfes /*fr| +--------------------------------------------+ >> seems reasonable? cutting with null returns a list with the entire string (I"m not sure about this) OK, I will leave it at that >> should work now IF flag_debug THEN write 'loading str_posn_groupTest' ; ENDIF ; # str_posn_groupTest := - Position of [chrs, sub-strings, etc] # 06Nov2021 initial str_posn_groupTest := "str_posn_groupTest (link d_Qtest 'strings/z_Archive/') ( 'itm_posnAInTop_ary_test' 'sub_posnAAllItmInTop_ary_str_test' 'itm_posn1stInTop_ary_test' 'itm_posn1stInTop_aryL_test' 'sub_posnAAllItmInTop_ary_test' 'subL_posnAAllItmInTop_ary_test' ) ; # loaddefs link d_Qtest 'arrays/array- tests.ndf' IF flag_debug THEN write 'loading itm_posn1stInTop_aryL_test' ; ENDIF ; # itm_posn1stInTop_aryL_test IS - all subStr positions, for EACH subStr, in Str # 07Sep2021 initial # 05Nov2021 cut to dataBone itm_posn1stInTop_aryL_test := "tstSimple 2 "itm_posn1stInTop_aryL (link d_Qtest 'strings/z_Archive/') ( "t01 'the bigg fat cow' (' ' 'at' 'gg') ((3 8 12) [10] [6]) 'comment?' "t02 'the bigg fat cow' ([' '] 'atg' 'g') (null null (6 7)) 'interesting - [" "] returns null? I don"t understand b := first a, gives single vertical "+|+"' "t03 'abcd /* sdgb' ['/*'] [[6]] 'very interesting - a solitary at each level!!' "t04 'abcd /* sdgb */ /*dkrifggkgfg*/' ('/*' '*/') ((6 18) (14 31)) 'comment?' "t05 'abcd /* sdgb /*jhkjk *** */ sd/*zfes /*fr' ('/*' 'sd') ((6 15 33 40) (9 31)) 'comment?' "t06 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus ' ['Subject: '] [[38]] 'very interesting - a solitary at each level!!' ) ; # test t02 : qnial> a := itm_posn1stInTop_aryL 'the bigg fat cow' ([' '] 'atg' 'g') +++---+ |||6 7| +++---+ qnial> b := first a >> null? not really! qnial> diagram b + | + >> what is b? not [solitary, ??] qnial> type b (null showing...) what is this? qnial> solitary null ++ || ++ >> oops, didn't have (6 7) in stdResult, won't solve problem, but it has to be there # plog := link d_Qtest 'strings/' timestamp_YYMMDD_HMS ' alltest strings.txt' # a := test_simple itm_posn1stInTop_aryL_test # change stdResult from (null null (6 7)) # to ([' '] 'atg' 'g') >> save to '0_QNial special problems.txt' # test t08 : qnial> a := chr_cut_str 'abcd /* sdgb /*jhkjk *** */ sd/*zfes /*fr' '' +--------------------------------------------+ |abcd /* sdgb /*jhkjk *** */ sd/*zfes /*fr| +--------------------------------------------+ >> seems reasonable? cutting with null returns a list with the entire string (I"m not sure about this) OK, I will leave it at that >> should work now # loaddefs link d_Qtest 'arrays/array- tests.ndf' IF flag_debug THEN write 'loading subL_posnAAllItmInTop_ary_test' ; ENDIF ; # subL_posnAAllItmInTop_ary_test IS - all subStr positions, for EACH subStr, in Str # 28Nov2021 just use 'subL EACHLEFT sub_posnLLAllItmIn_lst lst' # 07Sep2021 initial # 05Nov2021 cut to dataBone subL_posnAAllItmInTop_ary_test := "tstSimple 2 "subL_posnAAllItmInTop_ary (link d_Qtest 'arrays/z_Archive/') ( "t01 (' ' 'at' 'gg') 'the bigg fat cow' ((EACH solitary 3 8 12) [10 11] [6 7]) 'comment?' "t02 ([' '] 'atg' 'ggf') 'the bigg fat cow' (null null null) 'comment?' "t03 ['/*'] 'abcd /* sdgb' [[6 7]] 'comment?' "t04 ('/*' '*/') 'abcd /* sdgb */ /*dkrifggkgfg*/' (((6 7) (18 19)) ((14 15) (31 32))) 'comment?' "t05 ('/*' 'sd') 'abcd /* sdgb /*jhkjk *** */ sd/*zfes /*fr' (((6 7) (15 16) (33 34) (40 41)) ((9 10) (31 32))) 'comment?' "t06 ['Subject: '] 'Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus ' [[38 39 40 41 42 43 44 45 46]] 'comment?' ) ; # 28Nov2021 qnial> subL_posnLLLAllItmIn_lst ((4 5) (4 5 6 7) (8 9)) (tell 10) +-----+---------+-----+ |+---+|+-------+|+---+| ||4 5|||4 5 6 7|||8 9|| |+---+|+-------+|+---+| +-----+---------+-----+ qnial> subL_posnLLLAllItmIn_lst ((4 5) (4 5 6 7) (8 9)) (link (tell 10) (tell 10)) +-----------+---------------------+-----------+ |+---+-----+|+-------+-----------+|+---+-----+| ||4 5|14 15|||4 5 6 7|14 15 16 17|||8 9|18 19|| |+---+-----+|+-------+-----------+|+---+-----+| +-----------+---------------------+-----------+ # olde code IF (= null ary1stIndxL) THEN resFltL := link resFltL (fault '?sub_posnAAllItmInTop_ary error = null sub1stIndxL') ; IF (= null resFltL) THEN fault '?sub_posnAAllItmInTop_ary error = null subMatchIndxL' IF (= null ary1stIndxL) THEN aryMatch1stItmIndxL := null ; ELSE % first check for sub1stItm in aryFitIndxLL (limits search somewhat) ; aryFitIndxLL subFitIndxLL := rows mix resFltL ; % ; sub1stItm := first sub ; ary1stIndxL := null ; FOR aryPoint WITH (tell ((gage shape aryFitIndxLL) - (gage shape sub))) DO IF (= sub1stItm ary@aryPoint) THEN % link or append? ; ary1stIndxL := append ary1stIndxL aryPoint ; ENDIF ; ENDFOR ; % ; FOR aryPoint WITH (tell ((gage shape aryFitIndxLL) - (gage shape sub))) DO IF (= sub1stItm ary@aryPoint) THEN % link or append? ; ary1stIndxL := append ary1stIndxL aryPoint ; ENDIF ; ENDFOR ; % select full matches of ary1stIndxL ; subVolume := EACH tell (gage shape sub) ; aryMatch1stItmIndxL := null ; FOR aryPoint WITH (tell ((gage shape ary1stIndxL) - (gage shape sub))) DO arySlice := aryPoint EACHBOTH + subVolume ; IF (= sub ary|arySlice) THEN aryMatch1stItmIndxL := append aryMatch1stItmIndxL aryPoint ; ENDIF ; ENDFOR ; # Position of [chrs, sub-strings, etc] : # 25Oct2021 this section was pulled from strings.ndf # 21Nov2021 put back in IF flag_debug THEN write '+-----+' ; ENDIF ; IF flag_debug THEN write 'Position of [chrs, sub-strings, etc]' ; ENDIF ; IF flag_debug THEN write 'loading chr_posn1stIn_str' ; ENDIF ; # chr_posn1stIn_str IS OP chr str - returns list of chr positions in str # 04Nov2021 initial from strings.ndf (~identical) chr_posn1stIn_str IS itm_posn1stInTop_ary IF flag_debug THEN write 'loading chr_posnLAllIn_str' ; ENDIF ; # chr_posnLAllIn_str IS OP chr str - returns list of chr positions in Str, or an error # 29Oct2021 re-incarnated <> definitely use '211105 10h05m27s strings.ndf' $ diff -y "$d_Qndfs"'z_Archive/211105 10h05m27s strings.ndf' "$d_Qndfs"'strings.ndf' --suppress-common-lines +-----+ olde code IF flag_debug THEN write 'loading lst_takeBetween_subP' ; ENDIF ; #] lst_takeBetween_subP IS OP lst subP - extract between lstFront & lstEnd # 04Nov2021 initial from strings.ndf (~identical) lst_takeBetween_subP IS OP lst subP { LOCAL lenFull lenFrnt ; lstFull lstFrnt := subP ; lenFull := gage shape lstFull ; lenFrnt := gage shape lstFrnt ; (lenFull - lenFrnt) takeright lstFull } IF flag_debug THEN write 'loading str_isBlank' ; ENDIF ; #] str_isBlank IS OP Str - test that string is entirely "whitespace" (space, tab, CR, NL) Howell 03Sep2016, 16Feb07, this format may be critical to some of my QNial code! Based on QNial library: File: stripblk.ndf QNial library str_isBlank IS OP Str { AND (Str EACHLEFT in chrs_SpcTab) } # 06Sep2021 for deletion : is_blankstring_z IS z_str_isBlank # Examples : qnial> str_isBlank ' ' l qnial> str_isBlank ' This is a string. ' o qnial> str_isBlank 'wesrfhert o' o qnial> str_isBlank (link ' ' (char 9)) l IF flag_debug THEN write 'loading str_isWhite' ; ENDIF ; #] str_isWhite IS OP line - tests if a line is all "whitespace" [space, tab, CR, \n] # www.BillHowell.ca 17Jan2020 initial - for email attachment problem str_isWhite IS OP line { AND (line EACHLEFT in chrs_SpcTab) } # 06Sep2021 for deletion : is_whiteLine_z IS z_str_isWhite IF flag_debug THEN write 'loading write_testStr' ; ENDIF ; #] write_testStr IS OP t_name t_input t_standard t_result - means of testing string answers # ?Mar2018 initial? # 11May2018 modified to have log file output # defaults - manually change from terminal write_testStr IS OP str { NONLOCAL p_log_test_fNum ; writefile p_log_test_fNum str ; } # loaddefs link d_Qndfs 'email analysis - Fauci corona virus.ndf' # IF flag_debug THEN write 'loading str_isOf_chrSet' ; ENDIF ; #] str_isOf_chrSet IS OP str chrSet - true if all chrs in str are in chrSet # 14Jun2021 initial, must be moved to strings.ndf # 14Nov2021 looks like a dud! str_isOf_chrSet IS OP str chrSet { OR (= null str) (AND (EACH OR (str EACHLEFT EACHRIGHT in chrSet)) ) } IF flag_debug THEN write 'loading str_eachChrIs_white' ; ENDIF ; #] str_eachChrIs_white IS OP Str - boolean list of text - l for whitespace, o for other str_eachChrIs_white IS OP Str { NONLOCAL chr_tab chr_newline chr_carriagereturn chr_space ; %charrep_list := each charrep Str ; test_chr_tab := link (chr_tab EACHRIGHT match Str ) ; test_chr_newline := link (chr_newline EACHRIGHT match Str ) ; test_chr_carriagereturn := link (chr_carriagereturn EACHRIGHT match Str ) ; test_chr_space := link (chr_space EACHRIGHT match Str ) ; OR test_chr_tab test_chr_newline test_chr_carriagereturn test_chr_space } # 06Sep2021 for deletion : whitespace_flags_z IS z_str_eachChrIs_white # 04Nov2021 a := 'Markets now largely expect that the Fed will begin slowing these purchases, which consist of Treasury securities and agency mortgage-backed securities, ' # If flag_strings_debug THEN write 'test: str_eachChrIs_white' ; write EACH str_eachChrIs_white ' NONLOCAL chr_tab chr_newline chr_carriagereturn chr_space ; ' 'IF (= o non_whitespace_list@i) THEN first_chr := i ; EXIT ; ENDIF ;' (link `k `r 'hello world' chr_tab chr_space ' hhrr ' ' ') ; write ' ' ; ENDIF ; IF flag_debug THEN write 'loading ary_strip_slc' ; ENDIF ; #] ary_strip_slc IS OP ary slc - removes slc from ary ary_strip_slc IS OP ary slc { LOCAL indxs len slcbies ; len := gage shape slc ; slcbies := (gage shape ary) reshape l ; indxs := link slc_posnAAllslcInTop_ary ary slc ; slcbies#indxs := o ; slcbies slclist ary } # loaddefs link d_Qndfs 'boolean.ndf' IF flag_debug THEN write 'loading boolL_hold_lst' ; ENDIF ; #] boolL_hold_lst IS OP boolL lst - boolean list link adjacent l sublists, returns lst # 05Nov2021 initial IF flag_break THEN BREAK ; ENDIF ; boolL_hold_lst IS OP boolL lst { LOCAL i indexL last_boolean subL tell_boolean ; IF (~= (EACH (gage shape) boolL lst)) THEN newLst := fault '?boolL_hold_lst error : (~= (EACH (gage shape) boolL lst)' ; ELSE tell_boolean := tell (gage shape boolL) ; subL := null ; newLst := null ; inSubL := o ; FOR i WITH tell_boolean DO IF boolL@i THEN inSubL := l ; subL := link subL lst@i ; ELSE IF inSubL THEN newLst := append newLst subL ; subL := null ; newLst := append newLst lst@i ; ELSE newLst := append newLst lst@i ; ENDIF ; inSubL := o ; ENDIF ; ENDFOR ; IF (~= null subL) THEN newLst := newLst append subL ; ENDIF ; ENDIF ; first link newLst } IF flag_debug THEN write 'loading indxL_to_boolL' ; ENDIF ; #] lst_indxL_to_boolL IS OP indxL lst - boolL = l (true) for all indxL, otherwise o (false) # 18Oct2021 is this redundant with respect to indxL_to_boolL?? # 22Nov2021 [clar, simpl]ified IF flag_break THEN BREAK ; ENDIF ; lst_indxL_to_boolL IS OP lst indxL { LOCAL i indexL last_boolean subList tell_boolean ; tell_boolean := tell (gage shape lst) ; subList := null ; indexL := null ; last_boolean := null ; FOR i WITH tell_boolean DO IF (= last_boolean boolL@i) THEN subList := link subList tell_boolean@i ; ELSE indexL := append indexL subList ; subList := null ; subList := tell_boolean@i ; ENDIF ; last_boolean := boolL@i ; ENDFOR ; rest indexL } # loaddefs link d_Qndfs 'boolean.ndf' IF flag_debug THEN write 'loading boolL_keep2_lst' ; ENDIF ; # 18Oct2021 redundant? #] boolL_keep2_lst IS OP boolL - keep lst according to boolean = l (true), returns lstL # 18Oct2021 initial, [incomplete, untested] IF flag_break THEN BREAK ; ENDIF ; boolL_keep2_lst IS OP boolL { LOCAL i indexL last_boolean subList tell_boolean ; tell_boolean := tell (gage shape boolL) ; subList := null ; indexL := null ; last_boolean := null ; FOR i WITH tell_boolean DO IF (= last_boolean boolL@i) THEN subList := link subList tell_boolean@i ; ELSE indexL := append indexL subList ; subList := null ; subList := tell_boolean@i ; ENDIF ; last_boolean := boolL@i ; ENDFOR ; rest indexL } # boolL_keep_indexL_str := link 'IF delta > 0 THEN host (link ' chr_apo 'sleep' chr_apo ' (string delta) ' chr_apo 's' chr_apo ') ; ENDIF ; ' # boolL_keep_indexL_result boolL_keep_indexL_str chrs_QNialSymbols # tests : qnial> boolL_keep2_lst lollol ('Hello ' 'Dolly, ' 'yes ' 'hello, ' 'Dolly' ' it"s so nice') +------+-------+-----------+-----+-------------+ |Hello |Dolly, |yes hello, |Dolly| it"s so nice| +------+-------+-----------+-----+-------------+ qnial> boolL_keep2_lst llloll ('Hello ' 'Dolly, ' 'yes ' 'hello, ' 'Dolly' ' it"s so nice') +-----------------+-------+------------------+ |Hello Dolly, yes |hello, |Dolly it"s so nice| +-----------------+-------+------------------+ qnial> boolL_keep2_lst lolloll ('Hello ' 'Dolly, ' 'yes ' 'hello, ' 'Dolly' ' it"s so nice') ?boolL_keep_lst error : (~= (EACH (gage shape) boolL lst) IF flag_debug THEN write 'loading lst_keep_itmL' ; ENDIF ; #] lst_keep_itmL IS OP lst itmL - cut lst at each itmL, retain itmL, omit non-itmL, returns a LIST! # 04Nov2021 initial from strings.ndf (~identical) lst_keep_itmL IS OP lst itmL { boolL_option_cull_lst (EACHALL OR (itmL EACHLEFT EACHRIGHT = lst)) lst } IF flag_debug THEN write 'loading itmL_cut_lst' ; ENDIF ; #] itmL_cut_lst IS OP itmL lst - cut a lst at each itm, omitting itm, returns a LIST! # 04Nov2021 initial from strings.ndf (~identical) itmL_cut_lst IS OP itmL lst { boolL_option_cull_lst (EACH NOT (EACHALL OR (itmL EACHLEFT EACHRIGHT = lst))) lst } # lst_cutBy_itmL '/media/bill/Dell2/Website - raw/Qnial/code develop_test/fileops/dir empty tests (dont add files)/' chrs_QNialSymbols 08********08 #] 15Nov2021 move sed/grep stuff to [file_ops.ndf, 'fileops/fileops- test.ndf'] now work on searchReplaceL for operators : 'QNial symbol header.ndf' # 15Nov2021 I need to [sort, cull] the table on the first col, # and to remove pairs where search = replace # I added `L to several optrs as the list version is missing - loaddef errors will force their creation # 15Nov2021 also - sort on second column to see conflicts of "final" optr names Change file version to ary : chrL_cut_str IS OP chrL str - returns the list of words in a string, chrL are wordChrs 16Nov2021 I have removed "Top" adjective from arrays.ndf - a all optrs do that Later - may come up with a simple recursive trasformer sequence to do aryNs...??? 17Nov2021 QNial symbol header.ndf' - which optrs NEED an aryA version? More powerful to use transformers! (including [EACH[...], ITERATE, REDUCE, etc]?) rename these two aryA - think about it later aryA_join_vertical aryA_join_horizontal others - all which require results in order! get ride of singular version! itmA_cut_ary IS OP itmA ary - cut each itmA, remainder of ary as LIST by order of occurence subA_cut_ary IS OP ary subA - cut each subA, remainder of ary as LIST by order of occurence ary_keep_itmA IS OP ary itmA - keep itmA as list in order of occurence, drop other content ary_takeBetween_itmPA IS OP ary itmP - recursive? list from between itmPA , WRONG! - needs work Keep for later inspection : sub_insertBetweenThenLink_aryL IS OP sub aryL - link (insert sub between aryL items) ary_replace_subP IS OP ary subP - substitutes subNew for subOld in ary ary_repeatNtimesTo_aryL IS OP ary n - repeats ary n times aryL_keepOddNum IS OP aryL - useful for inclusion in a list of aryL for [terminal, file] output aryL_sortupOn1st IS OP aryL - EACH sortup set of lists based on first list listL_sortupOn_col IS OP colNum aryL - EACH sortup set of lists based on colNum lists_sortupCullOn1st IS OP aryL - EACH [sortup,cull] set of lists based on first list Cull Definition - cull IS OPERATION A {­ grid A EACHLEFT in (A EACHLEFT find A) sublist A } aryL_linkSortCullBy_aryCommonKeyIndexs IS OP aryL - finds indexs of common items for each list in aryL, can be used with a solitary list pairL_sortCullUnique IS OP pairL - sort, then cull to get a unique list of strPairs aryL_commonKeyCullSort_aryCombinedOut IS OP listOfArys keyColIndxL - returns arrayList, sorted by common-keys, as per keyColIndxL aryL_extractMulplicate_subArys IS OP selectOp aryList - find mulplicates in aryN by selectOp >> many require SUCCESSIVE (recursive) transformers, to retain changes at each step!!! +-----+ olde code No changes : 'aryList_extractMulplicate_subArys_tests' 'aryL_extractMulplicate_subArys_tests' Dunno : 'sed_file_pretreat' 'pinn_sedPretreat_poutFixed' '' 'sed_file_postreat' 'pinnFixed_sedPostTreat_pout' '' 'str_convertTo_numOrStr' 'str_convertTo_csvFmt' '' 'str_to_numOrStr' 'str_convertTo_csvFmt' '' IF flag_debug THEN write 'loading ary_replaceAll_pair' ; ENDIF ; #] ary_replaceAll_pair IS OP ary pair - aryOld is replaced by aryNew in ary # 09Nov2021 redundant wrt ary_replace_sub # 04Nov2021 initial from strings.ndf (~identical) ary_replaceAll_pair IS OP ary pair { LOCAL i j in_aryOld n_aryOld part1 part2 result_back ary_block ary_length aryOld_length ; aryOld aryNew := pair ; aryOld_length ary_length := EACH tally aryOld ary ; ary_block := solitary ary ; IF aryOld_length < ary_length THEN FOR j WITH tell (- ary_length aryOld_length + 1) DO in_aryOld := l ; FOR i WITH tell aryOld_length DO IF aryOld|[i] ~= ary|[j+i] THEN in_aryOld := o ; EXIT null; ENDIF ; ENDFOR ; IF in_aryOld = l THEN part1 part2 := [tell j, (j + aryOld_length) EACHRIGHT + tell (ary_length - j - aryOld_length)] EACHLEFT choose ary ; result_back := ary_replaceAll_pair aryOld aryNew part2 ; IF isfault result_back THEN ary_block := null ; ELSE ary_block := (part1 (aryNew link (first result_back))) link (rest result_back) ; ENDIF ; EXIT null ; % is this even useful? - YES! ; ENDIF ; ENDFOR ; ENDIF ; link ary_block } # legacy name - this will cause trouble!!! pair_splitSeparateReplace_ary IF flag_debug THEN write 'loading subL_splitSeparate_ary' ; ENDIF ; #] subL_splitSeparate_ary IS OP subL ary - recursively separate ary where each subL occurs, # 04Nov2021 initial from strings.ndf (~identical) subL_splitSeparate_ary IS OP subL ary { LOCAL aryL ; aryL := [ary] ; FOR sub WITH subL DO aryL := aryL EACHLEFT sub_splitSeparate_ary sub ; ENDFOR ; aryL } IF flag_debug THEN write 'loading subL_splitAtFront_ary' ; ENDIF ; #] subL_splitAtFront_ary IS OP subL ary - splits ary at each point that an item of subL occurs # each sub in aryLOut at the front of following items # 04Nov2021 corrupted? # 04Nov2021 initial from strings.ndf (~identical) # IF flag_break THEN BREAK ; ENDIF ; subL_splitAtFront_ary IS OP subL ary { LOCAL aryRecur sub subsub ; IF flag_break THEN BREAK ; ENDIF ; aryRecur := [ary] ; FOR sub WITH subL DO IF (sub in ary) THEN subsub := ary sub_splitAtFront_ary sub ; % move all to one level ; aryRecur := null ; FOR i WITH (tell gage shape subL) DO IF (isLst subsub@i) THEN aryRecur := link aryRecur [subsub@i] ; ELSE aryRecur := link aryRecur (link subsub@i) ; ENDIF ; ENDFOR ; ENDIF ; ENDFOR ; aryRecur } # strL := ['Fauci, Anthony (NIH/NlAID) (E] <{-----Subject: Coronavirus on surfaces'] # subStrL := ['Subject: '] # a := strL EACHLEFT subL_splitAtFront_ary subStrL # subStrL := strL EACHLEFT subL_splitAtFront_ary subStr # olde code IF flag_debug THEN write 'loading ary_replace_subAry' ; ENDIF ; # ary_replace_subAry IS OP ary subOld subNew - replaces occurences of an array component with another ary_replace_subAry IS OP ary subOld new { LOCAL b locations ; locations := findall subOld ary ; % Avoid problems with arrays as "new" - make them solitary!; IF isfault locations THEN ary ELSE b := cart "ary locations (solitary new); ITERATE update b ENDIF } # 06Sep2021 for deletion : array_replace_subArray IS ary_replace_subAry IF flag_debug THEN write 'loading subL_anyInTop_ary' ; ENDIF ; #] subL_anyInTop_ary IS OP sub ary - returns true if ANY of sub are in ary # 09Nov2021 this looks very inefficient! (don't know if it works yet) # 11Nov2021 doesn't make sense! # 06Sep2021 renamed, new code, old version was a mixup of [code, intent]? # 10Sep2021 see 'strings- tests.ndf' for checks # 09Nov2021 ary version, 11Nov2021 cleaned up subA_anyInTop_ary IS OP subA ary { LOCAL faultL resFltL ; faultL := null ; resFltL := subA EACHLEFT sub_inTop_ary ary ; IF (OR (faultSelect := EACH isfault resFltL)) THEN faultL := faultSelect sublist resFltL ; ENDIF ; % ; faultL } # OR (subA EACHLEFT sub_in_ary ary) } IF flag_debug THEN write 'loading ary_cutBy_char' ; ENDIF ; #] itmL_cut_ary IS OP itmL ary - cut ary at each itm, omitting itm, returns a LIST! # 04Nov2021 initial from strings.ndf (~identical) itmL_cut_ary IS OP itmL ary { boolA_cut_ary (EACH NOT (EACHALL OR (itmL EACHLEFT EACHRIGHT = ary))) ary } # itm_cut_aryL '/media/bill/Dell2/Website - raw/Qnial/code develop_test/fileops/dir empty tests (dont add files)/' chrs_QNialSymbols IF flag_debug THEN write 'loading aryL_keep_itmL' ; ENDIF ; #] aryL_keep_itmL IS OP aryL itmL - cut each aryL by including itmL, omitting non-itmL, # ??lists only (not arys, maybe generalize to arrays (several years hence))?? # note that a character list is just a ary, but I use "itmL" to emphasize that each itm cuts # 04Nov2021 initial from strings.ndf (~identical) aryL_keep_itmL IS OP aryL itmL { (itmL EACHLEFT EACHRIGHT EACHRIGHT = aryL) EACHBOTH boolA_keep_ary aryL } # olde code boolA_cut_ary IS OP boolA ary { LOCAL i in_subAry n_bool result subAry subAryL ; IF (~= (TWIG (gage shape) boolA ary)) THEN fault '?boolA_cut_ary error: ~= (EACH (gage shape) boolA ary)' ELSE boolA EACHBOTH boolA_cut_ary ary ENDIF } 08********08 #] 11Nov2021 how many .ndf files are in d_Qndfs subdirectories? directories only : $ find "$d_Qndfs" -maxdepth 1 -type d | sed "s|""$d_Qndfs""||" +--+ video production z_Old IJCNN 2013 Dallas TX dictionaries MindCode email fix Thunderbird uni2ascii iconv - Unicode to ASCII economics, markets webSite Cheng - semi-tensor and switching control, Matlab toolbox email - mass response processing z_Archive Ord Diff Eq Integration email Bessel USB_backup Examples Bessell - Runge-Kutta Climate and Sun symbols +--+ Manually remove 'z_Archive' 'z_Old' baseDirL := sortup 'video production' 'IJCNN 2013 Dallas TX' 'dictionaries' 'MindCode' 'email fix Thunderbird' 'uni2ascii' 'iconv - Unicode to ASCII' 'economics, markets' 'webSite' 'Cheng - semi-tensor and switching control, Matlab toolbox' 'email - mass response processing' 'Ord Diff Eq Integration' 'email' 'Bessel' 'USB_backup' 'Examples' 'Bessell - Runge-Kutta' 'Climate and Sun' 'symbols' dirRawL := d_Qndfs EACHRIGHT link baseDirL EACH host_result (EACH link list cart ['find "'] subDirs ['" -maxdepth 10 -type d | sed "s|""$d_Qndfs""||" | wc -l ']) qnial> subDirNdfNum_tbl := transpose mix baseDirL (EACH tonumber EACH first EACH host_result (EACH link list cart ['find "'] dirRawL ['" -maxdepth 7 -type d | sed "s|""$d_Qndfs""||" | wc -l '])) +---------------------------------------------------------+--+ |Bessel | 1| +---------------------------------------------------------+--+ |Bessell - Runge-Kutta | 1| +---------------------------------------------------------+--+ |Cheng - semi-tensor and switching control, Matlab toolbox| 6| +---------------------------------------------------------+--+ |Climate and Sun |15| +---------------------------------------------------------+--+ |dictionaries | 2| +---------------------------------------------------------+--+ |economics, markets | 2| +---------------------------------------------------------+--+ |email | 1| +---------------------------------------------------------+--+ |email fix Thunderbird | 1| +---------------------------------------------------------+--+ |email - mass response processing | 1| +---------------------------------------------------------+--+ |Examples | 1| +---------------------------------------------------------+--+ |iconv - Unicode to ASCII | 1| +---------------------------------------------------------+--+ |IJCNN 2013 Dallas TX | 8| +---------------------------------------------------------+--+ |MindCode |10| +---------------------------------------------------------+--+ |Ord Diff Eq Integration | 1| +---------------------------------------------------------+--+ |symbols | 1| +---------------------------------------------------------+--+ |uni2ascii | 1| +---------------------------------------------------------+--+ |USB_backup | 1| +---------------------------------------------------------+--+ |video production |12| +---------------------------------------------------------+--+ |webSite | 2| +---------------------------------------------------------+--+ >> wrong number of ndfs for many! Why??? >> list of lists! qnial> sum second cols subDirNdfNum_tbl 68 $ find "$d_Qndfs"'MindCode' -maxdepth 10 -type d | grep --invert-match "z_Archive|\z_Old" | sed "s|""$d_Qndfs""||" MindCode MindCode/z_Old MindCode/clusters MindCode/clusters/z_Archive MindCode/code test MindCode/z_Archive MindCode/z_Archive/200329 backup quick MindCode/z_Archive/210405 early Z80 coding incomplete MindCode/code develop MindCode/neurons >> why are "z_Archive|\z_Old" still in output?!!! >> oops - can't concatenate --invert-match !! $ find "$d_Qndfs"'MindCode' -maxdepth 10 -type d | grep --invert-match "z_Archive" | grep --invert-match "z_Old" | sed "s|""$d_Qndfs""||" MindCode MindCode/clusters MindCode/code test MindCode/code develop MindCode/neurons qnial> transpose mix baseDirL (EACH tonumber EACH first EACH host_result (EACH link list cart ['find "'] subDirRawL ['" -maxdepth 10 -type d | grep --invert-match "z_Archive" | grep --invert-match "z_Old" | sed "s|""$d_Qndfs""||" | wc -l '])) >> NUTS!! I'm just counting subDirs, not ndfs!! qnial> transpose mix baseDirL (EACH tonumber EACH first link EACH tonumber EACH first EACH host_result EACH link ('wc -l ' EACHRIGHT link (EACH host_result (EACH link list cart ['find "'] dirRawL ['" -maxdepth 10 -type d | grep --invert-match "z_Archive" | grep --invert-match "z_Old" ']))) Freeze ... restart QNial baseDirL := sortup 'video production' 'IJCNN 2013 Dallas TX' 'dictionaries' 'MindCode' 'email fix Thunderbird' 'uni2ascii' 'iconv - Unicode to ASCII' 'economics, markets' 'webSite' 'Cheng - semi-tensor and switching control, Matlab toolbox' 'email - mass response processing' 'Ord Diff Eq Integration' 'email' 'Bessel' 'USB_backup' 'Examples' 'Bessell - Runge-Kutta' 'Climate and Sun' 'symbols' dirRawL := d_Qndfs EACHRIGHT link baseDirL Too messy to build-test : see dirL_ndfCountRecurse in link d_Qndfs 'QNial userWkspSymbol.ndf' ?No such file or directory >> Huh?? $ ls "$d_Qndfs" | grep 'symbolOldNew' QNial symbolOldNew arrays.txt QNial symbolOldNew boolean.txt QNial symbolOldNew faults.txt QNial symbolOldNew fileops.txt QNial symbolOldNew lists.txt QNial symbolOldNew strings.txt >> OK $ cat "$d_Qndfs"'QNial symbolOldNew strings.txt' cat: '/media/bill/Dell2/Website - raw/Qnial/MY_NDFS/QNial symbolOldNew strings.txt': No such file or directory >> What gives!!???!!! qnial> link d_Qndfs 'QNial symbolOldNew strings.txt' /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/QNial symbolOldNew strings.txt >> ARRGGHH!!! spce at end 'QNial symbolOldNew strings.txt ' # enddoc