#] #] ********************* #] "$d_Qtest"'arrays/arrays- develop.txt' - # www.BillHowell.ca 02Oct2021 initial # slc - "[all-full-but-[one or none]]" INDEX of an array # sub - is a sequence of items at the top level of an array, note that a sub can span [one, more, all] axis # not much use for a separate subSlc of an array - just use sub optrs # [remove, insert] - require slc of an array, often built from search for a subAry, # inset something in non-sub parts of slc # split - requires a hyper-plane index as a specific place to split ary # replace - just a sub required if [old, new] of same shape. If not, won't work in general # 24************************24 # Table of Contents, generated with : # $ grep "^#]" "$d_Qtest"'arrays/arrays- develop.txt' | sed 's/^#\]/ /' # ********************* "$d_Qtest"'arrays/arrays/array- develop notes.txt' - 12Apr2022 fix atm_restructSameAs_ary sub_inTop_ary IS OP sub ary - true if sub is in aryS (simply array) 09Nov2021 this looks very inefficient! (don't know if it works yet) 11Apr2022 sub_posnAAllItmInTop_ary olde code 11Feb2022 remove slc as a ary_insert_sub IS OP ary - creates one aryOut by splitting ary with sub, (19Nov2021 not ready) inserting an sub at each place in ary that it occurs must find "full slices" of ary containing sub!!! ary_replace_slcP IS OP ary slcP - substitutes slcNew for slcOld in ary designed for strings - I haven't generalized it! 10Feb2022 QNial start loaddefs - problems with arrays.ndf 24Nov2021 position tests - ary versions 15Nov2021 sub [position, in] aryN - redo coding 11Nov2021 sub [position, in] aryN - redo coding faults?date? - conversion table for optr names boolean?date? - conversion table for optr names arrays?date? - conversion table for optr names subL_posnAAllInTop_ary IS OP subL ary - posn of all subL, for all occurences of subL in ary subL_posn1stItm1stInTop_ary IS OP subL ary - 1st posn of 1st itm of subL in ary returns initial 1st char positions for each subL, or a [null, error] 04Nov2021 NOT READY! only works with subL of atoms for now??! subL is a sequence of itms of ary, eg ((0 1) 2) in ((0 1) 2 3 4 5), not in (0 1 2 3 4 5) subLL_posnAItmAllIn_ary IS OP ary subLL - all itm positions for all occurences each subLL in ary table_build IS OP n_cols labld_data - process loaddef of table with column headers table_add_rowTitles IS OP tableData rowTitles - res ipsa loqitor table_add_colTitles IS OP tableData colTitles - res ipsa loqitor table_add_rowColTitles IS OP tableData rowTitles colTitles - common [row,col]Titles@0 colTitles overwrites newTable@(0 0), if null then newTable@(0 0) := rowTitles@0 table_remove_colTitles IS OP table - remove column titles from table table_remove_rowTitles IS OP table - remove column titles from table table_remove_rowColTitles IS OP table - remove column titles from table table_write IS OP titles - output labelled table tbl_selectRowsBy_col_key IS OP tbl col key - returns a table of selected rows lstL_cutBy_itmL IS OP lstL itmL - cut each lstL by all itmL, omitting itmL, ??lists only (not arys)?? note that a character list is just a lst, but I use "itmL" to emphasize that each itm cuts aryList_extractMulplicate_subArys IS OP selectOp aryL - find mulplicates in lstL by selectOp see d_Qroot 'setup.ndf' - works with lstLs, or any array type (in form of list) List Howells [bash script, QNial optr]s - essential map for finding shit, twig the bash cmd line see "$d_bin""0_list Howells [bash scripts, QNial operators].sh" $ find "$d_Qndfs" -name "*.ndf" |...[greps,sort]...| xargs...grep "#\] " "FILE" | sed 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_Qndfs" -name "*.ndf" |...[greps,sort]...| xargs -0 -IFILE grep..."" "FILE" 02Oct2021 ary1_transStr_isSameStructAs_ary2[, _calcResults, _test] 24************************24 #] current status of tests - see "$d_Qtest"'/test results/' 01Jul2022 ary_chk_itm_getAllSlc_testSimple - Is this doing what I hope it does? what about cut "rest" of ary? 06Jul2022 I have to fix MANY faults back ?aryIdxTooBig to ?aryVlcIdxShp!! 24************************24 #] Instructions for replacing strs in files see "$d_bin""fileops.sh" instructions 24************************24 #] ToDos #] 18Sep2022 I am missing tests for (see also "$d_Qtest"'arrays/arrays- testGroupsCluster.ndf') : ary_sub_get_idx1stL IS OP ary sub - idxA of 1st item of sub in TOP level of ary ary_sub_get_idxLL IS OP ary sub - posnAL of all "itm-sequences=sub" within in ary, or faultL ary_compatible_itm_testStd ary_compatible_sub_testStd ary_compatible_pat_testStd ary_axsTitles_titleL_getSlc_testStd_testStd ary_invert_slc_testSimple_testStd ary_invert_slcA_testSimple_testStd sub_makeVlcSameAs_ary_testStd #] 07Dec2022 nial7_LMDE64: looks like I must re-compile nial7_LMDE64? 08********08 #] ??Dec2022 08********08 #] ??Dec2022 08********08 #] ??Dec2022 08********08 #] ??Dec2022 08********08 #] 16Dec2022 [isIntSeq, idxSeqA_adrCompatible, ary_idxSeqA_compatible, #] ary_chk_idxSeq_apply_optrPhr] pinn_str_writeScreenUnbalancedLines (link d_Qndfs 'types.ndf') '(' >> can't use until arrays fixed ... Change : IF (NOR ((valence ary) EACHRIGHT = (EACH (gage shape idxSeqA)))) To : IF (NOR ((valence ary) EACHRIGHT = (EACH (gage shape) idxSeqA))) >> OK nows it loaddefs +-----+ 17Dec2022 Tests : isIntSeq "$d_Qndfs"'types,ndf' : idxSeqA_adrCompatible no tests yet, used in other optrs ary_idxSeqA_compatible a"$d_Qndfs"'types,ndf' ary_idxSeq_to_slc optr doesn't exist yet!!???? ary_sub_get_idx1stL "$d_Qndfs"'arrays.ndf' tstOptr "ary_chk_sub_get_idx1stL_testStd +-----+ # olde code 15Dec2022 ary_idxSeqA_compatible % test if idxSeqA is an ary of intL, same shape as valence ary ; IF (OR ((valence ary) EACHRIGHT ~= (EACH (gage shape idxSeqA))) THEN faultL := link faultL (fault '?aryidxSeqAComp01') ; ELSEIF (OR (NOT (EACH isInteger idxSeqA))) THEN faultL := link faultL (fault '?aryidxSeqAComp02') ; ENDIF ; IF (NOT ary_hasFaults faultL) THEN aryVlc idxVlc := EACH valence ary idxSeqA ; aryShp idxShp := EACH (gage shape) ary idxSeqA ; IF (~= aryVlc idxShp) THEN faultL := link faultL (fault '?aryIdxVlc') ; ELSEIF (OR (aryShp EACHBOTH <= idxSeqA)) THEN faultL := link faultL (fault '?aryIdxTooBig') ; ENDIF ; ENDIF ; # olde code 16Dec2022 - from ary_idxSeqA_compatible, no longer helpful? % track vars : axiIdxL idxSeqA ; IF (NOR (EACH OR (EACH EACH isInteger axiIdxL))) THEN faultL := link faultL (fault '?aryidxSeqAComp03') ; % is axiIdxA "complete or does it have gaps? ; % 16Dec2022 problematic - needs integer seqence for each axi ; ELSEIF (NOR ((cart axiIdxL) EACHLEFT in idxSeqA)) THEN faultL := link faultL (fault '?aryidxSeqAComp04') ; 08********08 #] 12Dec2022 ary_sub_get_idx1stL IS OP ary sub from yesterday : qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd o ary_chk_sub_get_idx1stL_testStd 12 27 27 >> more small fixes qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd o ary_chk_sub_get_idx1stL_testStd 17 25 27 >> problem is mostly : ?arySubGetIdx1st3 >> but some non-fault results are good all failures have fault ?arySubGetIdx1st3 Change ary_sub_get_idx1stL : FOR idx WITH fit1stSubItmidxAL DO slicer := sub_idxUL_to_idxA sub idx ; subt := ary|slicer ; IF (ary_hasFaults subt) THEN mch1stSubItmidxAL := fault '?arySubGetIdx1st3' ; ELSE mch1stSubItmidxAL := append mch1stSubItmidxAL idx ; ENDIF ; ENDFOR ; To: ary_sub_get_idx1stL FOR idx WITH fit1stSubItmidxAL DO idxA := sub_idxUL_to_idxA sub idx ; slicer := ary EACHRIGHT ary_idx_to_slc idxA ; subt := ary|slicer ; IF (ary_hasFaults subt) THEN mch1stSubItmidxAL := fault '?arySubGetIdx1st3' ; ELSE mch1stSubItmidxAL := append mch1stSubItmidxAL idx ; ENDIF ; ENDFOR ; Use : ary_idx_to_slc IS OP ary idx qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd o ary_chk_sub_get_idx1stL_testStd 15 27 27 >> oops, now worse than last one! >> ?arySubGetIdx1st3 is still the problem 15Dec2022 flag_break it : qnial> ary_sub_get_idx1stL 'the bigg fat cow' 'g' +-+-+ |6|7| +-+-+ ary_sub_get_idx1stL 'the bigg fat cow' ' b' Fix : # 19Sep2022 tests idxSeq := (1 0 0) (1 0 1) (1 0 2) (1 0 3) qnial> EACH (sortup cull) (cols mix idxSeq) +-+-+-------+ |1|0|0 1 2 3| +-+-+-------+ >> OK qnial> ary_idxSeq_to_slc (2 2 4 reshape tell 20) ((1 0 0) (1 0 1) (1 0 2) (1 0 3)) [1, 0, 0 1 2 3] >> OK # 15Dec2022 qnial> idxSeq := 1 2 3 1 2 3 qnial> EACH (sortup cull) (cols mix idxSeq) o-----+ |1 2 3| +-----+ qnial> idxSeq := EACH solitary 1 2 3 +-+-+-+ |1|2|3| +-+-+-+ qnial> ary_idxSeq_to_slc (tell 10) (EACH solitary 1 2 3) [1 2 3] >> OK qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd o ary_chk_sub_get_idx1stL_testStd 15 27 27 >> oops - all non-fault-intended now ?arySubGetIdx1st3 .#? ary_sub_get_idx1stL ?arySubGetIdx1st3 - isNull mch1stSubItmidxAL, can"t find sub Try again : qnial> ary_sub_get_idx1stL 'the bigg fat cow' 'g' ?arySubGetIdx1st3 current problem : qnial> ary_idxSeq_to_slc (tell 10) [6] ?aryIdxSeqToSlc02 ary_idxSeq_to_slc Changed : IF (= 1 (gage shape idxSeq)) THEN axiIdxL := idxSeq ; ELSE axiIdxL := EACH (sortup cull) (cols mix idxSeq) ; ENDIF ; % track vars : axiIdxL idxSeq ; IF (NOR (EACH OR (EACH EACH isInteger axiIdxL))) THEN faultL := link faultL (fault '?aryIdxSeqToSlc01') ; % is axiIdxA "complete or does it have gaps? ; ELSEIF (NOR ((cart axiIdxL) EACHLEFT in idxSeq)) THEN faultL := link faultL (fault '?aryIdxSeqToSlc02') ; ENDIF ; to : IF (= 1 (gage shape idxSeq)) THEN axiIdxL := idxSeq ; ELSE axiIdxL := EACH (sortup cull) (cols mix idxSeq) ; % track vars : axiIdxL idxSeq ; IF (NOR (EACH OR (EACH EACH isInteger axiIdxL))) THEN faultL := link faultL (fault '?aryIdxSeqToSlc01') ; % is axiIdxA "complete or does it have gaps? ; ELSEIF (NOR ((cart axiIdxL) EACHLEFT in idxSeq)) THEN faultL := link faultL (fault '?aryIdxSeqToSlc02') ; ENDIF ; ENDIF ; qnial> ary_idxSeq_to_slc (tell 10) [6] [6] >> OK... Now try : tstOptr "ary_chk_sub_get_idx1stL_testStd qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd o ary_chk_sub_get_idx1stL_testStd 17 25 27 >> again problem for most non-fault-driving : ?arySubGetIdx1st3 flag-break 1st error : qnial> ary_idxSeq_to_slc 'the bigg fat cow' ([5] [6]) [5 6] >> OK... 08********08 #] 11Dec2022 reorganized [idx, slc] tests +--+-----------------------------------+-------+------+-----+ |OK|test (optr) |correct|faults|total| Fixes +--+-----------------------------------+-------+------+-----+ | o|ary_chk_idx_compatible_testSimple | 12| 29| 27| 27 25 27 +--+-----------------------------------+-------+------+-----+ | l|ary_chk_itm_get_idxL_testStd | 27| 24| 27| +--+-----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_idx1stL_testStd | 10| 15| 27| 27 15 27 +--+-----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_idx1stL_testSimple | 4| 1| 6| 6 1 6 +--+-----------------------------------+-------+------+-----+ | o|?ary_chk_sub_get_idxL_testStd | 0| 1| 1| 10 15 27 +--+-----------------------------------+-------+------+-----+ | o|?ary_chk_sub_get_idxL_testSimple | 0| 1| 1| +--+-----------------------------------+-------+------+-----+ | l|ary_chk_slc_compatible_testSimple | 31| 31| 31| +--+-----------------------------------+-------+------+-----+ | o|ary_chk_itm_get_slcL_testSimple | 17| 17| 25| 25 17 25 +--+-----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_slcL_testSimple | 3| 25| 22| +--+-----------------------------------+-------+------+-----+ +-----+ qnial> tstOptr "ary_chk_idx_compatible_testSimple l ary_chk_idx_compatible_testSimple 27 25 27 +-----+ after much clean-up of resStd : qnial> tstOptr "ary_chk_itm_get_slcL_testSimple o ary_chk_itm_get_slcL_testSimple 22 17 25 >> still a problem with ary[1,2,4]_itm, resulting slices are "merged" +--+-----------+----------------+----------------+ | o|ary01_itm |+------+------+ |+------+ | | | ||[ , 1]|[1, ]| ||[1, 1]| | | | |+------+------+ |+------+ | +--+-----------+----------------+----------------+ | o|ary02_itm |+------+------+ |+------+ | | | ||[ , 2]|[0, ]| ||[0, 2]| | | | |+------+------+ |+------+ | +--+-----------+----------------+----------------+ | o|ary04_itm |+-------+------+|+-------+ | | | ||[ , 10]|[1, ]|||[1, 10]| | | | |+-------+------+|+-------+ | +--+-----------+----------------+----------------+ from : "ary01_itm (4 5 reshape (tell 30)) 6 ('[ , 1]' '[1, ]') 'should work OK, but why solitary whole thing?' "ary02_itm (4 5 reshape (tell 30)) 2 ('[ , 2]' '[0, ]') 'should work OK, but why solitary whole thing?' "ary04_itm (2 12 reshape chrs_alpha_small) 'w' ('[ , 10]' '[1, ]') 'should be OK, note that chrs_alpha_small is list of chrStr (miss-named)' >> resStdL are WRONG! change a couple of examples for multiple hits qnial> tstOptr "ary_chk_itm_get_slcL_testSimple l ary_chk_itm_get_slcL_testSimple 25 17 25 >> OK +-----+ ary_chk_sub_get_idx1stL_testStd many fixes, then residual fault : "lst_null01 [fault '?aryItmGetIdxL01'] 'should be ?aryItmGetIdxL01, item is not in aryTop (= null resFlt)' +--+-----------+----------------+----------------+ | o|lst_null01 |?aryItmGetIdxL01|?aryItmGetIdxL01| +--+-----------+----------------+----------------+ >> resStd should be a list? or resFltL not a list? IF (isVerBar resFlt) THEN fault '?aryItmGetIdxL01' "lst_null01 'the bigg fat cow' null ?aryItmGetIdxL01 qnial> diagram a ?aryItmGetIdxL01 qnial> isfault a l >> so why is resFltL only a fault, and not [fault]?? other faults are lists? -> only for (valence ary) < 1)? resStd change to : (fault '?aryItmGetIdxL01') qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd l ary_chk_sub_get_idx1stL_testStd 27 15 27 >> OK +-----+ ary_chk_sub_get_idx1stL_testSimple >> lists, rather than atms from ary_chk_itm_get_slcL_testSimple : (2 12 reshape 'abcdwghiwjkwlmnopqrstw') use : (2 12 reshape 'abcdwghidwgjkdwglmnopqrs') qnial> ary_sub_get_idx1stL (2 12 reshape 'abcdwghidwgjkdwglmnopqrs') 'dwg' ?spAllia1 #? ary_sub_get_idxLL ?spAllia1 - sub not found >> wrong, so what's happened here? ary_chk_sub_get_idx1stL_testSimple "ary_ary01 (2 12 reshape 'abcdwghidwgjkdwglmnopqrs') 'dwg' ([0 3] [0 8] [1 1]) 'should be OK, sub was already "up-dimensioned" in ary_chk_sub_get_idx1stL_testStd' +--+-----------+-------------------+------------+ | o|ary_ary01 |+-----+-----+-----+|?arySubComp1| | | ||+---+|+---+|+---+|| | | | |||0 3|||0 8|||1 1||| | | | ||+---+|+---+|+---+|| | | | |+-----+-----+-----+| | +--+-----------+-------------------+------------+ ?arySubComp1 #? ary_sub_compatible ?arySubComp1 (~= (EACH valence ary sub)) change resStd to : ((0 3) (0 8) (1 1)) +--+-----------+-------------+------------+ | o|ary_ary01 |+---+---+---+|?arySubComp1| | | ||0 3|0 8|1 1|| | | | |+---+---+---+| | +--+-----------+-------------+------------+ But (~= (EACH valence ary sub)) Change from : "ary_ary01 (2 12 reshape 'abcdwghidwgjkdwglmnopqrs') 'dwg' ((0 3) (0 8) (1 1)) 'should be OK, sub was already "up-dimensioned" in ary_chk_sub_get_idx1stL_testStd' To : "ary_ary01 (2 12 reshape 'abcdwghidwgjkdwglmnopqrs') (1 3 reshape dwg') ((0 3) (0 8) (1 1)) 'should be OK, sub was already "up-dimensioned" in ary_chk_sub_get_idx1stL_testStd' +--+-----------+-------------+-------------+ | l|ary_ary01 |+---+---+---+|+---+---+---+| | | ||0 3|0 8|1 1|||0 3|0 8|1 1|| | | |+---+---+---+|+---+---+---+| +--+-----------+-------------+-------------+ qnial> tstOptr "ary_chk_sub_get_idx1stL_testSimple l ary_chk_sub_get_idx1stL_testSimple 6 1 6 >> OK +-----+ ary_chk_sub_get_idxL_testStd mashed up results picture? "lst_lst01 ([[6]] [[7]]) 'why list of lists?' "lst_lst01 'the bigg fat cow' 'g' qnial> ary_sub_get_idxL 'the bigg fat cow' 'g' +---+---+ |+-+|+-+| ||6|||7|| |+-+|+-+| +---+---+ >> OK tstOptr "ary_chk_sub_get_idxL_testStd ?not an operation - for ALL tests!!?? >> oops : >>> loading start : arrays.ndf ?undefined identifier: RESFLTL := ARY_SUB_GET_IDXL <***> ARY SUB ; >> out of sequence? Change : ary_sub_get_idx1stL IS OP ary sub { LOCAL resFltL ; resFltL := ary_sub_get_idxL ary sub ; IF (NOT ary_hasFaults resFltL) THEN resFltL := EACH first resFltL ; ENDIF ; resFltL } To : ary_sub_get_idx1stL IS OP ary sub { ary_itm_get_idxL ary (first sub) } ????!!!! all tests now fail in [ary_restruct_groupTest, ary_idxSlc_groupTest] Did I corrupt 'QNial test optrs.ndf'??? >> might be due to 'QNial setup header.ndf' - gives faults as initial defns? Take a break - fix garage. qnial> groupTest "ary_restruct_groupTest o ary_restruct_groupTest 2 60 62 >> no workee ?not an operation qnial> ary_to_atmL (1 `t `z) 1 t z qnial> ary_to_atmL (3 3 reshape tell 10) 0 1 2 3 4 5 6 7 8 qnial> ary_sub_get_idxL 'the bigg fat cow' 'g' +---+---+ |+-+|+-+| ||6|||7|| |+-+|+-+| +---+---+ >> works fine? qnial> tstOptr "ary_to_atmL_testSimple o ary_to_atmL_testSimple 0 10 10 >> no workee ?not an operation 'QNial test optrs.ndf' uses : ary_sub_get_idxll >> change to ary_sub_get_idxll qnial> tstOptr "ary_to_atmL_testSimple l ary_to_atmL_testSimple 10 0 10 >> OK!! qnial> groupTest "ary_restruct_groupTest l ary_restruct_groupTest 62 0 62 qnial> groupTest "ary_idxSlc_groupTest o ary_idxSlc_groupTest 94 180 197 ary_idxSlc_groupTest start time : 11Dec2022 15h29m10s need to fix _testStd - same change ary_sub_get_idxll to ary_sub_get_idxll qnial> groupTest "ary_idxSlc_groupTest o ary_idxSlc_groupTest 160 153 197 +--+----------------------------------+-------+------+-----+ |OK|test (optr) |correct|faults|total| +--+----------------------------------+-------+------+-----+ | l|ary_chk_idx_compatible_testSimple | 27| 25| 27| +--+----------------------------------+-------+------+-----+ | l|ary_chk_itm_get_idxL_testStd | 27| 24| 27| +--+----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_idx1stL_testStd | 23| 15| 27| +--+----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_idx1stL_testSimple| 5| 0| 6| +--+----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_idxL_testStd | 16| 15| 27| +--+----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_idxL_testSimple | 3| 1| 5| +--+----------------------------------+-------+------+-----+ | l|ary_chk_slc_compatible_testSimple | 31| 31| 31| +--+----------------------------------+-------+------+-----+ | l|ary_chk_itm_get_slcL_testSimple | 25| 17| 25| +--+----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_slcL_testSimple | 3| 25| 22| +--+----------------------------------+-------+------+-----+ +-----+ ary_chk_sub_get_idx1stL_testStd +--+-----------+----------------+----------------+ | o|lst_lst03 |+-+ |+-+-+--+ | | | ||3| ||3|8|12| | | | |+-+ |+-+-+--+ | +--+-----------+----------------+----------------+ | o|lst_lst04 |+-+ |+-+-+ | | | ||7| ||6|7| | | | |+-+ |+-+-+ | +--+-----------+----------------+----------------+ | o|lst_lst06 |+-+--+ |+-+--+--+ | | | ||4|20| ||4|16|20| | | | |+-+--+ |+-+--+--+ | +--+-----------+----------------+----------------+ | o|lst_lst07 |+--+--+ |+-+--+--+ | | | ||10|23| ||2|10|23| | | | |+--+--+ |+-+--+--+ | +--+-----------+----------------+----------------+ ary_sub_get_idx1stL - oops, change that I just made doesn't ensure that sub is in ary! ary_sub_get_idx1stL IS OP ary sub { LOCAL fnd1stSubItmidxAL fndMaxidxL idx resFltL shapeSub slicer subFindL subt fit1stSubItmidxAL fitMaxidxL mch1stSubItmidxAL ; % ; resFltL := ary_compatible_sub ary sub ; resFltL := link resFltL ((first sub) ary_itm_find_idxL ary) ; % ; IF (NOT ary_hasFaults resFltL) THEN fnd1stSubItmidxAL := resFltL ; shapeSub := gage shape sub ; fndMaxidxL := fnd1stSubItmidxAL EACHLEFT sum shapeSub ; fitMaxidxL := EACH OR EACH OR list ( ((gage shape ary) EACHRIGHT - fndMaxidxL) EACHLEFT >= 0 ) ; fit1stSubItmidxAL := fitMaxidxL subList fnd1stSubItmidxAL ; % view intermediates : fnd1stSubItmidxAL fndMaxidxL fit1stSubItmidxAL fitMaxidxL ; IF (= null fit1stSubItmidxAL) THEN resFltL := fault '?sp1ia2' ; ELSEIF (ary_hasFaults fit1stSubItmidxAL) THEN resFltL := fault '?sp1ia3' ; ELSE % find matches ; mch1stSubItmidxAL := null ; FOR idx WITH fit1stSubItmidxAL DO slicer := sub_idx_to_slc sub idx ; subt := ary|slicer ; IF (ary_hasFaults subt) THEN mch1stSubItmidxAL := fault '?sp1ia4' ; ELSE mch1stSubItmidxAL := append mch1stSubItmidxAL idx ; ENDIF ; ENDFOR ; resFltL := mch1stSubItmidxAL ; ENDIF ; ENDIF ; % ; resFltL } >> a few more updates to the above qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd o ary_chk_sub_get_idx1stL_testStd 12 27 27 >> ?ary_itm_find_idxL undefined (QNial setup header.ndf) >> OK, remove from header ary_itm_find_idxL IS OP itm ary { fault '?ary_itm_find_idxL undefined (QNial setup header.ndf)' } >> change in ary_sub_get_idx1stL nyet? ary_itm_find_idxL -> ary_itm_get_idxL easiest to simply retrieve full idxL?? I flip-flopped on that a few times, including just recently ?undefined identifier: LAST ( ARY_ITM_FIND_IDXL <***> `. PINN ) <<< loading ended : file_ops.ndf errors found: 1 >>> loading start : windows.ndf ?undefined identifier: ; ( ARY_ITM_FIND_IDXL <***> 'dell64' WINSTR ) ?undefined identifier: WINTITLE_GOT := WINIDORTITLE_GET_WINTITLE <***> WINID ; <<< loading ended : windows.ndf >> changed these files qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd o ary_chk_sub_get_idx1stL_testStd 12 27 27 >> more small fixes qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd o ary_chk_sub_get_idx1stL_testStd 17 25 27 >> problem is mostly : ?arySubGetIdx1st3 >> but some non-fault results are good Can I get rid of ary_sub_get_idx1stL and just use ary_sub_get_idxL? >> finished for day, I'm tired >> answer - not the same things, probably need both? 08********08 #] 11Dec2022 Changed : idx_adrCompatible IS OP idx, adaptations Changed : idx_adrCompatible IS OP idx { LOCAL faultL ; faultL := null ; IF (~= 1 (valence idx)) THEN faultL := link faultL (fault '?idxValLT1') ; ELSEIF (= null idx) THEN faultL := link faultL (fault '?idxNull') ; ELSEIF (NAND EACH isInteger idx) THEN faultL := link faultL (fault '?idxNotIntL') ; ENDIF ; faultL } I fixed optr symbol names - get rid of LL, change : ary_chk_itm_get_slcLL_to_itmSlcL_testSimple to : ary_chk_itm_get_slcL_to_itmL_testSimple ary_idxA_to_slc - no longer exists!! qnial> see "ary_idxA_to_slc ary_idxa_to_slc IS OPERATION Ary Idx { fault '?ary_idxA_to_slc undefined (QNial setup header.ndf)' } remove from 'QNial setup header.ndf' : ary_idxA_to_slc IS OP ary idx { fault '?ary_idxA_to_slc undefined (QNial setup header.ndf)' } remove from "$d_Qtest"'arrays/arrays- testGroupsCluster.ndf' "ary_chk_idxA_to_slc_testSimple Change to : ary_sub_get_slcL IS OP ary sub { LOCAL allSlc resFltL subPosnA ; resFltL := ary_sub_get_idxLL ary sub ; IF (NOT ary_hasFaults resFltL) THEN subPosnA := resFltL ; resFltL := null ; resFltL := ary EACHRIGHT ary_idx_to_slc subPosnA ; ENDIF ; resFltL } +--+---------------------------------------+-------+------+-----+ |OK|test (optr) |correct|faults|total| +--+---------------------------------------+-------+------+-----+ | l|ary_chk_slc_compatible_testSimple | 31| 31| 31| +--+---------------------------------------+-------+------+-----+ | l|ary_chk_idx_to_slc_testSimple | 27| 25| 27| +--+---------------------------------------+-------+------+-----+ | l|ary_chk_slc_to_idxA_testSimple | 25| 20| 25| +--+---------------------------------------+-------+------+-----+ | l|ary_chk_itm_get_idxL_testStd | 27| 24| 27| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_itm_get_slcL_testSimple | 17| 25| 25| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_sub_get_slcL_testSimple | 7| 18| 22| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_itm_get_slcL_to_itmL_testSimple| 3| 36| 23| +--+---------------------------------------+-------+------+-----+ +-----+ ary_chk_itm_get_slcL_testSimple typical errors : +--+-----------+--------------------+----------------+ | o|lst01_atm |+-----+-----+------+|?L ?L ?L | | | ||+---+|+---+|+----+|| | | | |||[3]|||[8]|||[12]||| | | | ||+---+|+---+|+----+|| | | | |+-----+-----+------+| | +--+-----------+--------------------+----------------+ | o|ary01_itm |+---------------+ |+------+ | | | ||+------+------+| ||[1, 1]| | | | |||[ , 1]|[1, ]|| |+------+ | | | ||+------+------+| | | | | |+---------------+ | | +--+-----------+--------------------+----------------+ see also 08Dec2022 testing qnial> ary_itm_get_slcL 'the bigg fat cow' ` ?L ?L ?L flag_break it ary_itm_get_idxL ary itm returns a list of atoms! Change ary_itm_get_idxL IS OP ary itm { LOCAL resFlt ; resFlt := itm findall ary ; IF (= null resFlt) THEN fault '?aryItmGetIdxL01' ELSEIF (ary_hasFaults resFlt) THEN fault '?aryItmGetIdxL02' ELSE IF (= 0 (valence resFlt)) THEN resFlt = [resFlt] ; ENDIF ; resFlt ENDIF } To : ary_itm_get_idxL IS OP ary itm { LOCAL resFlt ; resFlt := EACH list (itm findall ary) ; IF (= null resFlt) THEN fault '?aryItmGetIdxL01' ELSEIF (ary_hasFaults resFlt) THEN fault '?aryItmGetIdxL02' ELSE IF (= 0 (valence resFlt)) THEN resFlt = [resFlt] ; ENDIF ; resFlt ENDIF } see "$d_SysMaint"'html/html codes notes.txt' verBar - is an unlabeled QNial type = transpose (3 1 reshape '+|+') qnial> a := ary_itm_get_idxL 'the bigg fat cow' ` +-+-+--+ |3|8|12| +-+-+--+ qnial> EACH isLst a lll >> OK qnial> tstOptr "ary_chk_itm_get_idxL_testStd l ary_chk_itm_get_idxL_testStd 27 24 27 >> OK qnial> a := ary_itm_get_slcL 'the bigg fat cow' ` +---+---+----+ |[3]|[8]|[12]| +---+---+----+ qnial> EACH isLst a lll >> OK +-----+ olde code # loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' IF flag_debug THEN write 'loading ary_chk_idxA_to_slc' ; ENDIF ; .#] ary_chk_idxA_to_slc IS OP ary idxA - only for ary_chk_idxA_to_slc_testSimple # 26Apr2022 initial # 23Jun2022 DON'T convert [ary, idxA] to shapes! ary_chk_idxA_to_slc IS OP ary idxA { ary_chk_idxA_apply_optrPhr ary idxA "ary_idxA_to_slc } # loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' IF flag_debug THEN write 'loading ary_chk_idxA_to_slc_testSimple' ; ENDIF ; .#] ary_chk_idxA_to_slc_testSimple := - convert idxA to slc, ALL idxA must be listLs!! # 17Nov2021 initial # 25Apr2022 haven't created ALLAxis version of optr yet!! # 03-06May2022 revamped # 04Jul2022 nested solys - why? : because idxA demands it - must be a list! # 04Jul2022 (4 5) versus [4 5] : completely different [process, result] (4 5) two idx, [4 5] one idx # tstOptr "ary_chk_idxA_to_slc_testSimple ary_chk_idxA_to_slc_testSimple := "tstSimple 2 "d_arrayTests ( "null01_nullL null [null] [EACH fault '?aryNoAdrValLT1' '?idxNull'] 'should be ?aryNoAdrValLT1 - isNull ary, nulls don"t have positions!, ?idxNull - (= null idx), nulls aren"t addresses!' "null01_atm null [[4]] [EACH fault '?aryNoAdrValLT1' '?idxAdrCompSolty'] 'should be ?aryNoAdrValLT1 - isNull ary, ?idxAdrCompSolty - aryTop_hasSolitary idx (mismatch idx & ary)' "atm01_nullLL `g [[null]] [EACH fault '?aryNoAdrValLT1' '?idxAdrCompSolty'] 'should be ?aryNoAdrValLT1 - isAtm ary, atoms don"t have positions!, ?idxAdrCompSolty - aryTop_hasSolitary idx (mismatch idx & ary)' "atm01_atmLL `g [[`g]] [EACH fault '?aryNoAdrValLT1' '?idxAdrCompSolty'] 'should be ?aryNoAdrValLT1 - isAtm ary, atoms don"t have positions!, ?idxAdrCompSolty - aryTop_hasSolitary idx (mismatch idx & ary)' "atm02_atmL 4 [4] [[fault '?aryNoAdrValLT1']] 'should be ?aryNoAdrValLT1 - nonInteger atms in idx' "lst01_nullLL 'the bigg fat cow' [[null]] [[fault '?idxAdrCompSolty']] 'should be ?idxNotIntL - aryTop_hasSolitary idx (mismatch idx & ary)' "lst01_atmLL 'the bigg fat cow' [[` ]] [[fault '?idxAdrCompSolty']] 'should be ?idxAdrCompSolty - aryTop_hasSolitary idx (mismatch idx & ary)' "lst02_fltLL (tell 10) [[fault '?faultTmp']] [[fault '?idxAdrCompSolty']] 'should be ?idxAdrCompSolty - aryTop_hasSolitary idx (mismatch idx & ary)' "lst01_idx 'the bigg fat cow' [4] ['[4]'] 'should be OK' "lst02_idx (tell 10) [6] ['[6]'] 'should be OK, note isLst result, no space before isAtm idx' "lst03_idx (4 5 6) [1] ['[1]'] 'should work OK, note isLst result, no space before isAtm idx' "lst01_idxL (tell 10) [4] ['[4]'] 'should work OK, note isLst result, no space before isAtm idx' "lst02_idxL (tell 10) (4 5) ('[4]' '[5]') 'should be OK, idxA = (4 5) are 2 idxs' "lstL01_idx ((tell 10) (tell 10) 4 5) [1] ['[1]'] 'should be OK' "lstL01_idxL ((tell 10) (tell 10) 4 5) [4 5] [[fault '?aryIdxVlc']] 'should be ?aryIdxVlc (~= aryVlc idxVlc), idxA = [4 5] one 2D address' "lstL02_idxL ((tell 10) (tell 10) 4 5) ([4] [5]) (EACH solitary (EACH fault '?idxAdrCompSolty' '?idxAdrCompSolty')) 'should be ?idxAdrCompSolty - (isSolitary idx), solitarys aren"t addresses!' "ary01_idx (4 5 reshape (tell 30)) [2] [[fault '?aryIdxVlc']] 'should be ?aryIdxVlc (~= aryVlc idxVlc), idxA has a single axis' "ary05_idx (4 5 reshape (tell 30)) [2 3] ['[2, 3]'] 'should work OK' "ary06_idx (4 5 reshape (tell 30)) (1 3) (EACH solitary (EACH fault '?aryIdxVlc' '?aryIdxVlc')) 'should be ?aryIdxVlc (~= aryVlc idxVlc), idxA has two idx, each of one axis' "ary07_idx (4 5 reshape (tell 30)) [1 3] ['[1, 3]'] 'should work OK?' "ary01_idxL (4 5 reshape (tell 30)) ((1 3) (2 3)) ('[1, 3]' '[2, 3]') 'OK, I don"t properly understand solitaries etc of results' "ary02_idxL (4 5 reshape (tell 30)) ([1 3] [2 3]) (EACH (solitary fault) '?idxAdrCompSolty' '?idxAdrCompSolty') 'should be for both : ?idxAdrCompSolty aryTop_hasSolitary idx (mismatch idx & ary)' "ary03_idxL (4 5 reshape (tell 30)) ((2 3) (1 2)) ('[2, 3]' '[1, 2]') 'should be OK' "ary01_idxA (3 4 reshape (tell 20)) (1 1 reshape 0 4) [[fault '?aryIdxVlc']] 'should be ?aryIdxVlc (~= aryVlc idxVlc)' "ary02_idxA (4 5 reshape (tell 30)) (2 2 reshape 1 2 3 6 7 8) (EACH solitary (4 reshape (fault '?aryIdxVlc'))) 'should be ?aryIdxVlc (~= aryVlc idxVlc), note ary structure NOT preserved in result' "ary03_idxA (4 5 reshape (tell 30)) (2 2 reshape (EACH solitary (cart ((1 1) EACHBOTH + (EACH tell 2 3))))) (EACH solitary (4 reshape (fault '?idxAdrCompSolty'))) '??should be ?idxAdrCompSolty - aryTop_hasSolitary idx (mismatch idx & ary), note ary structure NOT preserved in result' "ary04_idxA (4 5 reshape (tell 30)) (2 3 reshape (cart ((1 1) EACHBOTH + (EACH tell 2 3)))) (2 3 reshape ('[1, 1]' '[1, 2]' '[1, 3]' '[2, 1]' '[2, 2]' '[2, 3]')) 'should be OK, note ary structure preserved in result' ) ; 08********08 #] 08Dec2022 revisit groupTest "ary_slice_groupTest +--------------------++--------------------+ | 7Nov2022 18h19m16s || 29Nov2022 13h09m42s| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ |OK|test (optr) |correct|faults|total||correct|faults|total| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_slc_compatible_testSimple (2) | 0| 31| 31|| 30| 30| 31| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_idx_to_slc_testSimple (3) | 0| 27| 27|| 21| 23| 27| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_idxA_to_slc_testSimple (4) | 0| 27| 27|| 7| 47| 27| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_slc_to_idxA_testSimple | 0| 25| 25|| 25| 20| 25| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_itm_get_slcLL_testSimple | 0| 25| 25|| 17| 25| 25| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|?ary_chk_itm_get_slcLL_to_itm_testSimple (1)| 0| 1| 1|| 0| 1| 1| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_sub_get_slcL_testSimple | 0| 22| 22|| 5| 22| 22| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ (1) ?ary_chk_itm_get_slcLL_to_itm_testSimple error : unknown tstTypPhr (2) ary_chk_slc_compatible_testSimple fixed 28Nov2022 (3) ary_chk_idx_to_slc_testSimple fixed 29Nov2022 (4) ary_chk_idxA_to_slc_testSimple leave for later!! (eg dat0 EACHRIGHT ary_idxA_to_slc dat1) qnial> tstOptr "ary_chk_slc_compatible_testSimple o ary_chk_slc_compatible_testSimple 29 31 31 >> oops - one more wrong now >> simple fault changes - done qnial> tstOptr "ary_chk_slc_compatible_testSimple l ary_chk_slc_compatible_testSimple 31 31 31 >> bingo qnial> tstOptr "ary_chk_idx_to_slc_testSimple l ary_chk_idx_to_slc_testSimple 27 25 27 >> OK - better than before! qnial> tstOptr "ary_chk_idxA_to_slc_testSimple o ary_chk_idxA_to_slc_testSimple 1 48 27 >> hah! worse than before (faults?) >> not sure about this - not needed? (eg dat0 EACHRIGHT ary_idxA_to_slc dat1) qnial> tstOptr "ary_chk_slc_to_idxA_testSimple o ary_chk_slc_to_idxA_testSimple 23 20 25 >> now 2 new errors - same issue as for "ary_chk_slc_compatible_testSimple qnial> tstOptr "ary_chk_slc_to_idxA_testSimple l ary_chk_slc_to_idxA_testSimple 25 20 25 >> OK now qnial> tstOptr "ary_chk_idx_get_slcLL_testSimple >> many faults : '?not an operation' >> ???should be ary_chk_idx[A]_to_slcLL_testSimple??? >> remove for now from "ary_slice_groupTest qnial> tstOptr "ary_chk_itm_get_idxL_testStd l ary_chk_itm_get_idxL_testStd 27 24 27 qnial> tstOptr "ary_chk_itm_get_slcLL_testSimple >> conceptual failure...not doing what it's supposed to do qnial> tstOptr "ary_chk_itm_get_slcLL_testSimple o ary_chk_itm_get_slcLL_testSimple 3 25 25 Change to : +--+ ary_itm_get_slcLL IS OP ary itm { LOCAL i resFltL slcStrLL ; resFltL := ary_itm_get_idxL ary itm ; IF (NOT ary_hasFaults resFltL) THEN idxL := resFltL ; resFltL := null ; % solitary (square parens) allows later optrs to process slcs together for a given idx ; FOR idx WITH idxL DO resFltL := link resFltL [ary_idx_to_slc ary idx] ; ENDFOR ; ENDIF ; resFltL } +--+ qnial> tstOptr "ary_chk_itm_get_slcLL_testSimple o ary_chk_itm_get_slcLL_testSimple 17 25 25 >> better a bit, ALL faults are OK, but problem with actual examples and fault ?L, eg : +--+-----------+--------------------+----------------+ | o|lst01_atm |+-----+-----+------+|?L ?L ?L | | | ||+---+|+---+|+----+|| | | | |||[3]|||[8]|||[12]||| | | | ||+---+|+---+|+----+|| | | | |+-----+-----+------+| | +--+-----------+--------------------+----------------+ Test one of examples : qnial> ary_itm_get_slcLL 'the bigg fat cow' ` ?L ?L ?L qnial> ary_idx_to_slc 'the bigg fat cow' 3 ?L >> WHAT? retry qnial> tstOptr "ary_chk_idx_to_slc_testSimple l ary_chk_idx_to_slc_testSimple 27 25 27 >> OK, so what gives with ary_itm_get_slcLL? maybe : get_slcLL versus get_slc??? slc@axi := link (' ' EACHRIGHT link [string idx@axi]) ; must idx be a list? try : qnial> a := ary_idx_to_slc 'the bigg fat cow' [3] [3] qnial> isstring a l >> BINGO!! idx be a list of valence 1, shape = valence ary!! (or it won't generalize to higher dimension) Change to : ary_itm_get_idxL IS OP ary itm { LOCAL resFlt ; resFlt := itm findall ary ; IF (= null resFlt) THEN fault '?aryItmGetIdxL01' ELSEIF (ary_hasFaults resFlt) THEN fault '?aryItmGetIdxL02' ELSE IF (= 0 (valence resFlt)) THEN resFlt = [resFlt] ; ENDIF ; resFlt ENDIF } qnial> ary_itm_get_idxL (tell 10) 3 3 qnial> a := ary_itm_get_idxL (tell 10) 3 3 qnial> shape a 1 qnial> ary_itm_get_slcLL 'the bigg fat cow' ` ?L ?L ?L >> NUTS - didn't work.. qnial> tstOptr "ary_chk_sub_get_slcL_testSimple >> all OK +-----+ olde code # loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' IF flag_debug THEN write 'loading ary_chk_idx_get_slcLL' ; ENDIF ; .#] ary_chk_idx_get_slcLL IS OP ary idx - only for ary_chk_idx_get_slcLL_testSimple .#] special form of ary_idx_get_slcLL for testing # 26Apr2022 initial # 23Jun2022 DON'T convert [ary, idx] to shapes! ary_chk_idx_get_slcLL IS OP ary idx { ary_chk_idx_apply_optrPhr ary idx "ary_idx_get_slcLL } # loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' IF flag_debug THEN write 'loading ary_chk_idx_get_slcLL_testSimple' ; ENDIF ; .#] ary_chk_idx_get_slcLL_testSimple := - list of [row, col, plane, array] slices eg [(0,,) (,,5)] .# special form of ary_idx_get_slcLL for testing # 17Nov2021 initial # 25Apr2022 haven't created ALLAxis version of optr yet!! # tstOptr "ary_chk_idx_get_slcLL_testSimple ary_chk_idx_get_slcLL_testSimple := "tstSimple 2 "d_arrayTests ( "null01_null null null (EACH fault '?aryNoAdrValLT1' '?idxNull') 'should be ?aryNoAdrValLT1 - isNull ary, ?idxNull - isNull idx' "null01_atm null 4 [fault '?aryNoAdrValLT1'] 'should be ?aryNoAdrValLT1 - isNull ary' "atm01_null `g null (EACH fault '?aryNoAdrValLT1' '?idxNull') 'should be ?aryNoAdrValLT1 - isAtm ary, atoms don"t have positions!, ?idxNull - isNull idx' "atm01_atm `g `g (EACH fault '?aryNoAdrValLT1' '?idxAdrCompSingl') 'should be ?aryNoAdrValLT1 - isAtm ary, atoms don"t have positions!, ?idxAdrCompSingl - (isSingle idx), non-int singles aren"t addresses!' "atm02_atm 4 4 [fault '?aryNoAdrValLT1'] 'should be ?aryNoAdrValLT1 - isAtm ary, atoms don"t have positions!' "lst01_null 'the bigg fat cow' null [fault '?idxNull'] 'should be ?idxNull - isNull idx' "lst01_atm 'the bigg fat cow' ` [fault '?idxAdrCompSingl'] 'should be ?idxAdrCompSingl - (isSingle idx), non-int singles aren"t addresses!' "lst02_atm (tell 10) (fault '?faultTmp') [fault '?idxAdrCompFault'] 'should be ?idxAdrCompFault - (isFault idx), faults aren"t addresses!' "lst01_idx 'the bigg fat cow' 4 ['[4]'] 'should be OK, note that the result is a listL (not obvious from picture output)' "lst02_idx (tell 10) 6 ['[6]'] 'should be OK, note that the result is a listL (not obvious from picture output)' "lst03_idx (4 5 6) 1 ['[1]'] 'should work OK, note that the result is a listL (not obvious from picture output)' "lst01_idxL (tell 10) [4] [fault '?idxAdrCompSolty'] 'should be ?idxAdrCompSolty - aryAllTop_isSolitary idx(mismatch idx &ary)' "lst02_idxL (tell 10) (4 5) [fault '?aryIdxVlc'] 'should be ?aryIdxVlc (~= aryVlc idxVlc)' "lstL01_idx ((tell 10) (tell 10) 4 5) 1 ['[1]'] 'should work OK, note that a list of one itm is returned' "lstL02_idxL ((tell 10) (tell 10) 4 5) (4 5) [fault '?aryIdxVlc'] 'should be ?aryIdxVlc (~= aryVlc idxVlc)' "lstL03_idxL ((tell 10) (tell 10) 4 5) ([4] [5]) [fault '?idxNotIntL'] 'should be ?idxNotIntL - NOR is[Int, Null] idx,?idxAdrCompSolty - aryAllTop_isSolitary idx(mismatch idx & ary)' "ary01_idxL (3 4 reshape (tell 20)) (0 3) ('[ , 3]' '[0, ]') 'should work OK, note that a list of aryVal slices is returned' "ary02_idxL (4 5 reshape (tell 30)) (2 3) ('[ , 3]' '[2, ]') 'should work OK, note that a list of aryVal slices is returned' "ary03_idxL (4 5 reshape (tell 30)) 2 [fault '?aryIdxVlc'] 'should be ?aryIdxVlc (~= aryVlc idxVlc)' "ary04_idxL (4 5 reshape (tell 30)) (4 5) [fault '?aryIdxTooBig'] 'should be ?aryIdxTooBig - (OR (aryShp EACHBOTH < idxShp))' "ary05_idxL (3 4 reshape (tell 20)) (0 3) ('[ , 3]' '[0, ]') 'should work OK, note that a list of aryVal slices is returned' "ary06_idxL (4 5 reshape (tell 30)) ((2 3) (1 2)) [fault '?idxNotIntL'] 'should be ?idxNotIntL - (NAND EACH isInteger idx), non-ints aren"t addresses!' "ary01_idxA (3 4 reshape (tell 20)) (1 1 reshape 0 4) [fault '?aryIdxVlc'] 'should be ?aryIdxVlc - not is[Atm, Lst] idx' "ary02_idxA (4 5 reshape (tell 30)) (2 3 reshape 1 2 3 6 7 8) [fault '?aryIdxVlc'] 'should be ?aryIdxVlc - not is[Atm, Lst] idx, (1 = 1, so solitaries are legitimate arys? ELSEIF (isSolitary ary) THEN faultL := link faultL (fault '?aryAdrCompSolty') ; # ?aryAdrCompSolty ary_adrCompatible isSolitary ary, solitarys don"t have positions! # qnial> a@4 4 qnial> a@[4] 4 >> isatom idx -> will sometimes work anyways # 29Nov2022 ELSEIF (isSingle ary) THEN faultL := link faultL (fault '?aryNoAdrSingl') ; #? ary_adrCompatible ?aryNoAdrSingl isSingle ary, singles don"t have positions! ELSEIF (isFault ary) THEN faultL := link faultL (fault '?aryNoAdrFault') ; ELSEIF (isAtm ary) THEN faultL := link faultL (fault '?aryNoAdrAtm' ) ; #? ary_adrCompatible ?aryNoAdrNull isNull ary, nulls don"t have positions! #? ary_adrCompatible ?aryNoAdrFault isFault ary, faults don"t have positions! #? ary_adrCompatible ?aryNoAdrAtm isAtm ary, atoms don"t have positions! 08********08 #] 07Dec2022 nial7_LMDE64: error while loading shared libraries: libreadline.so.6 $ qnial /home/bill/web/Qnial/nial7_LMDE64: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory >> looks like I must re-compile nial7_LMDE64? see '/home/bill/PROJECTS/SW install & maintain/Qnial7/BuildNial' $ /home/bill/web/Qnial/nial7_LMDE64 /home/bill/web/Qnial/nial7_LMDE64: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory $ /home/bill/PROJECTS/SW install & maintain/Qnial7/binaries/Linux/nial64 [1] 64200 bash: /home/bill/PROJECTS/SW: No such file or directory bash: maintain/Qnial7/binaries/Linux/nial64: No such file or directory [1]+ Exit 127 /home/bill/PROJECTS/SW install >> spaces in subDir are a problem : 'SW install & maintain' This was resolved by completely re-compiling QNial for the upgraded LMDE! still many outstanding issues d_webSite="$d_meda"'WebSite/' 08********08 #] 30Nov2022 groupTest "ary_slice_groupTest +--------------------++--------------------+ | 7Nov2022 18h19m16s || 29Nov2022 13h09m42s| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ |OK|test (optr) |correct|faults|total||correct|faults|total| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_slc_compatible_testSimple (2) | 0| 31| 31|| 30| 30| 31| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_idx_to_slc_testSimple (3) | 0| 27| 27|| 21| 23| 27| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_idxA_to_slc_testSimple | 0| 27| 27|| 7| 47| 27| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_idx_get_slcLL_testSimple | 0| 26| 26|| 16| 29| 26| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_itm_get_slcLL_testSimple | 0| 25| 25|| 17| 25| 25| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|?ary_chk_itm_get_slcLL_to_itm_testSimple (1)| 0| 1| 1|| 0| 1| 1| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_slc_to_idxA_testSimple | 0| 25| 25|| 25| 20| 25| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ | o|ary_chk_sub_get_slcL_testSimple | 0| 22| 22|| 5| 22| 22| +--+--------------------------------------------+-------+------+-----++-------+------+-----+ (1) ?ary_chk_itm_get_slcLL_to_itm_testSimple error : unknown tstTypPhr (2) fixed 28Nov2022 (3) fixed 29Nov2022 qnial> tstOptr "ary_chk_idxA_to_slc_testSimple o ary_chk_idxA_to_slc_testSimple 1 48 27 >> hah! worse than before (faults?) 08********08 #] 29Nov2022 groupTest "ary_slice_groupTest ary_slice_groupTest -> NO results?!? qnial> groupTest "ary_slice_groupTest o ary_slice_groupTest 121 197 184 see table above (tracks work) This is going to be a slow slugout, but is no longer daunting? +-----+ ary_chk_slc_compatible_testSimple start time : 29Nov2022 13h09m42s +--+------------+---------------------------------+---------------------------------+ | o|ary12_slc |?arySlcShp | l| +--+------------+---------------------------------+---------------------------------+ "ary12_slc (4 5 reshape (tell 30)) '[1, 5]' [fault '?arySlcShp'] 'bad ary_slc_compatible test : should be ?arySlcShp - (OR ((gage shape ary) EACHBOTH < maxIdxL)' >> seems should fail as stated!! qnial> groupTest "ary_slice_groupTest o ary_slice_groupTest 121 197 184 qnial> a := 4 5 reshape (tell 30) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 qnial> ary := a 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 qnial> aryShp := gage shape ary 4 5 qnial> aryShp EACHBOTH < 1 5 oo >> YIKES - types.ndf -> ary_slc_compatible : should be <= criteria? +--+ Change : IF (OR ((gage shape ary) EACHBOTH < maxIdxL)) THEN faultL := link faultL (fault '?arySlcShp') ; To : IF (OR ((gage shape ary) EACHBOTH <= maxIdxL)) THEN faultL := link faultL (fault '?arySlcShp') ; +--+ loaddefs link d_Qndfs 'types.ndf' qnial> groupTest "ary_slice_groupTest o ary_slice_groupTest 122 198 184 >> OK, works!! +-----+ ary_chk_idx_to_slc_testSimple +--+------------+-------------------------------+-------------------------------+ | o|lst01_idxAtm|[4] |[?address] | +--+------------+-------------------------------+-------------------------------+ | o|lst02_idxAtm|[6] |[?address] | +--+------------+-------------------------------+-------------------------------+ | o|lst03_idxAtm|[1] |[?address] | +--+------------+-------------------------------+-------------------------------+ | o|lst01_idxL |?idxAdrCompSolty |[4] | +--+------------+-------------------------------+-------------------------------+ | o|lstL01_idx |[1] |[?address] | +--+------------+-------------------------------+-------------------------------+ | o|ary07_idx |?idxAdrCompSolty |?idxAdrCompNotIntL | +--+------------+-------------------------------+-------------------------------+ >> Hmm, recently, I changed to enforcing = (EACH valence idx ary) ary_idx_compatible +-----+ Change : aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; IF (AND (isAtm idx) (= 1 aryVlc)) THEN faultL := null ; ELSEIF (~= aryVlc idxShp) THEN faultL := link faultL (fault '?aryVlcIdxShp') ; ELSEIF (OR (aryShp EACHBOTH <= idx)) THEN faultL := link faultL (fault '?aryIdxTooBig') ; ENDIF ; To: aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; IF (~= aryVlc idxVlc) THEN faultL := link faultL (fault '?aryIdxVlc') ; ELSEIF (OR (aryShp EACHBOTH <= idx)) THEN faultL := link faultL (fault '?aryIdxTooBig') ; ENDIF ; +-----+ After tons of improvements : qnial> tstOptr "ary_chk_idx_to_slc_testSimple l ary_chk_idx_to_slc_testSimple 27 25 27 >> works, but commentsd are out of whack now 08********08 #] 29Nov2022 ary_posn_groupTest start time : 20Nov2022 16h29m48s +--+----------------------------------+-------+------+-----+ |OK|test (optr) |correct|faults|total| +--+----------------------------------+-------+------+-----+ | o|ary_chk_idx_compatible_testSimple | 18| 22| 27| OK +--+----------------------------------+-------+------+-----+ | o|ary_chk_idx_get_itm_testSimple | 13| 22| 22| OK, just did +--+----------------------------------+-------+------+-----+ | l|ary_chk_itm_get_idxL_testStd | 27| 24| 27| OK 20Nov2022 +--+----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_idx1stL_testStd | 23| 15| 27| 4 wrong 20Nov2022 +--+----------------------------------+-------+------+-----+ | o|ary_chk_sub_get_idx1stL_testSimple| 5| 1| 6| 1 wrong 20Nov2022 +--+----------------------------------+-------+------+-----+ | l|ary_chk_sub_get_idxLL_testStd | 27| 15| 27| OK +--+----------------------------------+-------+------+-----+ | l|ary_chk_sub_get_idxLL_testSimple | 5| 1| 5| OK +--+----------------------------------+-------+------+-----+ +-----+ ary_chk_sub_get_idx1stL_testSimple start time : 20Nov2022 16h29m48s +--+-----------+-------+---------+ | o|ary_lst02 |?sp1ia4|?spAllia1| +--+-----------+-------+---------+ arrays.ndf : #? ary_sub_get_idxLL ?spAllia1 - sub not found ?sp1ia4 - not in [array, type]s.ndf >> simple fix +-----+ ary_chk_sub_get_idx1stL_testStd start time : 20Nov2022 16h29m48s +--+-----------+-----------------+-----------------+ | o|lst_lst03 |3 8 12 |3 | +--+-----------+-----------------+-----------------+ | o|lst_lst04 |6 7 |7 | +--+-----------+-----------------+-----------------+ | o|lst_lst06 |4 16 20 |4 20 | +--+-----------+-----------------+-----------------+ | o|lst_lst07 |2 10 23 |10 23 | +--+-----------+-----------------+-----------------+ >> quick fixes : qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd o ary_chk_sub_get_idx1stL_testStd 26 15 27 >> oops, nuts +--+-----------+-----------------+-----------------+ | o|lst_lst07 |10 |10 23 | +--+-----------+-----------------+-----------------+ >> fixed omission qnial> tstOptr "ary_chk_sub_get_idx1stL_testStd l ary_chk_sub_get_idx1stL_testStd 27 15 27 >> OK +-----+ Test all : qnial> groupTest "ary_posn_groupTest l ary_posn_groupTest 141 99 141 08********08 #] 21Nov2022 ary_idx_compatible - conceptual challenge I've already changed back&forth on this several times. Hard to "see" how it should work? +-----+ | o|ary_chk_idx_get_itm_testSimple | 13| 22| 22| +--+-----------+--------------------------------+--------------------------------+ | o|idx_lst02 |?idxAdrCompSolty |i | +--+-----------+--------------------------------+--------------------------------+ | o|idx_lstL01 |?aryVlcIdxShp |?aryIdxTooBig | +--+-----------+--------------------------------+--------------------------------+ | o|idx_lstL02 |?idxAdrCompSolty |0 1 2 3 4 5 6 7 8 9 | +--+-----------+--------------------------------+--------------------------------+ | o|idxL_lst01 |?aryVlcIdxShp |?aryIdxItmNot | +--+-----------+--------------------------------+--------------------------------+ | o|idxL_lstL01|?aryVlcIdxShp |?aryIdxTooBig | +--+-----------+--------------------------------+--------------------------------+ | o|idx_ary01 | 19|?aryIdxVlc | +--+-----------+--------------------------------+--------------------------------+ | o|idx_ary02 |?aryVlcIdxShp |?aryIdxVlc | +--+-----------+--------------------------------+--------------------------------+ | o|idx_ary03 | 23|?aryIdxVlc | +--+-----------+--------------------------------+--------------------------------+ | o|idx_ary04 |?aryVlcIdxShp |?aryIdxVlc | +--+-----------+--------------------------------+--------------------------------+ |?idxAdrCompSolty - no longer an error, revert ot calc minor fixes (mostly fault codes) : qnial> tstOptr "ary_chk_idx_get_itm_testSimple o ary_chk_idx_get_itm_testSimple 18 20 22 Most recently : # 10Nov2022 change ELSEIF (~= aryVlc idxShp) THEN faultL := link faultL (fault '?aryVlcIdxShp') ; to ELSEIF (~= aryVlc idxVlc) THEN faultL := link faultL (fault '?aryIdxVlc') ; #? ?aryVlcIdxShp ary_idx_compatible (~= aryVlc idxShp) >> but aryVlcIdxShp looks correct, as well as Change : +-----+ ary_idx_compatible IS OP ary idx { LOCAL aryVlc idxVlc faultL ; % ; faultL := ary_adrCompatible ary ; faultL := link faultL (idx_adrCompatible idx) ; % ; IF (NOT ary_hasFaults faultL) THEN aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; IF (AND (isAtm idx) (= 1 aryVlc)) THEN faultL := null ; ELSEIF (~= aryVlc idxVlc) THEN faultL := link faultL (fault '?aryIdxVlc') ; ELSEIF (OR (aryShp EACHBOTH <= idx)) THEN faultL := link faultL (fault '?aryIdxTooBig') ; ENDIF ; ENDIF ; % ; IF (= null faultL) THEN l ELSE faultL ENDIF } +-----+ To : +-----+ ary_idx_compatible IS OP ary idx { LOCAL aryVlc idxVlc faultL ; % ; faultL := ary_adrCompatible ary ; faultL := link faultL (idx_adrCompatible idx) ; % ; IF (NOT ary_hasFaults faultL) THEN aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; IF (AND (isAtm idx) (= 1 aryVlc)) THEN faultL := null ; ELSEIF (~= aryVlc idxShp) THEN faultL := link faultL (fault '?aryVlcIdxShp') ; ELSEIF (OR (aryShp EACHBOTH <= idx)) THEN faultL := link faultL (fault '?aryIdxTooBig') ; ENDIF ; ENDIF ; % ; IF (= null faultL) THEN l ELSE faultL ENDIF } # fault codes (can't have apos! use quotes) : #? ?aryIdxVlc ary_idx_compatible (~= aryVlc idxVlc) #? ?aryIdxTooBig ary_idx_compatible (OR (aryShp EACHBOTH < idxShp)) +-----+ Run test again qnial> tstOptr "ary_chk_idx_compatible_testSimple o ary_chk_idx_compatible_testSimple 25 23 27 >> much better (why did I previously change back to ?aryIdxVlc?) 2 faults : ?idxAdrCompSolty but that doesn't exist anymore (resStd update to l) qnial> tstOptr "ary_chk_idx_compatible_testSimple l ary_chk_idx_compatible_testSimple 27 23 27 29Nov2022 More errors now? : ary_chk_idx_get_itm_testSimple start time : 21Nov2022 09h40m55s +--+-----------+--------------------------------+--------------------------------+ | o|idx_lstL01 |?aryIdxTooBig |?aryVlcIdxShp | +--+-----------+--------------------------------+--------------------------------+ | o|idxL_lstL01|?aryIdxTooBig |?aryVlcIdxShp | +--+-----------+--------------------------------+--------------------------------+ | o|idx_ary02 |?aryVlcIdxShp |?aryIdxTooBig | +--+-----------+--------------------------------+--------------------------------+ | o|idx_ary04 |?aryVlcIdxShp |?aryIdxTooBig | +--+-----------+--------------------------------+--------------------------------+ >> Hilarious switching of errors? - I corrected resStds qnial> tstOptr "ary_chk_idx_get_itm_testSimple l ary_chk_idx_get_itm_testSimple 22 20 22 >> OK, next 08********08 #] 20Nov2022 groupTest ["ary_restruct_groupTest, "ary_posn_groupTest] qnial> groupTest "ary_restruct_groupTest l ary_restruct_groupTest 62 0 62 qnial> groupTest "ary_posn_groupTest o ary_posn_groupTest 118 100 141 08********08 #] 20Nov2022 ary_sub_get_[idx1stL, idxLL] - run tests Position of [atm, itm, sub]s in aryTop : ary_chk_itm_get_idxL IS OP ary itm - only for ary_chk_itm_get_idxL_testStd ary_chk_itm_get_idxL_testStd := - returns LIST of Substr positions in Str, or an error ary_chk_sub_get_idx1stL IS OP ary sub - res ipsa loquitor ary_chk_sub_get_idx1stL_testStd := - results and comments ary_chk_sub_get_idx1stL_testSimple := - results and comments this set is specifically for "up-dimensioned" subs ary_chk_sub_get_idxLL IS OP ary sub - res ipsa loquitor ary_chk_sub_get_idxLL_testStd := - returns list of Substr positions in Str, or an error ary_chk_sub_get_idxLL_testSimple := - returns list of Substr positions in Str, or an error . NUTS! ary_sub_get_idx1stL returns all idx of sub, not just t6he 1st!! terrible - matches of sub not checked (idiot!) ary_sub_get_idx1stL change : +.....+ FOR idxUL WITH fit1stSubItmidxAL DO idxL := sub_idxUL_to_idxA sub idxUL ; IF (NOT ary_hasFaults idxL) THEN mch1stSubItmidxAL := append mch1stSubItmidxAL idxL ; ENDIF ; ENDFOR ; +.....+ To : +.....+ FOR idxUL WITH fit1stSubItmidxAL DO idxL := sub_idxUL_to_idxA sub idxUL ; IF (NOT ary_hasFaults idxL) THEN IF (= sub (ary#idxL)) THEN mch1stSubItmidxAL := append mch1stSubItmidxAL idxL ; ENDIF ; ENDIF ; ENDFOR ; +.....+ ary_sub_get_idxLL change : +.....+ resFltL := ary_itm_get_idx1stL ary sub ; IF (NOT ary_hasFaults resFltL) THEN aryPointL := resFltL ; resFltL := null ; FOR aryPoint WITH aryPointL DO idxA := aryPoint EACHBOTH + (gage shape sub) ; subt := idxA choose ary ; IF (= sub subt) THEN resFltL := link resFltL [idxA] ; ENDIF ; ENDFOR ; ENDIF ; +.....+ To : +.....+ resFltL := ary_itm_get_idxL ary (first sub) ; IF (NOT ary_hasFaults resFltL) THEN aryPointL := resFltL ; resFltL := null ; FOR aryPoint WITH aryPointL DO idxA := aryPoint EACHBOTH + (gage shape sub) ; LATER -EACHRIGHT!! subt := idxA choose ary ; IF (= sub subt) THEN resFltL := link resFltL [idxA] ; ENDIF ; ENDFOR ; ENDIF ; +.....+ OK, run tests : qnial> tstOptr "ary_chk_itm_get_idxL_testStd l ary_chk_itm_get_idxL_testStd 27 24 27 qnial> tstOptr "ary_chk_sub_get_idxLL_testStd o ary_chk_sub_get_idxLL_testStd 17 16 27 >> oops, but at least some tests work now... many results LOOK like the resStd, but are wrong? (9 out of 10 wrong) maybe faults MUST all be part of lists? not solitaries or atoms "atm_atm01 qnial> a := ary_sub_get_idxLL `g `g ?spAllia4 qnial> isfault a l qnial> isfault [fault '?aryItmFindIdxL01'] o qnial> isfault fault '?aryItmFindIdxL01' l "lst_null01 qnial> a := ary_sub_get_idxLL 'the bigg fat cow' null ?aryItmFindIdxL01 qnial> isfault a l "lst_atm01 a := ary_sub_get_idxLL 'the bigg fat cow' ` . qnial> tstOptr "ary_chk_sub_get_idxLL_testSimple o ary_chk_sub_get_idxLL_testSimple 2 3 5 >> 3 of 5 give fault : ?spAllia4 problem may be valence > 1 "lst_atm02 qnial> a := ary_sub_get_idxLL (tell 10) 4 ?spAllia4 qnial> isfault a l qnial> a := ary_sub_get_idxLL (tell 10) [4] +-+ |4| +-+ >> sub must be valence >= 1 (not an atom) ***??? simple optr returns fault, test[Std, Simple] return [fault]? "lst_lst10 qnial> a := ary_sub_get_idxLL '[#=; backtrack ;=#]' '[#=; backtrack ;=#] Mega-Godzilla' ?spAllia4 >> CORRECT - [ary, sub] reverse ordered +-----+ qnial> tstOptr "ary_chk_sub_get_idxLL_testStd l ary_chk_sub_get_idxLL_testStd 27 16 27 >> good!! ary_sub_get_idxLL IS OP ary sub { LOCAL aryPoint aryPointL idxA resFltL subt subVolume ; % ; IF flag_break THEN BREAK ; ENDIF ; resFltL := ary_itm_get_idxL ary (first sub) ; IF (NOT ary_hasFaults resFltL) THEN aryPointL := resFltL ; subTellShp := tell (gage shape sub) ; resFltL := null ; FOR aryPoint WITH aryPointL DO idxA := aryPoint EACHRIGHT + subTellShp ; subt := ary#idxA ; IF (= sub subt) THEN resFltL := link resFltL [idxA] ; ENDIF ; ENDFOR ; ENDIF ; % ; IF (= null resFltL) THEN fault '?spAllia1' ELSE resFltL ENDIF } >> notice EACHRIGHT, not EACHBOTH!! qnial> tstOptr "ary_chk_sub_get_idxLL_testSimple l ary_chk_sub_get_idxLL_testSimple 5 1 5 double-check after code changes : qnial> tstOptr "ary_chk_sub_get_idxLL_testStd o ary_chk_sub_get_idxLL_testStd 26 15 27 >> oops, tricky last example - works well and great example qnial> tstOptr "ary_chk_sub_get_idxLL_testStd l ary_chk_sub_get_idxLL_testStd 27 15 27 +-----+ olde code IF flag_debug THEN write 'loading ary_sub_get_idx1stL' ; ENDIF ; # ary_sub_get_idx1stL IS OP ary sub - idxL of 1st item of sub in TOP level of ary (full sub found) # DON'T use!!!??? use ary_itm_get_idxL ary (first sub (reduces number of optrs) # best to use ary_chk_sub_apply_optrPhr ary sub "ary_sub_get_idx1stL - screen faults # Notes : # note that this is needed for 'QNial test optrs.ndf'! # findall returns [null if none, idxAL if found, isAtm err] # use [transpose, reverse] to re-orient ary and capture fits for those cases # mnemonics : fnd=fd, mch=match (eg [fnd1stSubItmidxAL, mch1stSubItmidxAL]) # reshape sub for further use, defaults to 1st Axs!!! # call must specify proper [shape, reverse, transpose] for specific results # 09Nov2021 initial # generalized form of "findall", only the first level of array is searched, not depth! # handle permutations including backwards? (later! - separate optr?) # 11Nov2021 had a ary_sub_get_idxLL, but seems this is useless? so removed optr declaration # 12Nov2021 # multiple posns may result (eg sub = 1 2 3, ary = 1 2 3 12 2 3 1 2 3) # overlapping posns may result (eg sub = 1 1 1, ary = 1 1 1 1 1 1) # 29Nov2021 works only for [sub, ary] of same valence? # 30Nov2021 list version from '211113 20h50m35s lists.ndf' % for which idxA_1stSubItm_in_aryTop can sub fit into ary? ; % it depends on the direction? ; % For (= EACH valence ary sub) always same Axs order, direction ; % ELSE, unless constrained by measurement units, freedom from extra dimensions ; % good example of the BAD math from ignoring meaasurement units!! ; % EASY, correct SOLUTION!!! : FORCE (= EACH valence sub ary) # 11Apr2022 renamed fltMsgs, not much update at all # 13Apr2022 simplified enormously, 19Apr2022 even more simple # 21Apr2022 should ary_sub_get_idx1stL faults be returned as a list to be constent with other optrs? # 20Apr2022 view intermediates : fnd1stSubItmidxAL fndMaxidxL fit1stSubItmidxAL fitMaxidxL ; # IF flag_break THEN BREAK ; ENDIF ; ary_sub_get_idx1stL IS OP ary sub { LOCAL fnd1stSubItmidxAL fndMaxidxL idxUL resFltL shapeSub slicer subFindL subt fit1stSubItmidxAL fitMaxidxL mch1stSubItmidxAL ; % ; resFltL := ary_sub_compatible ary sub ; IF resFltL THEN resFltL := ary_itm_get_idxL ary (first sub) ; ENDIF ; % ; IF (NOT ary_hasFaults resFltL) THEN fnd1stSubItmidxAL := resFltL ; shapeSub := gage shape sub ; fndMaxidxL := fnd1stSubItmidxAL EACHLEFT sum shapeSub ; fitMaxidxL := EACH OR EACH OR list ( ((gage shape ary) EACHRIGHT - fndMaxidxL) EACHLEFT >= 0 ) ; fit1stSubItmidxAL := fitMaxidxL subList fnd1stSubItmidxAL ; % view intermediates : fnd1stSubItmidxAL fndMaxidxL fit1stSubItmidxAL fitMaxidxL ; IF (= null fit1stSubItmidxAL) THEN resFltL := fault '?arySubGetIdx1st1' ; ELSEIF (ary_hasFaults fit1stSubItmidxAL) THEN resFltL := fault '?arySubGetIdx1st2' ; ELSE % find matches ; mch1stSubItmidxAL := null ; FOR idxUL WITH fit1stSubItmidxAL DO idxL := sub_idxUL_to_idxA sub idxUL ; IF (NOT ary_hasFaults idxL) THEN IF (= sub (ary#idxL)) THEN mch1stSubItmidxAL := append mch1stSubItmidxAL idxL ; ENDIF ; ENDIF ; ENDFOR ; resFltL := mch1stSubItmidxAL ; ENDIF ; ENDIF ; % ; resFltL } # ary_sub_get_idxLL IS OP ary sub - posnAL of all "itm-sequences=sub" within in ary, or faultL # sub must be valence >= 1 (not an atom) # remember - won't work with null [sub, ary], isAtm ary # 09Nov2021 initial # 07Dec2021 revamp, do not have to check for isAtm that is done by ary_sub_get_idx1stL # 11Apr2022 used resFltL instead of [faultL, resultL], more compact code # 23Apr2022 this results in double-application of [sub_makeVlcSameAs_ary, ary_sub_compatibleShp]!!?? # ary_sub_get_idxLL 'ary_to_atmL_testSimple' '_test' # tests from ary_chk_sub_get_idxLL_testSimple "lst_atm01 ary_sub_get_idxLL 'the bigg fat cow' [` ] ([3] [8] [12]) 'should be OK, note that [`a] = string `a, and not [but ?spAllia4 returns, I don"t know why' "lst_atm02 ary_sub_get_idxLL (tell 10) [4] [[4]] 'should be OK but ?spAllia4 returns, I don"t know why' "ary_atm01 ary_sub_get_idxLL (4 5 reshape (tell 30)) (1 1 reshape 4) [1 1 reshape [0 4]] 'should be OK, answer looks good but fails (1)' "ary_lst01 ary_sub_get_idxLL (4 5 reshape (tell 30)) (1 4 reshape 5 6 7 8) [1 4 reshape (1 0) (1 1) (1 2) (1 3)] 'should fail, fails as sub spans across axis, [(1 0) (1 1) (1 2) (1 3)] no good' "ary_lst02 ary_sub_get_idxLL (4 5 reshape (tell 30)) (1 2 reshape 4 5) [fault '?arySubFindIdx1st3'] 'should be OK, fails as sub spans across axis' . # ary_sub_get_idx1stL 'ary_to_atmL_testSimple' '_test' # tests adapted from ary_chk_sub_get_idxLL_testSimple "lst_atm01 ary_sub_get_idx1stL 'the bigg fat cow' [` ] (3 8 12) 'should be OK, note that [`a] = string `a, and not [but ?spAllia4 returns, I don"t know why' "lst_atm02 ary_sub_get_idx1stL (tell 10) [4] [4] 'should be OK' "ary_atm01 ary_sub_get_idx1stL (4 5 reshape (tell 30)) (1 1 reshape 4) [1 1 reshape [0 4]] 'should be OK, answer looks good but fails ?arySubFindIdx1st3' "ary_lst01 ary_sub_get_idx1stL (4 5 reshape (tell 30)) (1 4 reshape 5 6 7 8) [1 4 reshape (1 0) (1 1) (1 2) (1 3)] 'should fail, fails as sub spans across axis, [(1 0) (1 1) (1 2) (1 3)] no good' "ary_lst02 ary_sub_get_idx1stL (4 5 reshape (tell 30)) (1 2 reshape 4 5) [fault '?arySubFindIdx1st3'] 'should be OK, fails as sub spans across axis' 08********08 #] 14Nov2022 ary_sub_get_[idx1stL, idxLL] ary_sub_get_idxLL ary_sub_get_idx1stL ary_itm_get_idxL ary_idx_compatible sub_idxUL_to_idxA ary_idx_to_slc qnial> ary_sub_get_idxLL 'ary_to_atmL_testSimple' '_test' ary_sub_get_idx1stL change : +.....+ FOR idxUL WITH fit1stSubItmidxAL DO idxL := sub_idxUL_to_idxA sub idxUL ; slicer := ary_idx_to_slc ary idxL ; subt := execute (link ary '|' slicer) ; IF (ary_hasFaults subt) THEN mch1stSubItmidxAL := fault '?arySubGetIdx1st3' ; ELSE mch1stSubItmidxAL := append mch1stSubItmidxAL idxUL ; ENDIF ; ENDFOR ; +.....+ To : +.....+ FOR idxUL WITH fit1stSubItmidxAL DO idxL := sub_idxUL_to_idxA sub idxUL ; slicer := ary_idx_to_slc ary idxL ; IF (NOT ary_hasFaults slicer) THEN mch1stSubItmidxAL := append mch1stSubItmidxAL slicer ; ENDIF ; ENDFOR ; resFltL := mch1stSubItmidxAL ; +.....+ qnial> ary_sub_get_idx1stL 'ary_to_atmL_testSimple' '_test' +---+---+----+ |[3]|[6]|[11]| +---+---+----+ qnial> ary_sub_get_idxLL 'ary_to_atmL_testSimple' '_test' ?spAllia4 ary_sub_get_idxLL change : +.....+ subVolume := tell (gage shape sub) ; FOR aryPoint WITH aryPointL DO idxA := aryPoint EACHRIGHT + subVolume ; +.....+ To : +.....+ FOR aryPoint WITH aryPointL DO idxA := aryPoint EACHBOTH + (gage shape sub) ; +.....+ NUTS!!! want idxA NOT slices!!! ary_sub_get_idx1stL change : +.....+ FOR idxUL WITH fit1stSubItmidxAL DO idxL := sub_idxUL_to_idxA sub idxUL ; slicer := ary_idx_to_slc ary idxL ; IF (NOT ary_hasFaults slicer) THEN mch1stSubItmidxAL := append mch1stSubItmidxAL slicer ; ENDIF ; ENDFOR ; +.....+ To : +.....+ FOR idxUL WITH fit1stSubItmidxAL DO idxL := sub_idxUL_to_idxA sub idxUL ; IF (NOT ary_hasFaults idxL) THEN mch1stSubItmidxAL := append mch1stSubItmidxAL idxL ; ENDIF ; ENDFOR ; +.....+ qnial> ary_sub_get_idxLL 'ary_to_atmL_testSimple' '_test' +--------------+ |11 12 13 14 15| +--------------+ >> OK! 08********08 #] 08Nov2022 pre-defines should return faults! "$ d_Qndfs"'QNial setup - header.ndf' >> done 08********08 #] 08Nov2022 array tests - problem (as usual) is '?not an operation' +-----+ ary_to_atmL_testSimple - flag_break it tstOptr "ary_to_atmL_testSimple +--+ ary_to_atmL_testSimple ?.. Optrphr := phrase ( ( first first ( ary_sub_get_idxll Testoptrstr '_test' ) ) take Testoptrstr ) -->[nextv] ?left argument in take must be integers -->[nextv] Testoptrstr ary_to_atmL_testSimple -->[nextv] ary_sub_get_idxll Testoptrstr '_test' ?arySubFindIdx1st3 >> crap +-----> qnial> ary_sub_get_idxLL 'the bigg fat cow' [` ] ?.. Slicer := sub_idx_to_slc Sub Idx -->[nextv] idx 3 -->[nextv] +-----> sub_idx_to_slc - wasn't defined in arrays.ndf, must be in'QNial setup header.ndf? sub_idx_to_slc IS OP sub idx { null } >> yupp... arrays.ndf : change sub_idx_to_slc IS OP sub idxLL { idxLL EACHBOTH + (EACH tell (gage shape sub)) } to : sub_idx_to_slc IS OP sub idx { idx EACHRIGHT + ( tell (gage shape sub)) } # 08Nov2022 tests qnial> sub_idx_to_slc (tell 7) 43 43 44 45 46 47 48 49 >> OK, <-----+ qnial> ary_sub_get_idxLL 'the bigg fat cow' [` ] ?.. Slicer := sub_idx_to_slc Sub Idx -->[nextv] idx 3 -->[nextv] resume +-+-+--+ |3|8|12| +-+-+--+ <-----+ tstOptr "ary_to_atmL_testSimple >> all are still '?not an operation' 10Nov2022 continue qnial> ary_to_atmL (2 2 reshape ('not' (2 2 reshape (l (ll) (2 2 reshape l) l)) (2 2 reshape (1 `t `z ['all'])) 'small') ) n o t l l l l l l l l 1 t z a l l s m a l l >> still works, problem is likely tstSimple tstSimple : ary_sub_get_idxLL 'ary_to_atmL_testSimple' '_test' ary_sub_get_idx1stL change : idxL := sub_idxUL_to_idxA sub idxUL ; to : slicer := ary_idx_to_slc ary idxL ; Now for ary_idx_to_slc : qnial> ary_idx_to_slc 'the bigg fat cow' 4 [?address] # 10Nov2022 problem with indexes - should always be a minimum of solitary (valence >= 1)? # 10Nov2022 ary valnce >= 1, so solitaries are legitimate arys? Try again : ary_sub_get_idxLL 'ary_to_atmL_testSimple' '_test' ?arySubGetIdx1st3 >> nyet - must fix ary_idx_to_slc? # 10Nov2022 change ELSEIF (~= aryVlc idxShp) THEN faultL := link faultL (fault '?aryVlcIdxShp') ; to ELSEIF (~= aryVlc idxVlc) THEN faultL := link faultL (fault '?aryIdxVlc') ; #? ?aryVlcIdxShp ary_idx_compatible (~= aryVlc idxShp) Try again : ary_sub_get_idxLL 'ary_to_atmL_testSimple' '_test' 08********08 #] 07Nov2022 ARRAYS_TESTCLUSTER log.txt I forget how to loaddef this - I had already changed 'QNial setup.ndf' to do this... +-----+ ARRAYS_TESTCLUSTER log.txt sARRAYS_TESTCLUSTER start time : 7Nov2022 18h19m08s +--+-------------------------+-------+------+-----+ |OK|test (group) |correct|faults|total| +--+-------------------------+-------+------+-----+ | o|ary_restruct_groupTest | 2| 60| 62| +--+-------------------------+-------+------+-----+ | o|ary_posn_groupTest | 0| 141| 141| +--+-------------------------+-------+------+-----+ | o|ary_slice_groupTest | 0| 184| 184| +--+-------------------------+-------+------+-----+ | o|ary_split_groupTest | 0| 10| 10| +--+-------------------------+-------+------+-----+ | o|ary_hold_groupTest |?A | 7| 13| +--+-------------------------+-------+------+-----+ | o|ary_cut_groupTest | 0| 3| 3| +--+-------------------------+-------+------+-----+ | o|ary_sort_groupTest | 0| 5| 5| +--+-------------------------+-------+------+-----+ | o|ary_cullOption_groupTest | 0| 3| 3| +--+-------------------------+-------+------+-----+ | o|ary_database_groupTest |?A |?A |?A | +--+-------------------------+-------+------+-----+ | o|ary_transformer_groupTest| 0| 14| 14| +--+-------------------------+-------+------+-----+ finish time : 7Nov2022 18h19m16s >> absolutely noithing worked! +-----+ ary_restruct_groupTest start time : 7Nov2022 18h19m08s +--+---------------------------------------+-------+------+-----+ |OK|test (optr) |correct|faults|total| +--+---------------------------------------+-------+------+-----+ | l|aryA_catVertical_testSpecial | 1| 0| 1| +--+---------------------------------------+-------+------+-----+ | l|aryA_catHorizontal_testSpecial | 1| 0| 1| +--+---------------------------------------+-------+------+-----+ | o|ary_to_atmL_testSimple | 0| 10| 10| +--+---------------------------------------+-------+------+-----+ | o|ary_atm_replaceAllAtm_aryOut_testSimple| 0| 15| 15| +--+---------------------------------------+-------+------+-----+ | o|aryP_transStr_isSameStruct_testSimple | 0| 15| 15| +--+---------------------------------------+-------+------+-----+ | o|ary_allAtmsUnique_bol_testSimple | 0| 10| 10| +--+---------------------------------------+-------+------+-----+ | o|ary_allItmsUnique_bol_testSimple | 0| 10| 10| +--+---------------------------------------+-------+------+-----+ +-+----------------------------+-+-+-+ |l|aryA_catVertical_testSpecial|1|0|1| +-+----------------------------+-+-+-+ 08********08 #] 07Nov2022 where am I after break-start 19Sep2022? +-----+ loaddefs : $ qnial +--+ ?tokens left: TITLL @ KEYAXI <***> ARY_ITM_GET_IDXL KEYTIT ) <<< loading ended : types.ndf errors found: 1 >> used as example in "$d_Qroot""help - [develop, debug, error list, etc]/0_QNial error list.txt" "$d_Qndfs" 'QNial setup - header.ndf' added pre-define : ary_itm_get_idxL IS OP ary itm { null } >> problem solved!!! +--+ ?undefined identifier: MONTH := MONTH_NAME <***> MONTH ; LINK ?undefined identifier: MONTH := MONTH_NAME <***> MM ; LINK ?undefined identifier: MONTH := MONTH_NAME <***> MM ; LINK <<< loading ended : strings.ndf errors found: 3 strings.ndf mmddyyyyStr_chrSepP_to_ddmmmyyyyStr IS OP mmddyyyy chrSep - res ipsa loquitor month_name optr defined oops - conflict in variable role as [variable, optr] month_name IS OP monthNumStr - given 2-digit month number as text, returns 3 letter month name month_number IS OP month_name - given 3 letter month name , returns month's 2-digit number rename : number_monthTo_name IS OP monthNumStr - given 2-digit month number as text, returns 3 letter month name name_monthTo_number IS OP month_name - given 3 letter month name , returns month's 2-digit number [bye, qnial] restart (probably tons of failures where used!) : +--+ ?undefined identifier: MONTH := NUMBER_MONTHTO_NAME <***> MONTH ; LINK ?undefined identifier: MONTH := NUMBER_MONTHTO_NAME <***> MM ; LINK ?undefined identifier: MONTH := NUMBER_MONTHTO_NAME <***> MM ; LINK <<< loading ended : strings.ndf errors found: 3 ?undefined identifier: % ; <<< loading ended : Puetz detrended specs.ndf >> this is new... +--+ >> not so bad oops - already defined : [mmmStr_to_monthNum, monthNum_to_mmmStr] RENAMED to : nnInt_monthTo_mmmStr IS OP nnInt - given month number, returns 3 letter month name nnStr_monthTo_mmmStr IS OP nnStr - given 2-digit month number as text, returns 3 letter month name mmmStr_monthTo_nnStr IS OP mmmStr - 3 letter month name changeTo month's 2-digit number >> OK, loaddefs now +--+ ?undefined identifier: % ; <<< loading ended : Puetz detrended specs.ndf errors found: 1 >> ignore this one for now... 08********08 #] 19?Sep2022 ary_itm_find_idxL - while working on d_Qndfs 'bank statements reformat.ndf' qnial> ary_itm_find_idxL ('01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12') '01' qnial> '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' +--+--+--+--+--+--+--+--+--+--+--+--+ |01|02|03|04|05|06|07|08|09|10|11|12| +--+--+--+--+--+--+--+--+--+--+--+--+ qnial> ary_itm_find_idxL ('Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec' ) 'Jul' qnial> ary_itm_find_idxL (tell 10) 5 IDIOT! ary_itm_find_idxL doesn't exist anymore -> ary_itm_get_idxL +-----+ olde code 08********08 #] 19Sep2022 ary_sub_get_[idxLL, slcL] - continue fixes [brokenup slc, singleton] ary_sub_get_idxLL IS OP ary sub { LOCAL aryPoint aryPointL idxA resFltL subt subVolume ; % ; resFltL := ary_sub_get_idx1stL ary sub ; IF (NOT ary_hasFaults resFltL) THEN aryPointL := resFltL ; resFltL := null ; subVolume := tell (gage shape sub) ; FOR aryPoint WITH aryPointL DO idxA := aryPoint EACHRIGHT + subVolume ; subt := idxA choose ary ; IF (= sub subt) THEN resFltL := link resFltL [idxA] ; ENDIF ; ENDFOR ; ENDIF ; % ; IF (= null resFltL) THEN fault '?spAllia4' ELSE resFltL ENDIF } qnial> EACH ary_sub_get_idx1stL ('the bigg fat cow' [`w]) ('the bigg fat cow' [`g]) (('[6]' '[7]') 'should be OK') ('the bigg fat cow' ' ') ((tell 10) [4]) ((tell 10) (0 6)) ((tell 10) (3 4 5)) ((tell 10) (3 4 5)) (((tell 10) (tell 10) 4 5) 1) (((tell 10) (tell 10) 4 5) [4 5]) +--+---+------------+------+-+-+-+-+------------+-----------------+ |15|6 7|?arySubComp2|3 8 12|4|0|3|3|?arySubComp1|?aryItmFindIdxL01| +--+---+------------+------+-+-+-+-+------------+-----------------+ >> OK qnial> ary_sub_get_idxLL 'the bigg fat cow' [`w] +--+ |15| +--+ >> OK qnial> ary_sub_get_idxLL 'the bigg fat cow' [`g] +-+-+ |6|7| +-+-+ >> OK qnial> ary_sub_get_idxLL (tell 10) (3 4 5) +-----+ |3 4 5| +-----+ >> OK qnial> ary_sub_get_idxLL ((tell 10) (tell 10) 4 5) (4 5) +---+ |2 3| +---+ >> OK qnial> EACH ary_sub_get_idxLL ('the bigg fat cow' [`w]) ('the bigg fat cow' [`g]) ((tell 10) (3 4 5)) ((tell 10) (3 4 5)) (((tell 10) 4 5) (4 5)) +----+-----+-------+-------+-----+ |+--+|+-+-+|+-----+|+-----+|+---+| ||15|||6|7|||3 4 5|||3 4 5|||1 2|| |+--+|+-+-+|+-----+|+-----+|+---+| +----+-----+-------+-------+-----+ >> confirmation qnial> EACH ary_sub_get_slcL ('the bigg fat cow' [`w]) ('the bigg fat cow' [`g]) ((tell 10) (3 4 5)) ((tell 10) (3 4 5)) (((tell 10) 4 5) (4 5)) +--------+-------------+---------------+---------------+-----------+ |+------+|+-----+-----+|+-------------+|+-------------+|+---------+| ||+----+|||+---+|+---+|||+---+---+---+|||+---+---+---+|||+---+---+|| |||[15]|||||[6]|||[7]|||||[3]|[4]|[5]|||||[3]|[4]|[5]|||||[1]|[2]||| ||+----+|||+---+|+---+|||+---+---+---+|||+---+---+---+|||+---+---+|| |+------+|+-----+-----+|+-------------+|+-------------+|+---------+| +--------+-------------+---------------+---------------+-----------+ >> WRONG!! split-up slcs qnial> EACH EACH ary_sub_get_slcL ('the bigg fat cow' [`w]) ('the bigg fat cow' [`g]) ((tell 10) (3 4 5)) ((tell 10) (3 4 5)) (((tell 10) 4 5) (4 5)) +---------------------------+---------------------------+---------------------------+------------------------- |?op_parameter ?op_parameter|?op_parameter ?op_parameter|?op_parameter ?op_parameter|?op_parameter ?op_paramet | | | | | | | | +---------------------------+---------------------------+---------------------------+------------------------- --+------------------------------+ er|+-------------+--------------+| ||?op_parameter|?aryAdrCompAtm|| |+-------------+--------------+| --+------------------------------+ >> No good qnial> ary_sub_get_slcL 'the bigg fat cow' [`w] +------+ |+----+| ||[15]|| |+----+| +------+ >> too much nesting! ary_idxA_to_slc qnial> EACH ary_idxA_to_slc ('the bigg fat cow' 15) ('the bigg fat cow' ([6] [7])) ((tell 10) [3 4 5]) ((tell 10) (3 4 5)) (((tell 10) 4 5) [4 5]) +------+---------+-----+-------------+-----+ |o----+|+---+---+|+---+|+---+---+---+|+---+| ||[15]|||[6]|[7]|||[3]|||[3]|[4]|[5]|||[4]|| |+----+|+---+---+|+---+|+---+---+---+|+---+| +------+---------+-----+-------------+-----+ >> bad - solitary, split-up slcs qnial> ary_idxA_to_slc 'the bigg fat cow' [15] +----+ |[15]| +----+ I revamped ary_idx_to_slc # 19Sep2022 revamped, removed faults (use ary_chk_idx_apply_optrPhr), no null idx@axi qnial> tstOptr "ary_chk_idx_to_slc_testSimple l ary_chk_idx_to_slc_testSimple 27 24 27 >> all OK revamped ary_idxA_to_slc -> ary_idxSeq_to_slc # 19Sep2022 idxSeq isn't just an idxA, must have adjacent idx!! +-----+ olde code ary_idx_to_slc IS OP ary idx { LOCAL axis faultL slc ; % ; faultL := null ; IF (OR (= null idx) (isAtm idx)) THEN slc := string idx ; slc := link '[' slc ']' ; ELSE slc := (valence ary) reshape [null] ; FOR axis WITH (tell valence ary) DO IF (= null idx@axis) THEN slc@axis := ' ' ; ELSE slc@axis := link (' ' EACHRIGHT link [string idx@axis]) ; ENDIF ; ENDFOR ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; ENDIF ; % ; IF (= null faultL) THEN slc ELSE faultL ENDIF } IF flag_debug THEN write 'loading ary_idx_get_slc' ; ENDIF ; # ary_idx_get_slc IS OP ary idx - get aryVal slices (hyperplanes) through idx in ary # slcLL = list of all slcL, one slcL for every occurrence of itm in ary, 2^aryVal slc in each slcL # allows subsequent find of sub at point idx, along "free" axis of ary # use ary_chk_idx_apply_optrPhr to check compatibility of [ary, idx]!! ; # 28Apr2022 initial (I'm mixed up) based on ary_itm_get_slcLL # 02-03May2022 major revamp, corrected slice lists # 23Jun2022 revamp without Shp args # 29Jun2022 proper slc string returns, more than one possible # IF flag_break THEN BREAK ; ENDIF ; ary_idx_get_slc IS OP ary idx { LOCAL aryShp axs idxTmp resFltL ; resFltL := null ; IF (isAtm idx) THEN resFltL := ary_idx_to_slc ary idx ; ELSE FOR axs WITH (tell (gage shape idx)) DO idxTmp := idx ; % 19Sep2022 what was this for? : idxTmp@axs := null ; resFltL := link resFltL [idxTmp] ; ENDFOR ; resFltL := ary EACHRIGHT ary_idx_to_slc resFltL ; ENDIF ; resFltL } # fault codes (can't have apos! use quotes) : #? ?aigs1 ary_idx_get_slc - 03May2022 none specified yet IF flag_debug THEN write 'loading ary_idxLL_make_slc' ; ENDIF ; # ary_idxLL_make_slc IS OP ary idxLL - builds slice string based on idxLL # selects axiIdxs based on those # idxLL MUST have all axis! use nulls as necessary # 08Sep2022 initial ary_idxLL_make_slc IS OP ary idxLL { LOCAL i j slc ; IF (~= (valence ary) (gage shape idxLL)) THEN fault '?aims' ELSE slc := '[' ; FOR i WITH (valence ary) DO FOR j WITH (gage shape idxLL@i) DO slc := link slc (string j) ' ' ; ENDFOR ; slc := link slc ', ' ; ENDFOR ; (2 dropright slc) link ']' ENDIF } # fault codes (can't have apos! use quotes) : #? ?aims ary_idxLL_make_slc (~= (valence ary) (gage shape idxLL)) ary_idx_to_slc IS OP ary idx { LOCAL axis faultL slc ; % ; faultL := null ; slc := (valence ary) reshape [null] ; FOR axis WITH (tell valence ary) DO IF (= null idx@axis) THEN slc@axis := ' ' ; ELSE slc@axis := link (' ' EACHRIGHT link [string idx@axis]) ; ENDIF ; ENDFOR ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; % ; IF (= null faultL) THEN slc ELSE faultL ENDIF } 08********08 #] 17Sep2022 ary_chk_sub_get_slcLL_testSimple - tame the dragon # 17Sep2022 removed sub_makeVlcSameAs_ary -> made separate chk ary_chk_sub_apply_optrPhr IS OP ary sub optrPhr { LOCAL ary resFltL subr ; resFltL := ary_sub_compatible ary sub ; % true if compatible, fault if not ; IF resFltL THEN resFltL := apply optrPhr (ary subr) ; ENDIF ; resFltL } qnial> ary_sub_compatible 'the bigg fat cow' [`w] l >> so this should work, but ary_chk_sub_get_slcLL gives ?arySubComp1 ?? qnial> ary_sub_get_slcLL 'the bigg fat cow' [`w] ?op_parameter ?op_parameter qnial> ary_sub_find_idx1stL 'the bigg fat cow' [`w] 15 >> this works, so why not ary_sub_get_slcLL? >> oops change resFltL := EACH ary_idxA_to_slc ary subPosnA ; to : resFltL := ary EACHRIGHT ary_idxA_to_slc subPosnA ; qnial> ary_sub_get_slcLL 'the bigg fat cow' [`w] +------+ |o----+| ||[15]|| |+----+| +------+ >> problematic solitary qnial> 'the bigg fat cow' EACHRIGHT ary_idxA_to_slc 15 o------+ |o----+| ||[15]|| |+----+| +------+ >>> double ouch qnial> 'the bigg fat cow' EACHRIGHT ary_idxA_to_slc [15] +------+ |o----+| ||[15]|| |+----+| +------+ qnial> ary_idxA_to_slc 'the bigg fat cow' [15] +----+ |[15]| +----+ >> OK, However it looks like this optr REQUIRES slc-suitable indxA? >> That IS suited to ary_chk_sub_get_slcLL Clean up optr names in 'arrays.ndf' and "$d_Qtest"'arrays/arrays- testOptrs.ndf' : change : _find_idx to : _get_idx >> note that this breaks with standard QNial language "find", affects a huge number of optrs! arrays.ndf ~40 changes 'arrays- testOptrs.ndf' 36 changes 'arrays- testGroupsCluster.ndf' 6 changes move all these optrs from : find idx(LL) of [atm, itm, sub]s in aryTop (positions) : into : [idx, itm, slc, sub] optrs - (slc = slice hyper-planes) typically returns a LIST : ary_chk_sub_get_idx1stL_testStd >> mostly ?arySubComp1 "lst_lst01 'the bigg fat cow' 'g' qnial> ary_sub_get_idx1stL 'the bigg fat cow' 'g' 6 7 >> works great, so why does ary_chk_sub_get_idx1stL_testStd fail? tstStandard in "$d_Qtest"'QNial test optrs.ndf' ary_sub_get_idxLL -> ary_sub_get_idx1stL >> testor & testee are the same... qnial> EACH ary_sub_get_idx1stL ('the bigg fat cow' ' ') ('the bigg fat cow' ' b') ('the bigg fat cow' 'g ') ('the bigg fat cow' 'bigg ') ('the bigg fat cowbig bigg' 'bigg') ('what goes around comes around' 'around') ((tell 10) (4 5)) ('[#=; backtrack ;=#] Mega-Life' '[#=; backtrack ;=#]') +------+------+---+-+-------+-------+-+-+ |3 8 12|3 8 12|6 7|4|4 16 20|2 10 23|4|0| +------+------+---+-+-------+-------+-+-+ >> poifect!! >> it seems that tstStandard optr not working (no shit) put a flag_break into it ?.. Calcl := Optrphr EACHRIGHT apply ( rows transpose mix Datcols ) -->[nextv] +---------------+---------------+---------------+--------------+--------------+--------------+------------+--- |?aryAdrCompNull|?aryAdrCompNull|?aryAdrCompNull|?aryAdrCompAtm|?aryAdrCompAtm|?aryAdrCompAtm|?arySubComp1|?ar +---------------+---------------+---------------+--------------+--------------+--------------+------------+--- ~:~ ---------+------------+------------+------------+------------+------------+------------+------------+--------- ySubComp1|?arySubComp1|?arySubComp1|?arySubComp1|?arySubComp1|?arySubComp1|?arySubComp1|?arySubComp1|?arySubCo ---------+------------+------------+------------+------------+------------+------------+------------+--------- ~:~ ---+------------+------------+------------+------------+------------+------------+------------+------------+-- mp1|?arySubComp1|?arySubComp1|?arySubComp2|?arySubComp1|?arySubComp1|?arySubComp1|?arySubComp1|?arySubComp1|?a ---+------------+------------+------------+------------+------------+------------+------------+------------+-- ~:~ ----------+------------+------------+ rySubComp1|?arySubComp1|?arySubComp1| ----------+------------+------------+ >> ouch, what is the problem here? Changed : ary_chk_sub_apply_optrPhr IS OP ary sub optrPhr { LOCAL ary resFltL subr ; resFltL := ary_sub_compatible ary sub ; % true if compatible, fault if not ; IF resFltL THEN resFltL := apply optrPhr (ary subr) ; ENDIF ; resFltL To : ary_chk_sub_apply_optrPhr IS OP ary sub optrPhr { LOCAL resFltL ; resFltL := ary_sub_compatible ary sub ; % true if compatible, fault if not ; IF resFltL THEN resFltL := apply optrPhr (ary sub) ; ENDIF ; resFltL } >> that did it! >> problem with gage shape result ary_chk_sub_get_slcLL_testSimple -> should be ary_chk_sub_get_slcL ary_sub_get_idxLL IS OP ary sub qnial> EACH ary_chk_sub_get_slcL ('the bigg fat cow' [`w]) ('the bigg fat cow' [`g]) (('[6]' '[7]') 'should be OK') ('the bigg fat cow' ' ') ((tell 10) [4]) ((tell 10) (0 6)) ((tell 10) (3 4 5)) ((tell 10) (3 4 5)) (((tell 10) (tell 10) 4 5) 1) (((tell 10) (tell 10) 4 5) [4 5]) +--------+-------------+------------+--------------------+-------+-------+-------+------------+--------------- |+------+|+-----+-----+|?arySubComp2|+-----+-----+------+|+-----+|+-----+|+-----+|?arySubComp1|?aryItmFindIdxL ||o----+|||o---+|o---+|| ||o---+|o---+|o----+|||o---+|||o---+|||o---+|| | |||[15]|||||[6]|||[7]||| |||[3]|||[8]|||[12]|||||[4]|||||[0]|||||[3]||| | ||+----+|||+---+|+---+|| ||+---+|+---+|+----+|||+---+|||+---+|||+---+|| | |+------+|+-----+-----+| |+-----+-----+------+|+-----+|+-----+|+-----+| | +--------+-------------+------------+--------------------+-------+-------+-------+------------+--------------- ~:~ --+ 01| | | | | --+ qnial> EACH ary_sub_get_slcL ('the bigg fat cow' [`w]) ('the bigg fat cow' [`g]) (('[6]' '[7]') 'should be OK') ('the bigg fat cow' ' ') ((tell 10) [4]) ((tell 10) (0 6)) ((tell 10) (3 4 5)) ((tell 10) (3 4 5)) (((tell 10) (tell 10) 4 5) 1) (((tell 10) (tell 10) 4 5) [4 5]) +--------+-------------+------------+--------------------+-------+---------+---------------+---------------+-- |+------+|+-----+-----+|?arySubComp2|+-----+-----+------+|+-----+|?spAllia4|+-------------+|+-------------+|?a ||+----+|||+---+|+---+|| ||+---+|+---+|+----+|||+---+|| ||+---+---+---+|||+---+---+---+|| |||[15]|||||[6]|||[7]||| |||[3]|||[8]|||[12]|||||[4]||| |||[3]|[4]|[5]|||||[3]|[4]|[5]||| ||+----+|||+---+|+---+|| ||+---+|+---+|+----+|||+---+|| ||+---+---+---+|||+---+---+---+|| |+------+|+-----+-----+| |+-----+-----+------+|+-----+| |+-------------+|+-------------+| +--------+-------------+------------+--------------------+-------+---------+---------------+---------------+-- ~:~ ----------+-----------------+ rySubComp1|?aryItmFindIdxL01| | | | | | | | | ----------+-----------------+ >> too much nesting I am missing tests for : ary_sub_get_idx1stL IS OP ary sub - idxA of 1st item of sub in TOP level of ary ary_sub_get_idxLL IS OP ary sub - posnAL of all "itm-sequences=sub" within in ary, or faultL +-----+ olde code useless? given table optrs IF flag_debug THEN write 'loading ary_axi_titL_getSlc' ; ENDIF ; # ary_axi_titL_getSlc IS OP ary axi titL - all Axs-indexes containing title # axsTitles must all be UNIQUE! Use temporary global variable aryPhrGbl BEFORE calling # 19Nov2021 initial, 22Nov2021 unfinished! ary_axi_titL_getSlc IS OP ary axi titL { LOCAL ary resFltL ; NONLOCAL aryPhrGbl ; ary := execute string aryPhrGbl ; titlePosnL := titL EACHLEFT EACHRIGHT find axi ; axsTitles := null } 08********08 #] 14Sep2022 ary optrs - fix based on testing results ary_allItmsUnique_bol IS OP ary ary_to_atmL - qnial> a := (3 3 reshape (tell 10)) 0 1 2 3 4 5 6 7 8 qnial> atmL := ary_to_atmL a 0 1 2 3 4 5 6 7 8 >> WRONG! strange, as other tests are OK, add a simple intAry to test 15Sep2022 ary_chk_sub_find_idxLL_testStd problem with (gage shape results)?? ary_chk_subL_find_idxLLL_testSimple >> delete this optr! useless - simple EACHRIGHT with ary_chk_sub_find_idxLL ary_chk_itm_find_idxL_testStd >> fault names all changed now +-----+ ary_slice_groupTest start time : 15Sep2022 14h22m23s +--+------------------------------------------------------------------+-------+------+-----+ |OK|test (optr) |correct|faults|total| +--+------------------------------------------------------------------+-------+------+-----+ | o|?ary_chk_compatible_idx_testSimple error : unknown tstTypPhr | 0| 1| 1| all OK now +--+------------------------------------------------------------------+-------+------+-----+ | o|?ary_chk_compatible_slc_testSimple error : unknown tstTypPhr | 0| 1| 1| ary12_slc - error +--+------------------------------------------------------------------+-------+------+-----+ | o|ary_chk_idx_to_slc_testSimple | 8| 24| 27| OK all good +--+------------------------------------------------------------------+-------+------+-----+ | o|ary_chk_idxA_to_slc_testSimple | 12| 29| 27| OK all good +--+------------------------------------------------------------------+-------+------+-----+ | o|ary_chk_slc_to_idxA_testSimple | 10| 20| 25| OK all good +--+------------------------------------------------------------------+-------+------+-----+ | o|ary_chk_idx_get_slcLL_testSimple | 12| 20| 26| OK all good +--+------------------------------------------------------------------+-------+------+-----+ | o|ary_chk_itm_get_slcLL_testSimple | 5| 25| 25| Redo, allFlts +--+------------------------------------------------------------------+-------+------+-----+ | o|?ary_chk_itm_get_slcLL_to_itm_testSimple error : unknown tstTypPhr| 0| 1| 1| Redo, allFlts +--+------------------------------------------------------------------+-------+------+-----+ | o|ary_chk_sub_get_slcLL_testSimple | 5| 30| 25| botch.. +--+------------------------------------------------------------------+-------+------+-----+ # 15Sep2022 quick tests ary_chk_sub_get_slcLL_testSimple "lst02_atm 'the bigg fat cow' `w ['[15]'] 'should be OK, note that result is ["[15]"], confusing not obvious' # ary_sub_get_slcLL 'the bigg fat cow' `w qnial> ary_sub_get_slcLL 'the bigg fat cow' (1 1 reshape `w) ?arySubComp1 >> valence! (oops - I forgot) # "lst02a_atm 'the bigg fat cow' [`w] ['[15]'] 'should be OK, note that result is ["[15]"], confusing not obvious' qnial> ary_sub_get_slcLL 'the bigg fat cow' [`w] ?op_parameter ?op_parameter >> What?? +-----+ olde code - don't [need, want] ary_subL_find_idxLLL IF flag_debug THEN write 'loading ary_subL_find_idxLLL' ; ENDIF ; ary_subL_find_idxLLL IS OP ary subL - simply an EACHRIGHT of ary_sub_find_idxLL 05Dec2021 results take shape of input subs - is this what I really want? # 09Nov2021 initial ary_subL_find_idxLLL IS OP ary subL { ary EACHRIGHT ary_sub_find_idxLL subL } # loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' IF flag_debug THEN write 'loading ary_chk_subL_find_idxLLL' ; ENDIF ; ary_chk_subL_find_idxLLL IS OP ary subL - res ipsa loquitor # 24Apr2022 initial # 15Sep2022 removed auto-shaping of subs - must pre-shape to be compatible with ary # IF flag_break THEN BREAK ; ENDIF ; ary_chk_subL_find_idxLLL IS OP ary subL { LOCAL resFltL subr ; IF flag_break THEN BREAK ; ENDIF ; resFltL := ary EACHRIGHT ary_sub_compatible subL ; IF (ary_hasFaults resFltL) THEN resFltL ELSE ary EACHRIGHT ary_sub_find_idxLL subL ENDIF } # tests # ary_chk_sub_find_idxLL `g `g # ary_chk_sub_find_idxLL (tell 10) (4 5) # ary_chk_sub_find_idxLL 'the bigg fat cow' [`g] # ary_chk_sub_find_idxLL 'the bigg fat cow' (' ' ' b') # ary_chk_sub_find_idxLL 'the bigg fat cow' ([' '] [' b']) # olde code, don't preshape each subL? % subrL := subL EACHLEFT sub_makeVlcSameAs_ary ary ; # loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' IF flag_debug THEN write 'loading ary_chk_subL_find_idxLLL_testSimple' ; ENDIF ; ary_chk_subL_find_idxLLL_testSimple := - returns list of Substr positions in Str, or an error # 05Dec2021 initial # 05Dec2021 results take shape of input subs - is this what I really want? # 11Apr2022 what a mess - structure of results # tstOptr "ary_chk_subL_find_idxLLL_testSimple ary_chk_subL_find_idxLLL_testSimple := "tstSimple 2 "d_arrayTests ( "atm_atm01 `g `g (solitary (fault '?aryAdrCompAtm')) 'comment?' "atm_atm02 4 4 (solitary (fault '?aryAdrCompAtm')) 'comment?' "lst_atm01 'the bigg fat cow' ` (3 8 12) 'comment?' "lst_atm02 (tell 10) 4 [4] 'comment?' "lst_lst01 'the bigg fat cow' [`g] (3 8 12) 'note that [`g] = "g"' "lst_lst02 (tell 10) (4 5) (EACH fault '?arySubComp1' '?arySubComp1') 'comment?' "lst_lst03 (tell 10) [4 5] (EACH fault '?arySubComp1' '?arySubComp1') 'comment?' "lst_lstL01 'the bigg fat cow' (' ' ' b') (([3] [8] [12]) [3 4]) 'comment?' "lst_lstL02 'the bigg fat cow' ['g '] [[7 8]] 'comment?' "lst_lstL03 'the bigg fat cow' ('g ' ' ') ([7 8] ([3] [8] [12])) 'comment?' "lst_lstL04 'the bigg fat cow' ('bigg ' 't') ((4 5 6 7 8) ([0] [11])) 'comment?' "lst_lstL05 'what goes around comes around' ['around'] [(10 + tell 6) (23 + tell 6)] 'comments?' "lst_lstL06 (tell 10) [4 5] (4 5) 'comment?' "lst_lstL07 '[#=; backtrack ;= Howell - Mega-Life' ('[#=; ' ' ;= ') ([0 1 2 3 4] [14 15 16 17 18]) 'comments?' "lstL_lstL01 (link (tell 10) (tell 10)) (4 5) ((4 5) (14 15)) 'comments?' ) ; # loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' IF flag_debug THEN write 'loading ary_chk_subL_find_idxLLL_testStd' ; ENDIF ; ary_chk_subL_find_idxLLL_testStd := - returns list of Substr positions in Str, or an error # 05Dec2021 initial # 05Dec2021 results take shape of input subs - is this what I really want? # 11Apr2022 what a mess - structure of results # tstOptr "ary_chk_subL_find_idxLLL_testStd ary_chk_subL_find_idxLLL_testStd := "tstStandard "d_arrayTests "aryTstDat_tbl ( "null_null01 (EACH fault '?aryNull' '?aryAtm') 'not defined for null = [sub, ary]' "null_atm01 [fault '?aryAtm'] 'not defined for null = sub' "null_lst01 [fault '?aryAtm'] 'not defined for null = sub' "atm_null01 (EACH fault '?aryNull' '?sca3' '?sca4') 'not defined for [null = sub, isAtm ary]' "atm_atm01 [fault '?sca3'] 'not defined for isAtm ary' "atm_atm02 [fault '?sca3'] 'not defined for isAtm ary' "lst_null01 [fault '?aryNull'] 'not defined for null = sub' "lst_atm01 (3 8 12) 'comment?' "lst_atm02 [4] 'comment?' "lst_lst01 (6 7) 'comment?' "lst_lst02 (3 8 12) 'comment?' "lst_lst03 [3] 'comment?' "lst_lst04 [7] 'comment?' "lst_lst05 [4] 'comment?' "lst_lst06 (4 20) 'comment?' "lst_lst07 (10 23) 'comments?' "lst_lst08 [4] 'comments?' "lst_lst09 [0] 'comments?' "lst_lst10 [fault '?sca5'] '(OR ((gage shape sub) > (gage shape ary)))' "lstL_lst01 [2] 'OK - note doesn"t find sub in subAry of ary, only at top level' "lst_lstL01 [fault '?sp1a1'] 'fails - not found because the ary is"t a list of such subs' "lst_lstL02 [fault '?sp1a1'] 'fails - not found because the ary is NOT a list of solitary numbers' "lstL_lstL01 (4 14 20) 'the link produced a single list of numbers, with 3 fits' "ary_atm01 [0 4] 'comment?' "ary_lst01 [1 0] 'comment?' "ary_lst02 [fault '?sp1a4'] 'won"t work : lst spans across axis' "ary_ary01 [0 1] 'comment?' ) ; ary_chk_idx_compatible IS OP ary idx { ary_idx_compatible ary idx } # 24Jun2022 older version was self-referrent? : # loaddefs link d_Qndfs 'types.ndf' IF flag_debug THEN write 'loading ary_chk_slc_to_idxA_apply_optrPhr' ; ENDIF ; # ary_chk_slc_to_idxA_apply_optrPhr IS OP ary slc optrPhr - checks args with argOrder (ary slc) # 06May2022 initial, 23Jun2022 revamp without Shp args # 15Sep2022 NO GOOD?!?!? - see ary_chk_slc_apply_optrPhr instead ary_chk_slc_to_idxA_apply_optrPhr IS OP ary slc optrPhr { LOCAL resFltL ; resFltL := ary_slc_compatible ary slc ; % true if compatible, fault if not ; IF resFltL THEN resFltL := apply optrPhr (ary slc) ; ENDIF ; resFltL } 08********08 #] 14Jul2022 "$d_bin""fileops.sh" - HowellQNialLibrary [globalVar, optr] names # global variables reduce chances of mixups and cross-over between different [project, fbase] # They are set differently : # for each project : [d_libWork, pLStrUse, pSrcPthVarL] # for each fbase : [libFbase, d_fbase, d_libData, p_libStrPL, d_SrcChk] # NOTE! : SrcPthVarL are given as vars, eg : "$d_Qndfs"'arrays.ndf' # 'eval' to get fullPths : /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/arrays.ndf #This must be retained, as it is used in '7_HowellCoreLib list.txt' d_symbols="$d_Qndfs"'QNial [symbol, arg] changes/' d_libWork="$d_symbols' pLibSrcPthVarL="$d_libWork"'pSrcPthVarL.txt' # pLibSrcPthVarL="$d_libWork"'pSrcPthVarL 1 ndf only.txt' # NOTE! : SrcPthVarL are given as vars, eg : "$d_Qndfs"'arrays.ndf' # 'eval' to get fullPths : /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/arrays.ndf # the pre-assignment of libFbase should help to avoid [error, confusion] # as each fbase should be worked on separately libFbase='arrays' libFxtn='.ndf' d_libFbase="$d_libWork$libFbase/" d_libData="$d_libFbase"'pthLData/' pLibStrPL="$d_libData"'pStrPL replacements.txt' # process all strL # pLibStrPL="$d_libData"'pStrPL replacements one str only.txt' # process one str only pLibStrUseL="$d_libData"'StrUseL.txt' d_libSrcChk="$d_fbase"'pthLSrcChk/' # pLibSrcChk calculated iteratively by pSrcPthVarL_pStrUseL_appendTo_pLSrcChk : # pSrcChk476="$d_SrcChk$fSrc476"' argOrderNum toCheck.txt' # this is an arg for pStrUse_fSrc_appendTo_pSrcChk d_libStrUseRaw="$d_libFbase"'raw/' +---+ olde code : pLStrUse="$d_libWork"'pStrUsePthL.txt' ???????????????????? # be careful of difference : # pStrUseL="$d_libData"'StrUseL.txt' # pLStrUse="$d_libWork"'pStrUsePthL.txt' <- this is a mismatch of naming!!!! something WG - very short list. Is it even used? 08********08 #] 11Jul2022 "$d_bin""fileops.sh" - collect all arg[Order, Number] for each HowelCoreLib 08********08 #] 08Jul2022 "$d_bin""fileops.sh" - create func for arg[Order, Number] +---+ 10Jul2022 Now pthOptrNamL_pthNdfL_argOrderNum is working very well - hellish number of argOrder changes to make! Cull all hits for each ndf file? optr usage file size is a decent indicator of actual hits get rid of " IS OP " greps and things will be very clean! >> went from 78 files to 49! roughly 200+ byte fileSize indicates files to check? instructions : see "$d_bin""fileops.sh" arrays.ndf -> optr usage files to use to fix ndf files (now only 14 ndfs out of original 78!!): 455 aryA_catVertical usage.txt OK 1764 ary_itm_cut_subL usage.txt 753 ary_itm_find_idxL usage.txt 1763 ary_itmL_option_cull_aryOut usage.txt 1733 ary_itm_option_cull_aryOut usage.txt 755 ary_slc_length_prepad_aryOut usage.txt 278 ary_slc_splitSeparate_subL usage.txt 704 ary_sub_find_idx1stL usage.txt 451 ary_sub_find_idxLL usage.txt 394 ary_subL_splitAtFront_subL usage.txt 1341 ary_subP_replace_aryOut usage.txt 549 ary_sub_splitAtEnd_subL usage.txt 760 ary_sub_splitAtFront_subL usage.txt 789 ary_sub_splitSeparate_subL usage.txt +-----+ olde code # junk # grep "$optrNam" "$pth" | grep --invert-match '^#\|^ ' >>"$d_Qtest"'optr usage/'"$optrNam"' usage.txt' # # pth_optrNam_getArgOrderNum_dout() #{ # optrNam="$1" # pthLibL="$2" # while read -u 9 line; do # dopt=$( echo "$line" | sed 's|^\(.*\) :1: \(.*\)|\1|' ) # fopt=$( echo "$line" | sed 's| :1: \(.*\) :2: \(.*\)|\1|' ) # dout=$( echo "$line" | sed 's| :2: \(.*\) :3: \(.*\)|\1|' ) # dsub=$( echo "$line" | sed 's| :3: \(.*\) |\1|' ) # pthOptrOut="$dout$dsub" # grep "$optrNam" "$pth" >>"$dout$dsub$optrNam"' usage.txt' # done 9< "$pthLibL" #} # pthOptrNamL_pthLibL_argOrderNum() # { # pthOptrNamL="$1" # pthLibL="$2" # while read -u 9 optrNam; do # find "$d_Qroot" -type f -name "*.ndf" | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number "$optrNam" "FILE" | sed "s|$d_Qroot||;s|:.*||" >"$d_Qtest"'optr usage/'"$optrNam usage.txt" # done 8< "$pthOptrNamL" # } # # pthOptrNamL_pthLibL_argOrderNum() # { # pthOptrNamL="$1" # pthLibL="$2" # while read -u 9 optrNam; do # dinn=$( echo "$line" | sed 's|^\(.*\) :1: |\1|' ) # finn=$( echo "$line" | sed 's| :1: \(.*\) :2: |\1|' ) # dout=$( echo "$line" | sed 's| :2: \(.*\) :3: |\1|' ) # dsub=$( echo "$line" | sed 's| :3: \(.*\) |\1|' ) # pth_optrNam_getArgOrderNum_dout "$optrNam" "$pthLibL" "$" # done 8< "$pthOptrNamL" # } #] pthOptrNamL_pthNdfL_argOrderNum() - extract list of uses of each of pthOptrNamL in each of pthL #] results for each OptrNam are saved in a file # www.BillHowell.ca 09Jul2022 initial # NOTE!!! : must use different varNames in dinn_finn_strP_replace() versus dinn_finn_archive_pStrPL_replace() # how do I "force execution" of path strings like : "$d_Qndfs"'QNial setup.ndf' ??? pthOptrNamL_pthNdfL_argOrderNum() { pthOptrNamL="$1" pthNdfL="$2" dirOut="$3" while read -u 9 optrNam; do rm "$d_Qtest"'optr usage/'"$optrNam"' usage.txt' while read -u 8 pthNdf; do # echo "pthNdf= $pthNdf" evalStr="echo ""$pthNdf" pthNdfFull=$( eval "$evalStr" ) # echo "pthNdfFull= $pthNdfFull" pth_optrNam_getArgOrderNum_dout "$pthNdfFull" "$optrNam" "$dirOut" done 8< "$pthNdfL" done 9< "$pthOptrNamL" } 08********08 #] 07Jul2022 run "$d_bin""fileops.sh" on QNialCoreLibrary headers, then re-start QNial to see errors Easy, far fewer errors, 10 versus 51 errors visible last run : >>> loading start : arrays.ndf ?undefined identifier: ARY_ITMP_GET_SUB <***> ARY ITMP { ?undefined identifier: CART EACH ARY_ITMP_GET_SUB <***> ITMPAIRL ) CHOOSE ?undefined identifier: LSTNEW := SUBP <***> ; LSTOLD_LENGTH ARY_LENGTH >>> loading start : strings.ndf ?undefined identifier: := EACH ARY_SLC_LENGTH_PREPAD_ARYOUT <***> ( ( 2 ?undefined identifier: := EACH ARY_SLC_LENGTH_PREPAD_ARYOUT <***> ( ( EACH >>> loading start : QNial test optrs.ndf ?undefined identifier: ( '_test' SUB_FINDALLITM_ARY <***> TESTOPTRSTR ) ) ?undefined identifier: ( '_test' SUB_FINDALLITM_ARY <***> TESTOPTRSTR ) ) ?undefined identifier: RESFLTL := TSTSIMPLE <***> TSTOPTRPHR ; ELSEIF ?undefined identifier: GROUPRSLT [ TSTOPTR <***> TSTOPTRPHR ] ; ?undefined identifier: CLUSTERRSLT ( GROUPTEST <***> TSTPHR ) ; 08Jul2022 In 'QNial setup - header.ndf' : #] 'arrays.ndf' aryShp_idx_to_slc IS OP ary idx { null } ary_idx_to_slc ary_idxA_to_slc IS OP ary idx { null } ary_idxA_to_slc >> corrected #] 'fileops.ndf' changed to : csvTable_readFrom_pth IS OP pth { null } pinn_read_csvTable pth_backupDatedTo_zArchive IS OP pth { null } pinn_backupDatedTo_zArchive pth_extract_dir IS OP pth { null } pthNm_extract_dir pthL_faultLL_shortenTo_Codes IS OP pthL faultLL { null } stays the same pth_read_strL IS OP pth { null } pinn_read_strL ...check them all... [bye, qnial] : 09Jul2022 fix libraries for $ qnial errors optr change : +.....+ +.....+ To : +.....+ +.....+ optr change : +.....+ +.....+ To : +.....+ +.....+ optr change : +.....+ +.....+ To : +.....+ +.....+ optr change : +.....+ +.....+ To : +.....+ +.....+ +-----+ olde code # olde code - oops, corrupted! csvTable_readFrom_pth IS OP pth { lineL := pth_read_strL pth ; cols mix (EACH execute pth_read_strL pth) } 08********08 #] 07Jul2022 "$d_bin""fileops.sh" - all day to fix my [many, many] stupid coding errors example : cp --force "$ptmp" "$dinn$finn" # doesn't want to work!???? - error d_inn instead of dinn # mv -f "$ptmp" "$dinn$finn" also - read from file : tab doesn't work # NOTE!!! : must use different funcNames in dinn_finn_strP_replace() versus dinn_finn_archive_pStrPL_replace() Now try "full" pStrPL : pStrPL="$d_Qtest"'arrays/220707 pStrPL [array, type, test].txt' dinn_finn_archive_pStrPL_replace "$d_temp" 'types (copy).ndf' "$pStrPL" >> looks good!! not a full check, that would cse brain damage Now do all core programs : dinn_finn_archive_pStrPL_replace "$d_symbols" 'QNial userWkspSymbol.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'types.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'faults.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'boolean.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'arrays.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'lists.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'strings.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'file_ops.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'windows.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'encryption.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qndfs" 'math - [quick, handy] stuff.ndf' "$pStrPL" dinn_finn_archive_pStrPL_replace "$d_Qtest"'arrays/' 'arrays- testOptrs.ndf' "$pStrPL" >> 10 of 10 backups in "$d_Qndfs"'z_Archive/' >> backup also of "$d_Qtest"'arrays/' 'arrays- testOptrs.ndf' error echo : z_Archive doesn"t exist for : >> probably "$d_symbols" wasn't defined "$d_Qtest"'arrays/' 'arrays- testOptrs.ndf' I put into "$d_bin""fileops.sh" : d_symbols="$d_Qndfs"'QNial [symbol, arg] changes/' I then re-ran with only dinn_finn_archive_pStrPL_replace "$d_symbols" 'QNial userWkspSymbol.ndf' "$pStrPL" >> OK, it's good Do [bye, qnial] to see QNial start errors >> 51 errors visible >> I will have to adapt 'QNial setup header.ndf' +-----+ olde code dinn_finn_archive_pStrPL_replace() { dinn="$1" dbkp="$dinn"'z_Archive/' finn="$2" date_ymdhm=$(date +"%y%m%d %kh%Mm") # pStrPL is defined external to function ftmp='dinn_finn_archive_pStrPL_replace temp.txt' # if $d_bkp = valid dir then backup, else error if [ -d "$dbkp" ]; then # echo 'pStrPL : $dinn$finn = '"$dinn$finn" # echo 'pStrPL : $dbkp$date_ymdhm$finn = '"$dbkp$date_ymdhm $finn" # echo 'pStrPL : $d_temp$ftmp = '"$d_temp$ftmp" cp -p "$dinn$finn" "$dbkp$date_ymdhm $finn" cp -p "$dinn$finn" "$d_temp$ftmp" while read -u 9 line; do if [ "$line" == "" ]; then echo "empty line in input file" else strOld=$( echo "$line" | sed 's|^\(.*\) ~:~ \(.*\)|\1|' ) strNew=$( echo "$line" | sed 's|^\(.*\) ~:~ \(.*\)|\2|' ) # echo "pStrPL : strOld = $strOld; strNew = $strNew" dinn_finn_strP_replace "$d_temp" "$ftmp" "$strOld" "$strNew" # echo 'pStrPL (2) : $dinn$finn = '"$dinn$finn" # 07Jul2022 what? this has CHANGED??!?!? cp --force "$d_temp$ftmp" "$dinn$finn" # mv --force "$d_temp$ftmp" "$dinn$finn" fi done 9< "$pStrPL" else echo 'z_Archive doesn"t exist for : '"$dinn" fi } 08********08 #] 06Jul2022 ary_posn_groupTest -> itm_chk_findAll_ary_testStd 2Jul2022 16h00m13s all tests failed itm_posnAInTop_ary doesn't exist!! ?not an operation Also faults have to be updated qnial> tstOptr "itm_chk_findAll_ary_testStd o itm_chk_findAll_ary_testStd 15 27 27 looks like ary itm are swapped? 08********08 #] 07Jul2022 revamp optr[names, argOrder] ary_[posn, split, cut] - ary_rest much higher consistence, but find etc reversed from QNial std created bash functions to do the work!! missing : ary_idx_to_slc ary_repeatNtimesTo_aryL ary_atm_replaceAllAtm_aryOut ary_to_atmL aryP_transStr_isSameStruct missing ary_itmP_get_sub ary_itmPL_get_sub slc_length_prepad2_ary ary_slcL_length_prepad_aryOut ary_repeatNtimesTo_aryL ary_chk_idx_get_itm think about : aryL_keyLIdx_cullSort aryL_keyLIdx_cullSort aryL_extractMulplicate_subArys aryL_extractMulplicate_subArys aryA_sortupOn1st aryA_sortupOn1st aryA_sortupOn_col aryA_colSort_sortup aryA_sortupCullOn1st ary_posnACommon1stItmIdxL ary_posnACommon1stItmIdxL "ary_posnACommon1stItmIndxL_testSpecial "aryL_commonKeyCullSort_aryCombinedOut_testSpecial "aryL_extractMulplicate_subArys_testSpecial No changes needed for Qtest - same as for Qndfs : sub_splitSeparate_ary_testSimple sub_splitSeparate_ary_testStd sub_splitAtEnd_ary_testStd sub_splitAtEnd_ary_testSimple sub_splitAtFront_ary_testStd sub_splitAtFront_ary_testSimple subL_splitSeparate_ary_testSimple subL_splitAtEnd_ary_testSimple subL_splitAtFront_ary_testSimple ary_subP_splitSeparateTo_midIndxs_subL_testSimple ary_strip_sub_testSimple ary_replace_subP_testSimple aryA_getOddIdx_testSpecial itm_cut_ary_testSimple sub_cut_ary_testSimple itmL_cut_aryL_testSimple itm_option_cull_ary itmL_option_cull_ary itmL_option_cull_aryL OK as is : ary_chk_idx_to_slc ary_chk_idxA_to_slc ary_chk_slc_to_idxA ary_chk_idx_get_slcLL ary_chk_itm_get_slcLL ary_chk_itm_get_slcLL_to_itm ary_chk_sub_get_slcLL 08********08 #] 06Jul2022 ary_posn_groupTest -> ary_chk_idx_get_itm_testSimple 2Jul2022 15h59m20s NONE of tests worked ?idx_chkFor_ary_get_itm_testSimple error : unknown tstTypPhr >> this is a clue, had been renamed ary_chk_idx_get_itm (?) qnial> ary_chk_idx_get_itm 4 (4 5 reshape (tell 30)) ?aryAtm >> arg order after change qnial> ary_chk_idx_get_itm null null ?aryNull ?idxNull qnial> ary_chk_idx_get_itm (4 5 reshape (tell 30)) 4 ?aryVlcIdxShp qnial> ary_chk_idx_get_itm (4 5 reshape (tell 30)) (0 4) ?ixagi1 tstOptr "ary_chk_idx_get_itm_testSimple >> not run yet? qnial> tstOptr "ary_chk_idx_get_itm_testSimple o ary_chk_idx_get_itm_testSimple 5 34 23 I re-ordered many args to follow optrName change qnial> tstOptr "ary_chk_idx_get_itm_testSimple o ary_chk_idx_get_itm_testSimple 11 26 22 still wrong resStds what is ?ixagi1 ? ary_idx_get_itm IS OP idx ary { LOCAL resFltL ; resFlt := idx pick ary ; IF (isFault resFlt) THEN fault '?ixagi1' ELSE resFlt ENDIF } just redo test & see qnial> tstOptr "ary_chk_idx_get_itm_testSimple o ary_chk_idx_get_itm_testSimple 17 26 22 >> all test that should be non-fault yield ?ixagi1 I don't understand why fault ?idxSingl arises instead of ?idxSolty qnial> pick 5 'the bigg fat cow' i >> OK, expected ary_idx_get_itm change : +.....+ ary_idx_get_itm IS OP idx ary +.....+ To : +.....+ ary_idx_get_itm IS OP ary idx +.....+ >> stupid - I didn't change order of args! qnial> tstOptr "ary_chk_idx_get_itm_testSimple o ary_chk_idx_get_itm_testSimple 21 22 22 >> one last fault is wrong qnial> tstOptr "ary_chk_idx_get_itm_testSimple o ary_chk_idx_get_itm_testSimple 18 22 22 >> ouch, and I change some faults throughout tall tests from ?aryVlcIdxShp to ?aryIdxTooBig!! that's a lot of work to fix qnial> tstOptr "ary_chk_idx_get_itm_testSimple o ary_chk_idx_get_itm_testSimple 20 22 22 qnial> tstOptr "ary_chk_idx_get_itm_testSimple l ary_chk_idx_get_itm_testSimple 22 22 22 >> OK, but have to fix MANY faults back ?aryIdxTooBig to ?aryVlcIdxShp!! 08********08 #] 06Jul2022 ary_chk_sub_get_slcLL_testSimple - put on hold to do ary_posn_groupTest changed resStds qnial> tstOptr "ary_chk_sub_get_slcLL_testSimple o ary_chk_sub_get_slcLL_testSimple 0 30 25 >> yuchhh what a mess I removed faults from sub_adrCompatible, I can't think of any faults?!?!?!? any sub is good? qnial> tstOptr "ary_chk_sub_get_slcLL_testSimple o ary_chk_sub_get_slcLL_testSimple 5 27 25 >> slightly better o|lst01_null |?itmNotInAry |l ?itmNotInAry >> where did itm come from? sub1stItm? qnial> ary_sub_get_slcLL 'the bigg fat cow' null l ?itmNotInAry flag_break it -->[nextv] ary sub +----------------++ |the bigg fat cow|| +----------------++ -->[nextv] l ?itmNotInAry ary_sub_get_slcLL change : +.....+ resFltL := EACH ary_idxA_to_slc ary subPosnA ; +.....+ To : +.....+ resFltL := EACH ary_idxA_to_slc ary subPosnA ; +.....+ ary_slc_to_idxA change : +.....+ ary_slc_to_idxA IS OP ary slc { LOCAL idx ; IF (= '[]' (link itm_cut_ary ` slc)) THEN idx := null ; ELSE idx := cart EACH execute (`, itm_cut_ary (front rest slc)) ; IF (isSingle idx) THEN idx := [first idx] ; ENDIF ; % 04Jul2022 does this work? ; ENDIF ; idx } +.....+ To : +.....+ ary_slc_to_idxA IS OP ary slc { LOCAL idxA ; IF (= '[]' (link itm_cut_ary ` slc)) THEN idxA := null ; ELSE idxA := cart EACH execute (`, itm_cut_ary (front rest slc)) ; IF (isSingle idxA) THEN idxA := [idxA] ; ENDIF ; ENDIF ; idxA } +.....+ qnial> ary_sub_get_slcLL 'the bigg fat cow' null -->[stepv] nextv ?.. Resfltl := sub_find1stitm_ary Sub Ary -->[nextv] l ?itmNotInAry problem with sub_find1stItm_ary sub_chk_find1stItm_ary_testStd I need to go through groupTest "ary_posn_groupTest and get that working 08********08 #] 04Jul2022 ary_chk_itm_getAllSlc_to_itm_testSimple qnial> tstOptr "ary_chk_itm_getAllSlc_to_itm_testSimple o ary_chk_itm_getAllSlc_to_itm_testSimple 11 25 23 >> this "category theory test" is much harder than most testing # 04Jul2022 note that if a fault arises in first step (ary_chk_itm_getAllSlc) then it is simply returned # getAllSlc_to_itm is only attempted if there are no faults from the first step take a 2-day break!! I'm getting too sick & tired of this 05Jul2022 qnial> tstOptr "ary_chk_itm_getAllSlc_to_itm_testSimple o ary_chk_itm_getAllSlc_to_itm_testSimple 11 25 23 ary_chk_itm_getAllSlc_to_itm change : +.....+ FOR slc WITH slcL DO resFltL := link resFltL ary|slc ; ENDFOR ; +.....+ To : +.....+ FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc] ; ENDFOR ; +.....+ >> 04Jul2022 execute 'ary|slc' does NOT work!!?? qnial> tstOptr "ary_chk_itm_getAllSlc_to_itm_testSimple o ary_chk_itm_getAllSlc_to_itm_testSimple 12 25 23 After some updates to fault codes : qnial> tstOptr "ary_chk_itm_getAllSlc_to_itm_testSimple o ary_chk_itm_getAllSlc_to_itm_testSimple 17 25 23 Work through 1st example that should give non-fault result : +--+-----------+------------+--------------------+ | o|lst01_atm | |?slice ?slice ?slice| +--+-----------+------------+--------------------+ ary := 'the bigg fat cow' qnial> slcL := ary_itm_getAllSlc ary `t +---+----+ |[0]|[11]| +---+----+ >> looks OK qnial> slc := slcL@0 [0] qnial> isString slc l qnial> execute 'ary|slc' ?slice qnial> ary|[0] t >> oh shit, execute doesn't work in this context? Uh oh if that is the case... qnial> execute link 'ary|' slc t >> OK, link form works, why not 'ary|slc'?? qnial> tstOptr "ary_chk_itm_getAllSlc_to_itm_testSimple o ary_chk_itm_getAllSlc_to_itm_testSimple 20 19 23 +--+-----------+------------+-------------------+ | l|lst01_null |?itmNotInAry|?itmNotInAry | +--+-----------+------------+-------------------+ >> Nice that this works, plus 3 other simple examples "ary01_itm (4 5 reshape (tell 30)) 6 [[6]] 'should work OK, for ary note that result is a listL, result looks correct?!!' +--+-----------+------------+-------------------+ | o|ary01_itm |+-+ |?type error in scan| | | ||6| | | | | |+-+ | | +--+-----------+------------+-------------------+ qnial> ary := (4 5 reshape (tell 30)) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 qnial> itm := 6 6 qnial> slcL := ary_itm_getAllSlc ary itm +---------------+ |+------+------+| ||[ , 1]|[1, ]|| |+------+------+| +---------------+ qnial> slc := slcL@0 +------+------+ |[ , 1]|[1, ]| +------+------+ RENAME _getAllSlc -> _get_slcLL >> OK ary_chk_itm_get_slcLL_to_itmL change : +.....+ +.....+ To : +.....+ ary_chk_itm_get_slcLL_to_itmL IS OP ary itm { LOCAL resFltL resFltLL slc slcL slcLL ; resFltL := ary_chk_itm_apply_optrPhr ary itm "ary_itm_get_slcLL ; IF (NOT ary_hasFaults resFltL) THEN slcLL := resFltL ; resFltLL := null ; FOR slcL WITH slcLL DO resFltL := null ; FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc] ; ENDFOR ; resFltLL := link resFltLL [resFltL] ; ENDFOR ; ENDIF ; resFltL } +.....+ qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple o ary_chk_itm_get_slcLL_to_itmL_testSimple 17 25 23 06Jul2022 qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple o ary_chk_itm_get_slcLL_to_itmL_testSimple 17 25 23 ary_chk_itm_get_slcLL_to_itmL change : +.....+ FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc] ; ENDFOR ; +.....+ To : +.....+ FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc ']'] ; ENDFOR ; +.....+ qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple o ary_chk_itm_get_slcLL_to_itmL_testSimple 17 36 23 +-----+ 06Jul2022 qnial> ary_chk_itm_get_slcLL_to_itmL 'the bigg fat cow' `w ?slice ?tokens left: ARY | 1 <***> ] ?tokens left: ARY | 5 <***> ] ?expecting expression: ARY | <***> ] ] flag_break & fonn -->[nextv] slcL [15] -->[nextv] slc [ >> ary_itm_get_slcLL is returning a slcL not a slcLL!! >> comes from ary_idx_get_slcLL ary_idx_get_slcLL change : +.....+ IF (isAtm idx) THEN resFltL := ary_idx_to_slc ary idx ; +.....+ To : +.....+ IF (isAtm idx) THEN resFltL := [ary_idx_to_slc ary idx] ; +.....+ qnial> tstOptr "ary_chk_idx_get_slcLL_testSimple o ary_chk_idx_get_slcLL_testSimple 22 20 26 >> changed resStd or single occurences of itm qnial> tstOptr "ary_chk_idx_get_slcLL_testSimple l ary_chk_idx_get_slcLL_testSimple 26 20 26 qnial> tstOptr "ary_chk_itm_get_slcLL_testSimple o ary_chk_itm_get_slcLL_testSimple 20 17 25 >> changed resStd or single occurences of itm qnial> tstOptr "ary_chk_itm_get_slcLL_testSimple l ary_chk_itm_get_slcLL_testSimple 25 17 25 >> changed resStd or single occurences of itm -->[stepv] resume o ary_chk_itm_get_slcLL_to_itmL_testSimple 17 25 23 ary_chk_itm_get_slcLL_to_itmL change back : +.....+ FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc ] ; ENDFOR ; +.....+ To : +.....+ FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc] ; ENDFOR ; +.....+ qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple o ary_chk_itm_get_slcLL_to_itmL_testSimple 17 17 23 >> still a problem +--+-----------+------------+---------------------+ | o|lst02_atm |+-+ |w | | | ||w| | | | | |+-+ | | +--+-----------+------------+---------------------+ ary_chk_itm_get_slcLL_to_itmL change back : +.....+ IF (NOT ary_hasFaults resFltL) THEN slcLL := resFltL ; FOR slcL WITH slcLL DO resFltL := null ; FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc] ; ENDFOR ; resFltLL := link resFltLL [resFltL] ; ENDFOR ; ENDIF ; resFltL +.....+ To : +.....+ IF (NOT ary_hasFaults resFltL) THEN slcLL := resFltL ; resFltLL := null ; FOR slcL WITH slcLL DO resFltL := null ; FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc] ; ENDFOR ; resFltLL := link resFltLL [resFltL] ; ENDFOR ; ENDIF ; resFltLL +.....+ qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple o ary_chk_itm_get_slcLL_to_itmL_testSimple 17 17 23 >> not yet qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple o ary_chk_itm_get_slcLL_to_itmL_testSimple 4 17 23 >> ouch!! lst0x_atm results OK, [faults, ary0x_itm] all wrong fix faults first : ary_chk_itm_get_slcLL_to_itmL change : +.....+ ary_chk_itm_get_slcLL_to_itmL IS OP ary itm { LOCAL resFltL resFltLL slc slcL slcLL ; IF flag_break THEN BREAK ; ENDIF ; resFltL := ary_chk_itm_apply_optrPhr ary itm "ary_itm_get_slcLL ; IF (NOT ary_hasFaults resFltL) THEN slcLL := resFltL ; resFltLL := null ; FOR slcL WITH slcLL DO resFltL := null ; FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc] ; ENDFOR ; resFltLL := link resFltLL [resFltL] ; ENDFOR ; ENDIF ; resFltLL +.....+ To : +.....+ ary_chk_itm_get_slcLL_to_itmL IS OP ary itm { LOCAL resFltL resFltLL slc slcL slcLL ; IF flag_break THEN BREAK ; ENDIF ; resFltLL := ary_chk_itm_apply_optrPhr ary itm "ary_itm_get_slcLL ; IF (NOT ary_hasFaults resFltL) THEN slcLL := resFltL ; resFltLL := null ; FOR slcL WITH slcLL DO resFltL := null ; FOR slc WITH slcL DO resFltL := link resFltL [execute link 'ary|' slc] ; ENDFOR ; resFltLL := link resFltLL [resFltL] ; ENDFOR ; ENDIF ; resFltLL } +.....+ qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple o ary_chk_itm_get_slcLL_to_itmL_testSimple 17 17 23 >> faults OK, all non-faults are wrong - return slc check ary_hasFaults via flag_break qnial> ary_chk_itm_get_slcLL_to_itmL 'the bigg fat cow' `w ?.. Resfltll := ary_chk_itm_apply_optrphr Ary Itm "ary_itm_get_slcLL -->[nextv] +------+ |+----+| ||[15]|| |+----+| +------+ ?.. IF ( not ary_hasfaults Resfltl ) THEN Slcll := Resfltl ; (...) -->[nextv] ?.. ( not ary_hasfaults Resfltl ) -->[nextv] ?.. not ary_hasfaults Resfltl -->[nextv] o o -->[nextv] not ary_hasfaults Resfltll l >> oops ary_chk_itm_get_slcLL_to_itmL change : +.....+ IF (NOT ary_hasFaults resFltL) THEN +.....+ To : +.....+ IF (NOT ary_hasFaults resFltLL) THEN +.....+ qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple -->[stepv] resume o ary_chk_itm_get_slcLL_to_itmL_testSimple 17 23 23 +--+-----------+------------+---------------------+ | o|lst01_atm |+-+ |+-------------------+| | | ||w| ||?type error in scan|| | | |+-+ |+-------------------+| +--+-----------+------------+---------------------+ qnial> ary_chk_itm_get_slcLL_to_itmL 'the bigg fat cow' `w +-------------------+ |?type error in scan| +-------------------+ change to slcLL := resFltLL ; qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple o ary_chk_itm_get_slcLL_to_itmL_testSimple 21 17 23 >> now lst0x_itm are OK, not ary0x_itm +--+-----------+------------+-----------------------+ | o|ary01_itm |+-+ |+---------------------+| | | ||6| ||+---------+---------+|| | | |+-+ |||1 6 11 16|5 6 7 8 9||| | | | ||+---------+---------+|| | | | |+---------------------+| +--+-----------+------------+-----------------------+ >> makes no sense qnial> ary_chk_itm_get_slcLL_to_itmL (4 5 reshape (tell 30)) 6 +---------------------+ |+---------+---------+| ||1 6 11 16|5 6 7 8 9|| |+---------+---------+| +---------------------+ ?.. Slcl -->[nextv] +------+------+ |[ , 1]|[1, ]| +------+------+ ?.. Resfltl := link Resfltl [ execute link 'ary|' Slc ] -->[nextv] +---------+ |1 6 11 16| +---------+ >> problem -->[nextv] slc [ , 1] >> looks OK!!? -->[nextv] execute link 'ary|' Slc 1 6 11 16 -->[nextv] ary := (4 5 reshape (tell 30)) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 >> actually, the slc is OK! - NOT just an atm! amore corrections to resStd qnial> tstOptr "ary_chk_itm_get_slcLL_to_itmL_testSimple l ary_chk_itm_get_slcLL_to_itmL_testSimple 23 17 23 "ary01_itm (4 5 reshape (tell 30)) 6 [(1 6 11 16) (5 6 7 8 9)] 'should work OK, note that result is a solitary of itmL, confusing [solitary, list] not obvious' "ary02_itm (4 5 reshape (tell 30)) 2 [(2 7 12 17) (0 1 2 3 4)] 'should work OK, note that result is a solitary of itmL, confusing [solitary, list] not obvious' >> this is not obvious to me which part is a list, which is solitary 08********08 #] 04Jul2022 ary_chk_itm_getAllSlc_testSimple qnial> tstOptr "ary_chk_itm_getAllSlc_testSimple o ary_chk_itm_getAllSlc_testSimple 20 17 25 >> most faults from changes to error msgs, non-null [idx,slc] qnial> tstOptr "ary_chk_itm_getAllSlc_testSimple l ary_chk_itm_getAllSlc_testSimple 25 17 25 >> very easy changes 08********08 #] 04Jul2022 ary_chk_idx_getAllSlc_testSimple qnial> tstOptr "ary_chk_idx_getAllSlc_testSimple o ary_chk_idx_getAllSlc_testSimple 17 20 26 >> most faults from changes to error msgs, non-null [idx,slc] qnial> tstOptr "ary_chk_idx_getAllSlc_testSimple l ary_chk_idx_getAllSlc_testSimple 26 20 26 >> easy fixes +-----+ olde code Not useful? # loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' IF flag_debug THEN write 'loading sub_chk_idxA_to_slc' ; ENDIF ; #] sub_chk_idxA_to_slc IS OP sub idx - only for sub_chk_idxA_to_slc_testSimple (not generic) # 26Apr2022 initial # STRANGE TEST: as we don't know ary, just [sub, idx] # 23Jun2022 DON'T convert [sub, idx] to shapes! sub_chk_idxA_to_slc IS OP sub idx { ary_chk_idx_apply_optrPhr sub idx "subShp_idx_to_slc } # loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' IF flag_debug THEN write 'loading sub_chk_idxA_to_slc_testSimple' ; ENDIF ; #] sub_chk_idxA_to_slc_testSimple := - list of [row, col, plane, array] slices eg [(0,,) (,,5)] # 26Apr2022 initial, several from manual 20Apr2022 tests # 04Jul2022 not useful?? - need ary? not really, can see idxA too large etc, forget this for now # past tersts all wrong # tstOptr "sub_chk_idxA_to_slc_testSimple sub_chk_idxA_to_slc_testSimple := "tstSimple 2 "d_arrayTests ( "null01_null null null (EACH fault '?aryNull' '?idxNull') 'error : not defined for isNull[idx, ary]' "null01_atm null 4 [fault '?idxNull'] 'error : not defined for isNull idx' "atm01_null `g null (EACH fault '?aryNull' '?idxNoInt') 'error : not defined for [isNull idx, isAtm ary]' "atm01_atm `g `g (EACH fault '?ixca3' '?idxNoInt') 'not defined for [nonIntL idx, isAtm ary]' "atm02_atm 4 4 [fault '?idxNoInt'] 'error : not defined for isAtm ary' "lst01_null 'the bigg fat cow' null [fault '?aryNull'] 'error : not defined for isNull idx' "lst01_atm 'the bigg fat cow' ` [fault '?ixca3'] 'error : nonIntegerL idx' "lst02_atm (tell 10) (fault '?idxNull') [fault '?ixca3'] 'error : nonIntegerL idx' "lst01_idx 'the bigg fat cow' 4 (single (4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)) 'should be OK' "lst02_idx (tell 10) 6 (single (6 7 8 9 10 11 12 13 14 15)) 'should be OK' "lst03_idx (4 5 6) 1 (single (1 2 3)) 'should work OK' "lst01_idxL (tell 10) [4] [4 5 6 7 8 9 10 11 12 13] 'should work OK' "lst06_idxL (tell 10) (4 5) [fault '?aryVlcIdxShp'] 'error : (~= (valence ary) (gage shape idx))' "lstL01_idx ((tell 10) (tell 10) 4 5) 1 (single (1 2 3 4)) 'should be OK' "lstL01_idxL ((tell 10) (tell 10) 4 5) (4 5) [fault '?aryVlcIdxShp'] 'error : (~= (valence ary) (gage shape idx))' "lstL01_idxL ((tell 10) (tell 10) 4 5) ([4] [5]) [fault '?ixca3'] 'error : not defined for nonIntL idx' "ary01_idxL (3 4 reshape (tell 20)) (0 4) ((0 1 2) (4 5 6 7)) 'error : not defined for nonIntL idx' "ary02_idxL (4 5 reshape (tell 30)) (2 3) ((2 3 4 5) (3 4 5 6 7)) 'should work OK' "ary03_idxL (4 5 reshape (tell 30)) 2 [fault '?idxNull'] 'error : (~= (valence ary) (gage shape idx))' "ary04_idxL (4 5 reshape (tell 30)) (4 5) ((4 5 6 7) (5 6 7 8 9)) 'should work OK' "ary05_idxL (3 4 reshape (tell 20)) (0 4) ((0 1 2) (4 5 6 7)) 'should work OK' "ary06_idxL (4 5 reshape (tell 30)) ((2 3) (1 2)) [fault '?ixca3'] 'error : idx must be an intL, not intLL' "ary01_idxA (3 4 reshape (tell 20)) (1 1 reshape 0 4) [fault '?aryAtm'] 'error : not is[Atm,Lst] idx ' "ary02_idxA (4 5 reshape (tell 30)) (2 3 reshape 1 2 3 6 7 8) [fault '?aryAtm'] 'error : not is[Atm,Lst] idx ' ) ; 08********08 #] 04Jul2022 ary_chk_slc_to_idxA_testSimple qnial> tstOptr "ary_chk_slc_to_idxA_testSimple o ary_chk_slc_to_idxA_testSimple 21 17 24 >>mostly changes in faults recently qnial> tstOptr "ary_chk_slc_to_idxA_testSimple o ary_chk_slc_to_idxA_testSimple 23 17 24 added more tests : qnial> tstOptr "ary_chk_slc_to_idxA_testSimple o ary_chk_slc_to_idxA_testSimple 23 19 26 slc_adrCompatible change : +.....+ IF (= null idx) THEN null ; % bypass other conditions ; ELSEIF (NOT isString slc) THEN resFltL := fault '?slcNotStr' ; +.....+ To : +.....+ IF (NOT isString slc) THEN resFltL := fault '?slcNotStr' ; +.....+ qnial> `, itm_cut_ary (front rest '[[]]') +--+ |[]| +--+ qnial> `, itm_cut_ary (front rest '[[ ]]') +----+ |[ ]| +----+ qnial> itm_cut_ary ` '[[]]' +----+ |[[]]| +----+ qnial> itm_cut_ary ` ' [[ ]]' +--+--+ |[[|]]| +--+--+ qnial> itm_cut_ary ` '[ [] ] ' +-+--+-+ |[|[]|]| +-+--+-+ qnial> itm_cut_ary ` '[ [ ] ]' +-+-+-+-+ |[|[|]|]| +-+-+-+-+ >> just link them qnial> `, itm_cut_ary (front rest '[[]]') +--+ |[]| +--+ qnial> `, itm_cut_ary (front rest '[[ ]]') NULL : did I make a HUGE mistake? null is NOT legitimate [idx, slc]!!!??? qnial> a := 'the bigg fat cow' the bigg fat cow qnial> a@[[]] ?address qnial> a@[] ?address qnial> a@() ?expecting expression: A @ ( <***> ) qnial> a@ ?expecting expression: A @ <***> qnial> a@null ?address qnial> a@(null) ?address qnial> a the bigg fat cow qnial> a|[null] qnial> a the bigg fat cow qnial> a|null ?slice qnial> a|(null) ?slice qnial> a|[3] qnial> a|[1] h qnial> a|[] ?slice qnial> a@[] ?address But what did I see yestserday that worked? - big mystery or hallucinations! nulls ARE strings, but not [idx, slc] ary_compatible_idx change : +.....+ ary_compatible_idx IS OP ary idx { LOCAL aryVlc idxVlc faultL ; % ; faultL := ary_adrCompatible ary ; faultL := link faultL (idx_adrCompatible idx) ; % ; IF (NOT ary_hasFaults faultL) THEN aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; IF (= null idx) THEN faultL := null ; % skip other tests if null ; ELSEIF (AND (isAtm idx) (= 1 aryVlc)) THEN faultL := null ; ELSEIF (~= aryVlc idxShp) THEN faultL := link faultL (fault '?aryVlcIdxShp') ; ELSEIF (OR (aryShp EACHBOTH <= idx)) THEN faultL := link faultL (fault '?aryIdxShp') ; ENDIF ; ENDIF ; % ; IF (= null faultL) THEN l ELSE faultL ENDIF } +.....+ To : +.....+ ary_compatible_idx IS OP ary idx { LOCAL aryVlc idxVlc faultL ; % ; faultL := ary_adrCompatible ary ; faultL := link faultL (idx_adrCompatible idx) ; % ; IF (NOT ary_hasFaults faultL) THEN aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; IF (AND (isAtm idx) (= 1 aryVlc)) THEN faultL := null ; ELSEIF (~= aryVlc idxShp) THEN faultL := link faultL (fault '?aryVlcIdxShp') ; ELSEIF (OR (aryShp EACHBOTH <= idx)) THEN faultL := link faultL (fault '?aryIdxShp') ; ENDIF ; ENDIF ; % ; IF (= null faultL) THEN l ELSE faultL ENDIF } +.....+ qnial> tstOptr "ary_chk_slc_to_idxA_testSimple l ary_chk_slc_to_idxA_testSimple 25 20 25 >> finally OK +-----+ olde code % aryVlc idxVlc := EACH valence ary idx ; % aryShp idxShp := EACH (gage shape) ary idx ; 08********08 #] 04Jul2022 ary_chk_idxA_to_slc_testSimple qnial> tstOptr "ary_chk_idxA_to_slc_testSimple o ary_chk_idxA_to_slc_testSimple 18 32 27 >> mostly recent changes to faults qnial> tstOptr "ary_chk_idxA_to_slc_testSimple o ary_chk_idxA_to_slc_testSimple 22 32 27 >> better, but problems with optr - wrong results I'm getting mixed up because of idxA - requires list inputs qnial> tstOptr "ary_chk_idxA_to_slc_testSimple l ary_chk_idxA_to_slc_testSimple 27 28 27 >> Awesome, wwatough for a bit 04Jul2022 Recheck after code changes for ary_chk_slc_to_idxA_testSimple qnial> tstOptr "ary_chk_idxA_to_slc_testSimple o ary_chk_idxA_to_slc_testSimple 26 29 27 +--+------------+---------------------------------------------------------+----------------------------------- | o|null01_nullL|+--------+ |+-----------------+ | | ||?aryNull| ||?aryNull ?idxNull| | | |+--------+ |+-----------------+ +--+------------+---------------------------------------------------------+----------------------------------- simple fix... qnial> tstOptr "ary_chk_idxA_to_slc_testSimple l ary_chk_idxA_to_slc_testSimple 27 29 27 08********08 #] 04Jul2022 ary_chk_idx_to_slc_testSimple qnial> tstOptr "ary_chk_idx_to_slc_testSimple o ary_chk_idx_to_slc_testSimple 12 21 27 problem : "lst01_null 'the bigg fat cow' null [fault '?idxNull'] 'should be ?idxNull - isNull idx' qnial> ary_idx_to_slc 'the bigg fat cow' null [?address] ary_idx_to_slc change : +.....+ IF (isAtm idx) THEN +.....+ To : +.....+ IF (OR (= null idx) (isAtm idx)) THEN +.....+ lq_arrays qnial> ary_idx_to_slc 'the bigg fat cow' null [] >> OK, works qnial> loaddefs link d_Qtest 'arrays/arrays- testOptrs.ndf' qnial> tstOptr "ary_chk_idx_to_slc_testSimple o ary_chk_idx_to_slc_testSimple 25 21 27 couple more fixes to test results... qnial> tstOptr "ary_chk_idx_to_slc_testSimple l ary_chk_idx_to_slc_testSimple 27 21 27 >> OK! 04Jul2022 Recheck after code changes for ary_chk_slc_to_idxA_testSimple qnial> tstOptr "ary_chk_idx_to_slc_testSimple o ary_chk_idx_to_slc_testSimple 24 24 27 qnial> tstOptr "ary_chk_idx_to_slc_testSimple l ary_chk_idx_to_slc_testSimple 27 24 27 >OK! very simple changes 08********08 #] 03Jul2022 ary_chk_compatible_idx_testSimple works 04Jul2022 fix null in isSlcStr IS OP slc - ensure slc is an address, returns OR[null, faultL], isSlcStr change : +.....+ IF (= null slc) THEN resFltL := fault '?slcNull' ; +.....+ To : +.....+ IF (= null slc) THEN null ; % bypass rest of conditions ; +.....+ remove: #? isSlcStr ?slcNull - (= null slc) qnial> tstOptr "ary_chk_compatible_slc_testSimple o ary_chk_compatible_slc_testSimple 30 28 31 >> Great! one "unresolvable" (for now) : +--+------------+-----------------------------------------------------+-------------------+ | o|ary12_slc | 0 1 2 3 4 |[1, 5] | | | | 5 6 7 8 9 | | | | |10 11 12 13 14 | | | | |15 16 17 18 19 | | +--+------------+-----------------------------------------------------+-------------------+ +--+------------+-------------------+-------------------+ | o|ary12_slc |?arySlcShp | l| +--+------------+-------------------+-------------------+ >> does NOT capture over-sized slcIdx +-----+ olde code - [itm, sub] can be of any type? olde notes : # tests : # "null01_null (EACH fault '?aryVlcIdxShp' '?ixca4') 'should fail for isNull[idxA, ary], instead null output?' qnial> ary_compatible_idx (EACH (gage shape) null null) ?aryVlcIdxShp # "lst01_null [fault '?aryVlcIdxShp'] 'should be OK, error : not defined for isNull idxA' qnial> ary_compatible_idx (gage shape 'the bigg fat cow') null ?ixca3 qnial> ary_compatible_idx (gage shape 'this is a test') `a ?ixca5 qnial> ary_compatible_idx (gage shape (2 3 reshape 10)) (1 2) l # qnial> EACH [gage shape, valence] null 1 `c [1] (tell 10) +---+----+----+---+----+ |0 1|++-+|++-+|1 1|10 1| | |||0||||0|| | | | |++-+|++-+| | | +---+----+----+---+----+ 08********08 #] 02Jul2022 [ary, idxc, itm, sub, pat]_adrCompatible - adapt tests to new generic operators, #] also - [pth_typ_exists, pinn_backupDatedTo_zArchive] and do backups!! (bugs remain) back to sliceGroup tests fter massive revamp of optr names : ary_chk_compatible_idx_testSimple >> all wrong with error ?no_value ary_compatible_idx null null >> mixup of faultL and resFltL qnial> groupTest "ary_slice_groupTest o ary_slice_groupTest 53 284 259 +--+---------------------------------------+-------+------+-----+ |OK|test (optr) |correct|faults|total| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_compatible_idx_testSimple | 4| 27| 27| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_compatible_slc_testSimple | 8| 30| 31| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_idx_to_slc_testSimple | 2| 33| 27| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_idxA_to_slc_testSimple | 5| 41| 27| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_slc_to_idxA_testSimple | 10| 19| 24| +--+---------------------------------------+-------+------+-----+ | o|sub_chk_idxA_to_slc_testSimple | 0| 29| 24| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_idx_getAllSlc_testSimple | 5| 27| 26| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_itm_getAllSlc_testSimple | 11| 23| 25| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_itm_getAllSlc_to_itm_testSimple| 8| 25| 23| +--+---------------------------------------+-------+------+-----+ | o|ary_chk_sub_getAllSlc_testSimple | 0| 30| 25| +--+---------------------------------------+-------+------+-----+ >> mostly changed eror codes, huge work to update! ?aryNull ?ixca1 ?slca1 ?aryFault ?ixca2 ?arySolty ?ixca6 ?arySingl ?ixca8 ?slca2 ?aryAtm ?ixca9 ?idxNull ?idxFault ?idxSolty ?idxSingl ?idxNoInt ?slcNull ?slca6 ?slcFault ?slcSolty ?slcSingl ?slcNoStr ?slca7 ?itmNull ?itmFault ?itmSolty ?itmSingl ?itmAtm ?subNull ?subFault ?subSolty ?subSingl ?subAtm ?patNull ?patFault ?patSolty ?patSingl ?patAtm 03Jan2022 isSlcStr change : +.....+ resFltL := null ; +.....+ To : +.....+ resFltL := l ; +.....+ qnial> ary_compatible_slc null null ?aryNull >wrong! slc is also fault -->[nextv] isSlcStr null >> Ah hah, problem. # holy nutcase : -->[nextv] isString null l >> WRONG - but correct by QNial Dictionary : isstring '' = l isSlcStr added : +.....+ IF (= null slc) THEN resFltL := fault '?slcNull' ; +.....+ qnial> ary_compatible_slc (4 5 reshape (tell 30)) '[2, 0]' ?slcChrNo >> hah, I was missing a space in (slc EACHLEFT in '[],0123456789')) Swap order ary_adrCompatible change : +.....+ ELSEIF (isSolitary ary) THEN faultL := link faultL (fault '?arySolty') ; ELSEIF (isSingle ary) THEN faultL := link faultL (fault '?arySingl') ; ELSEIF (isAtm ary) THEN faultL := link faultL (fault '?aryAtm' ) ; ELSEIF (NAND (`[ `] EACHLEFT = ([first, last] slc))) +.....+ To : +.....+ ELSEIF (isAtm ary) THEN faultL := link faultL (fault '?aryAtm' ) ; ELSEIF (isSingle ary) THEN faultL := link faultL (fault '?arySingl') ; ELSEIF (isSolitary ary) THEN faultL := link faultL (fault '?arySolty') ; ELSEIF (NAND (`[ `] EACHBOTH = ([first, last] slc))) +.....+ +-----+ olde code - [itm, sub] can be of any type? # useless crap! ELSEIF (= null idx) THEN faultL := link faultL (fault '?idxNull' ) ; ELSEIF (isFault idx) THEN faultL := link faultL (fault '?idxFault') ; ELSEIF (isSolitary idx) THEN faultL := link faultL (fault '?idxSolty') ; ELSEIF (isSingle idx) THEN faultL := link faultL (fault '?idxSingl') ; #? idx_adrCompatible ?idxNull - (= null idx), nulls aren"t addresses! #? idx_adrCompatible ?idxFault - (isFault idx), faults aren"t addresses! #? idx_adrCompatible ?idxSolty - (isSolitary idx), solitarys aren"t addresses! #? idx_adrCompatible ?idxSingl - (isSingle idx), singles aren"t addresses! # useless crap! ELSEIF (= null slc) THEN faultL := link faultL (fault '?slcNull' ) ; ELSEIF (isFault slc) THEN faultL := link faultL (fault '?slcFault') ; ELSEIF (isSolitary slc) THEN faultL := link faultL (fault '?slcSolty') ; ELSEIF (isSingle slc) THEN faultL := link faultL (fault '?slcSingl') ; #? slc_adrCompatible ?slcNull - (= null slc), nulls aren"t slices! #? slc_adrCompatible ?slcFault - (isFault slc), faults aren"t slices! #? slc_adrCompatible ?slcSolty - (isSolitary slc), solitarys aren"t slices! #? slc_adrCompatible ?slcSingl - (isSingle slc), singles aren"t slices! 08********08 #] 02Jul2022 rename posn optrs, arg order stays same 'file_ops.ndf' of file doesn't work - have to do it the hard way change ALL core ndf files : itm_posnAInTop_ary -> itm_findAll_ary sub_posnA1stItmInTop_ary -> sub_find1stItm_ary sub_posnAAllItmInTop_ary -> sub_findAllItm_ary subL_posnAAllItmInTop_ary -> subL_findAllItm_ary fix optr names for : link d_Qtest 'arrays/arrays- testOptrs.ndf' - link d_Qtest 'arrays/arrays- testGroupsCluster.ndf' itm_posnAInTopChkinp_ary itm_chk_findAll_ary itm_posnAInTopChkinp_ary_testStd itm_chk_findAll_ary_testStd sub_posnA1stItmInTopChkinp_ary sub_chk_find1stItm_ary sub_posnA1stItmInTopChkinp_ary_testStd sub_chk_find1stItm_ary_testStd sub_posnAAllItmInTopChkinp_ary sub_chk_findAllItm_ary sub_posnAAllItmInTopChkinp_ary_testStd sub_chk_findAllItm_ary_testStd subL_posnAAllItmInTopChkinp_ary subL_chk_findAllItm_ary subL_posnAAllItmInTopChkinp_ary_testSimple subL_chk_findAllItm_ary_testSimple subL_posnAAllItmInTopChkinp_ary_testStd subL_chk_findAllItm_ary_testStd pth_typ_exists change : +.....+ IF (= "padd typ) THEN IF filFail THEN truFlt := fault '?pte4' ; ELSE truFlt := l ; ENDIF ; ELSEIF (= "pold typ) THEN IF filFail THEN truFlt := fault '?pte5' ; ELSE truFlt := l ; ENDIF ; ELSEIF (= "povr typ) THEN IF dirUpFail THEN truFlt := fault '?pte6' ; ELSE truFlt := l ; ENDIF ; ELSEIF (= "pnew typ) THEN IF filFail THEN truFlt := fault '?pte7' ; ELSEIF dirUpFail THEN truFlt := fault '?pte8' ; ELSE truFlt := l ; ENDIF ; ELSEIF (= "dold typ) THEN IF dirFail THEN truFlt := fault '?pte9' ; ELSE truFlt := l ; ENDIF ; ELSEIF (= "dnew typ) THEN IF dirFail THEN truFlt := l ; ELSE truFlt := fault '?pte10' ; ENDIF ; IF dirUpFail THEN truFlt := fault '?pte11' ; ELSE truFlt := l ; ENDIF ; ENDIF ; +.....+ To : +.....+ IF (= "padd typ) THEN IF filFail THEN truFlt := fault '?pte4' ; ENDIF ; ELSEIF (= "pold typ) THEN IF filFail THEN truFlt := fault '?pte5' ; ENDIF ; ELSEIF (= "povr typ) THEN IF dirUpFail THEN truFlt := fault '?pte6' ; ENDIF ; ELSEIF (= "pnew typ) THEN IF (NOT filFail) THEN truFlt := fault '?pte7' ; ELSEIF dirUpFail THEN truFlt := fault '?pte8' ; ENDIF ; ELSEIF (= "dold typ) THEN IF dirFail THEN truFlt := fault '?pte9' ; ENDIF ; ELSEIF (= "dnew typ) THEN IF (NOT dirFail) THEN truFlt := fault '?pte10' ; ELSEIF dirUpFail THEN truFlt := fault '?pte11' ; ENDIF ; ENDIF ; +.....+ >> still not working properly! 08********08 #] 01Jul2022 revamp adrCompatible series in 'types.ndf' 08********08 #] 01Jul2022 ary_chk_sub_getAllSlc_testSimple +--+-----------+------------------+---------------------------+ | o|lst01_null |?ipa1 |?sp1ia2 | +--+-----------+------------------+---------------------------+ >> Ouch - there is NO check in sub_posnA1stItmInTop_ary for ary = [null, atm, fault, etc, etc] : I need to revamp [itm,sub,subL]_posnA[,1st,All]InTop_ary to use ary_compatible_sub for standard tests! optr change : +.....+ sub_posnA1stItmInTop_ary IS OP sub ary { LOCAL fnd1stSubItmidxAL fndMaxidxL idx resFltL shapeSub slicer subFindL subt fit1stSubItmidxAL fitMaxidxL mch1stSubItmidxAL ; % ; resFltL := ary_compatible_sub ary sub ; % ; IF (NOT ary_hasFaults resFltL) THEN fnd1stSubItmidxAL := first sub findall ary ; IF (isFault fnd1stSubItmidxAL) THEN resFltL := fault '?sp1ia1' ; ELSE shapeSub := gage shape sub ; fndMaxidxL := fnd1stSubItmidxAL EACHLEFT sum shapeSub ; fitMaxidxL := EACH OR EACH OR list ( ((gage shape ary) EACHRIGHT - fndMaxidxL) EACHLEFT >= 0 ) ; fit1stSubItmidxAL := fitMaxidxL subList fnd1stSubItmidxAL ; % view intermediates : fnd1stSubItmidxAL fndMaxidxL fit1stSubItmidxAL fitMaxidxL ; IF (= null fit1stSubItmidxAL) THEN resFltL := fault '?sp1ia2' ; ELSEIF (ary_hasFaults fit1stSubItmidxAL) THEN resFltL := fault '?sp1ia3' ; ELSE % find matches ; mch1stSubItmidxAL := null ; FOR idx WITH fit1stSubItmidxAL DO slicer := sub_idx_to_slc sub idx ; subt := ary|slicer ; IF (ary_hasFaults subt) THEN mch1stSubItmidxAL := fault '?sp1ia4' ; ELSE mch1stSubItmidxAL := append mch1stSubItmidxAL idx ; ENDIF ; ENDFOR ; resFltL := mch1stSubItmidxAL ; ENDIF ; ENDIF ; ENDIF ; % ; resFltL } # fault codes (can't have apos! use quotes) : #? sub_posnA1stItmInTop_ary ?sp1ia0 - (~= EACH valence sub ary) #? sub_posnA1stItmInTop_ary ?sp1ia1 - isNull fnd1stSubItemidxAL x#? sub_posnA1stItmInTop_ary ?sp1ia2 - isFault fitidx1stsubItem, eg sub won't fit into ary #? sub_posnA1stItmInTop_ary ?sp1ia3 - ary_hasFaults fit1stSubItemidxAL (not ?first arg of sublist is empty) #? sub_posnA1stItmInTop_ary ?sp1ia4 - isNull mch1stSubItmidxAL, can't find sub +.....+ To : +.....+ sub_posnA1stItmInTop_ary IS OP sub ary { LOCAL fnd1stSubItmidxAL fndMaxidxL idx resFltL shapeSub slicer subFindL subt fit1stSubItmidxAL fitMaxidxL mch1stSubItmidxAL ; % ; resFltL := ary_compatible_sub ary sub ; % ; IF (NOT ary_hasFaults resFltL) THEN fnd1stSubItmidxAL := first sub findall ary ; IF (isFault fnd1stSubItmidxAL) THEN resFltL := fault '?sp1ia1' ; ELSE shapeSub := gage shape sub ; fndMaxidxL := fnd1stSubItmidxAL EACHLEFT sum shapeSub ; fitMaxidxL := EACH OR EACH OR list ( ((gage shape ary) EACHRIGHT - fndMaxidxL) EACHLEFT >= 0 ) ; fit1stSubItmidxAL := fitMaxidxL subList fnd1stSubItmidxAL ; % view intermediates : fnd1stSubItmidxAL fndMaxidxL fit1stSubItmidxAL fitMaxidxL ; IF (= null fit1stSubItmidxAL) THEN resFltL := fault '?sp1ia2' ; ELSEIF (ary_hasFaults fit1stSubItmidxAL) THEN resFltL := fault '?sp1ia3' ; ELSE % find matches ; mch1stSubItmidxAL := null ; FOR idx WITH fit1stSubItmidxAL DO slicer := sub_idx_to_slc sub idx ; subt := ary|slicer ; IF (ary_hasFaults subt) THEN mch1stSubItmidxAL := fault '?sp1ia4' ; ELSE mch1stSubItmidxAL := append mch1stSubItmidxAL idx ; ENDIF ; ENDFOR ; resFltL := mch1stSubItmidxAL ; ENDIF ; ENDIF ; ENDIF ; % ; resFltL } # fault codes (can't have apos! use quotes) : #? sub_posnA1stItmInTop_ary ?sp1ia0 - (~= EACH valence sub ary) #? sub_posnA1stItmInTop_ary ?sp1ia1 - (isFault fnd1stSubItmidxAL), 1stItm of sub is not an itm of ary #? sub_posnA1stItmInTop_ary ?sp1ia2 - isFault fitidx1stsubItem, eg sub won't fit into ary #? sub_posnA1stItmInTop_ary ?sp1ia3 - ary_hasFaults fit1stSubItemidxAL (not ?first arg of sublist is empty) #? sub_posnA1stItmInTop_ary ?sp1ia4 - isNull mch1stSubItmidxAL, can't find sub +.....+ qnial> a := tell 10 0 1 2 3 4 5 6 7 8 9 qnial> a@1 1 qnial> a := single (tell 10) o-------------------+ |0 1 2 3 4 5 6 7 8 9| +-------------------+ qnial> a@1 ?address split [ary, indx, slc, itm, sub] compatibles into [ary, indx, slc, itm, sub]_adrCompatible yet - still need "interactive versions! so ADD [ary, indx, slc, itm, sub]_adrCompatible 08********08 #] 01Jul2022 ary_chk_itm_getAllSlc_testSimple - idx > 9 are split! Example: qnial> ary_itm_getAllSlc 'the bigg fat cow' `w +-----+ |[1,5]| +-----+ qnial> ary_idx_getAllSlc 'the bigg fat cow' 15 [1,5] qnial> ary_idx_to_slc 'the bigg fat cow' 15 [1,5] ary_idx_to_slc change : +.....+ ary_idx_to_slc IS OP ary idx { LOCAL axis faultL slc ; % ; faultL := null ; IF (isAtm idx) THEN slc := string idx ; slc := link '[' (front link (slc EACHLEFT link ',')) ']' ; ELSE slc := (valence ary) reshape [null] ; FOR axis WITH (tell valence ary) DO IF (= null idx@axis) THEN slc@axis := link (' ' EACHRIGHT link ' ') ; ELSE slc@axis := link (' ' EACHRIGHT link (string idx@axis)) ; ENDIF ; ENDFOR ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; ENDIF ; % ; IF (= null faultL) THEN slc ELSE faultL ENDIF } +.....+ To : +.....+ slc := string idx ; slc := link '[' slc ']' ; +.....+ qnial> ary_idx_to_slc 'the bigg fat cow' 15 [15] qnial> ary_idx_getAllSlc 'the bigg fat cow' 15 [15] qnial> ary_itm_getAllSlc 'the bigg fat cow' `w +----+ |[15]| +----+ >> OK Check for higher dimension : qnial> ary_idx_to_slc (2 12 reshape chrs_alpha_small) (0 12) [0, 1 2] >> wrong - same split of idx ary_idx_to_slc change : +.....+ THEN slc@axis := link (' ' EACHRIGHT link ' ') ; ELSE slc@axis := link (' ' EACHRIGHT link (string idx@axis)) ; ENDIF ; ENDFOR ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; +.....+ To : +.....+ THEN slc@axis := ' ' ; ELSE slc@axis := link (' ' EACHRIGHT link [string idx@axis]) ; ENDIF ; ENDFOR ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; +.....+ qnial> ary_idx_to_slc (2 12 reshape chrs_alpha_small) (0 11) [0, 11] qnial> ary_idx_getAllSlc (2 12 reshape chrs_alpha_small) (0 11) +-------+------+ |[ , 11]|[0, ]| +-------+------+ qnial> ary_itm_getAllSlc (2 12 reshape chrs_alpha_small) `l ?ipa1 >> oops - problem with cornerpoint? qnial> itm_posnAInTop_ary `l (2 12 reshape chrs_alpha_small) ?ipa1 itm_posnAInTop_ary `a (2 12 reshape chrs_alpha_small) itm_posnAInTop_ary `d (2 12 reshape chrs_alpha_small) qnial> itm_posnAInTop_ary `l (2 12 reshape chrs_alpha_small) ?ipa1 qnial> itm_posnAInTop_ary `a (2 12 reshape chrs_alpha_small) ?ipa1 qnial> itm_posnAInTop_ary `d (2 12 reshape chrs_alpha_small) ?ipa1 qnial> `d findall (2 12 reshape chrs_alpha_small) >> wow, all screwed up all of a sudden? doesn't work with chrs? qnial> 5 findall (2 12 reshape (tell 20)) +---+ |0 5| +---+ > OK with ints qnial> 'd' findall (2 12 reshape chrs_alpha_small) +---+ |0 3| +---+ >> chr must be submitted as str? Why? qnial> EACH ischar (2 12 reshape chrs_alpha_small) oooooooooooo oooooooooooo qnial> EACH isstring (2 12 reshape chrs_alpha_small) llllllllllll llllllllllll >> why are chr re-typed as str by reshape? chrs_alpha_small := EACH string 'abcdefghijklmnopqrstuvwxyz' ; % chr_codes 97-122 ; >> IDIOT! ALL "chrs" data should be renamed as chrStrL! eg. chrs_alpha_small -> chrStrL_alpha_small qnial> chrL := EACH first chrs_alpha_small abcdefghijklmnopqrstuvwxyz qnial> itm_posnAInTop_ary 'l' (2 12 reshape chrs_alpha_small) +----+ |0 11| +----+ qnial> ary_idx_to_slc (2 12 reshape chrs_alpha_small) (1 11) [1, 11] qnial> ary_idx_getAllSlc (2 12 reshape chrs_alpha_small) (1 11) +-------+------+ |[ , 11]|[1, ]| +-------+------+ qnial> ary_itm_getAllSlc (2 12 reshape chrs_alpha_small) 'x' +----------------+ |+-------+------+| ||[ , 11]|[1, ]|| |+-------+------+| +----------------+ >> OK - triith solitary of overall result - because only once instance of 'w' found 08********08 #] 29Jun2022 ary_chk_itm_getAllSlc_testSimple optr change : +.....+ ary_compatible_itm IS OP ary itm { LOCAL faultL ; faultL := null ; IF (= null ary) THEN faultL := link faultL (fault '?itmca1') ; ELSEIF (isAtm ary) THEN faultL := link faultL (fault '?itmca2') ; ENDIF ; IF (= null faultL) THEN faultL := l ELSE faultL ENDIF } +.....+ To : +.....+ +.....+ remove : IF (= null itm) THEN faultL := link faultL (fault '?itmca1') ; ENDIF ; >> an itm can be a null!! optr change : +.....+ ary_itm_getAllSlc IS OP ary itm { LOCAL i resFltL slcStrLL ; resFltL := itm_posnAInTop_ary itm ary ; IF (NOT ary_hasFaults resFltL) THEN idxL := resFltL ; resFltL := null ; FOR idx WITH idxL DO resFltL := link resFltL (ary_idx_getAllSlc ary idx) ; ENDFOR ; ENDIF ; resFltL } +.....+ To : +.....+ ary_itm_getAllSlc IS OP ary itm { LOCAL i resFltL slcStrLL ; resFltL := itm_posnAInTop_ary itm ary ; IF (NOT ary_hasFaults resFltL) THEN idxL := resFltL ; resFltL := null ; FOR idx WITH idxL DO resFltL := link resFltL [ary_idx_getAllSlc ary idx] ; ENDFOR ; ENDIF ; resFltL } 08********08 #] 29Jun2022 ary_chk_idx_getAllSlc_testSimple ary_idx_getAllSlc change : +.....+ ary_idx_getAllSlc IS OP ary idx { LOCAL aryShp i idxBas idxShp resFltL ; resFltL := null ; IF (OR [isAtm, isLst] idx) THEN resFltL := ary_idx_to_slc ary idx ; ELSE aryShp := gage shape ary ; idxBas := aryShp reshape [null] ; idxShp := gage shape idx ; IF (= aryShp idxShp) THEN resFltL := [EACH solitary idx] ; ELSE FOR i WITH (tell (aryShp - idxShp + 1)) DO iL := i + (tell idxShp) ; resFltL := link resFltL [placeall (idx iL) idxBas] ; ENDFOR ; ENDIF ; resFltL := ary_idx_to_slc ary resFltL ; ENDIF ; resFltL } .....+ To : +.....+ ary_idx_getAllSlc IS OP ary idx { LOCAL aryShp axs idxTmp resFltL ; IF flag_break THEN BREAK ; ENDIF ; resFltL := null ; IF (isAtm idx) THEN resFltL := ary_idx_to_slc ary idx ; ELSE FOR axs WITH (tell (gage shape idx)) DO idxTmp := idx ; idxTmp@axs := null ; resFltL := link resFltL [idxTmp] ; ENDFOR ; resFltL := ary EACHRIGHT ary_idx_to_slc resFltL ; ENDIF ; resFltL } +.....+ ary_compatible_idx change : +.....+ ELSEIF (NAND (EACH isInteger (ary_to_atmL idx))) +.....+ To : +.....+ ELSEIF (NAND (EACH isInteger idx)) +.....+ qnial> ary_idx_getAllSlc (3 4 reshape (tell 20)) (0 3) [0, 3] >> wrong optr change : +.....+ IF (OR [isAtm, isLst] idx) THEN resFltL := ary_idx_to_slc ary idx ; ... FOR axs WITH (tell aryShp) DO +.....+ To : +.....+ IF (isAtm idx) THEN resFltL := ary_idx_to_slc ary idx ; ... FOR axs WITH (tell (gage shape idx)) DO +.....+ -->[nextv] ary idx +---------+---+ |0 1 2 3|0 3| |4 5 6 7| | |8 9 10 11| | +---------+---+ ?.. Resfltl := Ary EACHRIGHT ary_idx_to_slc Resfltl -->[nextv] +----+----+ |[ 3]|[0,]| +----+----+ >> close, but missing comma after first idx (null) must modify ary_idx_to_slc to handle nulls! >> key lines - ouch, this is going to be a headache : slc@axis := link (' ' EACHRIGHT link (EACH string idx@axis)) ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; optr change : +.....+ ary_idx_to_slc IS OP ary idx { LOCAL axis faultL slc ; % ; faultL := null ; IF (isAtm idx) THEN slc := string idx ; slc := link '[' (front link (slc EACHLEFT link ',')) ']' ; ELSE slc := (valence ary) reshape [null] ; FOR axis WITH (tell valence ary) DO slc@axis := link (' ' EACHRIGHT link (EACH string idx@axis)) ; ENDFOR ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; ENDIF ; % ; IF (= null faultL) THEN slc ELSE faultL ENDIF } +.....+ To : +.....+ ary_idx_to_slc IS OP ary idx { LOCAL axis faultL slc ; % ; faultL := null ; IF (isAtm idx) THEN slc := string idx ; slc := link '[' (front link (slc EACHLEFT link ',')) ']' ; ELSE slc := (valence ary) reshape [null] ; FOR axis WITH (tell valence ary) DO IF (= null idx@axis) THEN slc@axis := link (' ' EACHRIGHT link ' ') ; ELSE slc@axis := link (' ' EACHRIGHT link (string idx@axis)) ; ENDIF ; ENDFOR ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; ENDIF ; % ; IF (= null faultL) THEN slc ELSE faultL ENDIF } +.....+ qnial> ary_idx_getAllSlc (3 4 reshape (tell 20)) (0 3) +------+------+ |[ , 3]|[0, ]| +------+------+ >> good! except now will have a problem with [ary_compatible_idx, ary_chk_idxA_apply_optrPhr, etc] qnial> tstOptr "ary_chk_idx_getAllSlc_testSimple o ary_chk_idx_getAllSlc_testSimple 20 20 24 ary_compatible_idx change : +.....+ ELSEIF (NAND (EACH isInteger idx)) THEN faultL := link faultL (fault '?ixca8') ; +.....+ To : +.....+ ELSEIF (NAND (OR (EACH isInteger idx) (null EACHRIGHT = idx))) THEN faultL := link faultL (fault '?ixca8') ; +.....+ fonn qnial> ary_chk_idx_apply_optrPhr 4 4 "ary_idx_getAllSlc ?ixca2 >> OK One remaining problem : +--+------------+---------------+---------------+ | o|ary04_idxL |?ixca14 |+------+------+| | | | ||[ , 5]|[4, ]|| | | | |+------+------+| +--+------------+---------------+---------------+ ary_compatible_idx remove because redundant? : +.....+ ELSEIF (AND (isAtm idx) (~= 1 aryVlc)) THEN faultL := link faultL (fault '?ixca13') ; +.....+ To : +.....+ +.....+ qnial> tstOptr "ary_chk_idx_getAllSlc_testSimple o ary_chk_idx_getAllSlc_testSimple 0 24 24 >> OUCH! now nothing works, take a break optr change : +.....+ ELSEIF (OR (aryShp EACHBOTH < idxShp)) +.....+ To : +.....+ ELSEIF (OR (aryShp EACHBOTH < idx)) +.....+ >> OK Still the same remaining problem : +--+------------+---------------+---------------+ | o|ary04_idxL |?ixca14 |+------+------+| | | | ||[ , 5]|[4, ]|| | | | |+------+------+| +--+------------+---------------+---------------+ qnial> ary_idx_getAllSlc (4 5 reshape (tell 30)) (4 5) +------+------+ |[ , 5]|[4, ]| +------+------+ >> wrong, but works because no checks applied qnial> ary_chk_idx_getAllSlc (4 5 reshape (tell 30)) (4 5) +------+------+ |[ , 5]|[4, ]| +------+------+ >> wrong - checks FAILED?!? ary_compatible_idx change : +.....+ ELSEIF (OR (aryShp EACHBOTH < idx)) +.....+ To : +.....+ ELSEIF (OR (aryShp EACHBOTH <= idx)) +.....+ +-----+ olde code ary_idx_getAllSlc : ELSEIF (NAND (isLst idx) (= 1 (gage shape idx))) THEN resFltL := ary_idx_to_slc ary idx ; 08********08 #] 28Jun2022 webPage : QNial address [idx, slc] usage see '/media/bill/Dell2/Website - raw/Qnial/Manuals/Howell QNial address [idx, slc] usage notes.html' 08********08 #] 27Jun2022 ary_slc_to_idxA - what happens with a single? qnial> slc o---+ |5 6| +---+ qnial> ary := (4 5 reshape (tell 30)) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 qnial> ary_slc_to_idxA ary slc o-------+ |?noexpr| +-------+ qnial> ary_slc_to_idxA ary (first slc) o-------+ |?noexpr| +-------+ qnial> ary_slc_to_idxA ary (solitary first slc) o-------+ |?noexpr| +-------+ Crap - how do I retrieve the contents of a single? QNial Dictionary v7 : first single A = A >> first should work?!??? IDIOT! a slice is a string, not an idx!! In the context of the tests, a single idx should be converted? qnial> slc := '[ 1, 3]' [ 1, 3] qnial> idx := ary_slc_to_idxA ary slc o---+ |1 3| +---+ qnial> ary@idx ?address qnial> ary@(idx) ?address qnial> ary@(first idx) 8 Change to : ary_slc_to_idxA IS OP ary slc { LOCAL idx ; idx := cart EACH execute (`, itm_cut_ary (front rest slc)) ; IF (isSingle idx) THEN idx := [first idx] ; ENDIF ; idx } qnial> ary_slc_to_idxA ary slc +---+ |1 3| +---+ >> good! I'm going to have a prro. [single, solitary] idx, and category-theory like circular tests 08********08 #] 25Jun2022 I created ary_chk_compatible_slc_testSimple adapted tests from ary_chk_compatible_idx_testSimple qnial> tstOptr "ary_chk_compatible_slc_testSimple o ary_chk_compatible_slc_testSimple 20 32 30 temporarily remove conditional in ary_compatible_slc : % this test has to be fixed!! pass of previous test ms slc has right chrs ; % it will never fire until [replace [comma, space], execute] slc to test ; %ELSEIF (OR [isSolitary, aryTop_hasSolitary] (front rest slc)) THEN resFltL := link resFltL (fault '?slca9') ; qnial> tstOptr "ary_chk_compatible_slc_testSimple o ary_chk_compatible_slc_testSimple 28 30 31 OOPS!? ary_compatible_slc change : IF (OR ((gage shape ary) EACHBOTH < maxIdxL)) >> nyet- should be OK as is qnial> tstOptr "ary_chk_compatible_slc_testSimple o ary_chk_compatible_slc_testSimple 28 30 31 >> Works - other than problem with : ?slca9 - (OR [isSolitary, aryTop_hasSolitary] (front rest slc)) +-----+ Retry qnial> tstOptr "ary_chk_slc_to_idx_testSimple o ary_chk_slc_to_idx_testSimple 15 20 24 arySlc doesn't work! +--+-------------+-------------+-------------+ | o|intA01_slc |+---+---+ |1 2 | | | ||1 3|2 3| | | | | |+---+---+ | | +--+-------------+-------------+-------------+ "intA01_slc (4 5 reshape (tell 30)) '[ 1 3, 2 3]' ((1 3) (2 3)) 'should be OK, interesting case : non-sequential indices!' >> should be OK ary_chk_slc_to_idx should be called : ary_chk_slc_to_idxA do examples : qnial> ary := (4 5 reshape (tell 30)) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 qnial> ary|[ 1, 3] 8 qnial> ary|[ 2 3, 1 2] 11 12 16 17 >> works great to retrieve contents from ary, but those aren't indices!!! qnial> slc := '[ 1, 3]' [ 1, 3] qnial> `, itm_cut_ary (front rest slc) +--+--+ | 1| 3| +--+--+ I created a test for singles, but may not need it? check slcL -> should yield idxL slc ary_slc_to_idxA IS OP ary slc - convert idxA to slc # 25Jun2022 initial ary_slc_to_idxA IS OP ary slc { cart EACH execute (`, itm_cut_ary (front rest slc)) } # development tests : qnial> ary := (4 5 reshape (tell 30)) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 qnial> ary|[ 1, 3] 8 qnial> ary|[ 2 3, 1 2] 11 12 16 17 qnial> slc := '[ 1, 3]' [ 1, 3] qnial> `, itm_cut_ary (front rest slc) +--+--+ | 1| 3| +--+--+ qnial> execute ' 1 2' 1 2 # ary_slc_to_idxA ary slc qnial> a := ary_slc_to_idxA ary slc o---+ |1 3| +---+ qnial> isSolitary a o qnial> isSingle a ?undefined identifier: ISSIGLETON <***> A The operation single returns an array with no axes holding A as its only item. The result is an array with shape Null and is said to be a single. Equations first single A = A shape single A = Null atomic A = single A equal A EACH f single A = single f A A EACHLEFT f B = A EACHBOTH f single B A EACHRIGHT f B = single A EACHBOTH f B # qnial> isSolitary [6] l >> OK, good that it's a single, so how to handle? (I don't have a test) >> I cooked up one, not sure if it's good qnial> a := cart 5 6 o---+ |5 6| +---+ qnial> first a 5 6 # if it's a singleton - only one idx result # qnial> slc2 := '[ 2 3, 1 2]' [ 2 3, 1 2] qnial> ary_slc_to_idxA ary slc2 +---+---+ |2 1|2 2| +---+---+ |3 1|3 2| +---+---+ 08********08 #] 24Jun2022 ary_chk_compatible_idx_testSimple works - fix other slice tests ary_slice_groupTest : "ary_chk_compatible_idx_testSimple "ary_chk_idx_getAllSlc_testSimple "ary_chk_itm_getAllSlc_testSimple "ary_chk_itm_getAllSlc_to_itm_testSimple "ary_chk_idx_to_slc_testSimple "ary_chk_idxA_to_slc_testSimple "ary_chk_slc_to_idx_testSimple "ary_chk_sub_getAllSlc_testSimple "sub_chk_idx_to_slc_testSimple "ary_invert_slc_testSimple "ary_invert_slcA_testSimple +-----+ qnial> tstOptr "ary_chk_idx_to_slc_testSimple o ary_chk_idx_to_slc_testSimple 6 34 27 ary_chk_idx_apply_optrPhr change : +.....+ resFltL := ary_compatible_idx (gage shape ary) idx ; % true if compatible, fault if not ; +.....+ To : +.....+ resFltL := ary_compatible_idx ary idx ; % true if compatible, fault if not ; +.....+ qnial> tstOptr "ary_chk_idx_to_slc_testSimple o ary_chk_idx_to_slc_testSimple 19 22 27 fixed? : | o|lst02_atm |?ixca6 |?ixca8 | | o|lst01_idxL | 3|?ixca9 | | o|lstL02_idxL |?ixca8 |?ixca9 | >> but is fault well-expressed? | o|ary01_idxAtm|?ixca6 |?ixca12 | failed slcL results (I had modified the optr) : +--+------------+-------------+---------------------+ | o|ary05_idx |[ 2, 3] |[,,,,,,,,,,,,,,,,,,,]| +--+------------+-------------+---------------------+ | o|ary06_idx |[ 1, 3] |[,,,,,,,,,,,,,,,,,,,]| +--+------------+-------------+---------------------+ | o|ary01_idxL |[ 1 3, 2 3] |[,,,,,,,,,,,,,,,,,,,]| +--+------------+-------------+---------------------+ | o|ary03_idxL |[ 2 3, 1 2] |[,,,,,,,,,,,,,,,,,,,]| +--+------------+-------------+---------------------+ qnial> ary_idx_to_slc (4 5 reshape (tell 30)) (2 3) [,,,,,,,,,,,,,,,,,,] ary_idx_to_slc change : +.....+ ary_idx_to_slc IS OP ary idx { LOCAL axis faultL slc ; % ; faultL := null ; IF (isAtm idx) THEN slc := string idx ; slc := link '[' (front link (slc EACHLEFT link ',')) ']' ; ELSE slc := (gage shape ary) reshape [null] ; FOR axis WITH (tell valence ary) DO slc@axis := link (' ' EACHRIGHT link (EACH string idx@axis)) ; ENDFOR ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; ENDIF ; % ; IF (= null faultL) THEN slc ELSE faultL ENDIF } +.....+ To : +.....+ ary_idx_to_slc IS OP ary idx { LOCAL axis faultL slc ; % ; faultL := null ; IF (isAtm idx) THEN slc := string idx ; slc := link '[' (front link (slc EACHLEFT link ',')) ']' ; ELSE slc := (valence ary) reshape [null] ; FOR axis WITH (tell valence ary) DO slc@axis := link (' ' EACHRIGHT link (EACH string idx@axis)) ; ENDFOR ; slc := link link '[' (rest front link (slc EACHLEFT link ',')) ']' ; ENDIF ; % ; IF (= null faultL) THEN slc ELSE faultL ENDIF } +.....+ qnial> ary_idx_to_slc (4 5 reshape (tell 30)) (2 3) [2, 3] >> OK qnial> tstOptr "ary_chk_idx_to_slc_testSimple l ary_chk_idx_to_slc_testSimple 27 22 27 >> great!! +-----+ qnial> tstOptr "ary_chk_idxA_to_slc_testSimple o ary_chk_idxA_to_slc_testSimple 7 33 27 >> simple change in format of slc of results >> fault codes messed up >> other problems? qnial> tstOptr "ary_chk_idxA_to_slc_testSimple o ary_chk_idxA_to_slc_testSimple 22 33 27 After many [fix, guess]s : qnial> tstOptr "ary_chk_idxA_to_slc_testSimple l ary_chk_idxA_to_slc_testSimple 27 33 27 >> OK +-----+ qnial> tstOptr "ary_chk_slc_to_idx_testSimple many changes to tests qnial> tstOptr "ary_chk_slc_to_idx_testSimple o ary_chk_slc_to_idx_testSimple 3 18 24 >> yuch, horrible 08********08 #] 24Jun2022 problem with [ary, itm, sub] = null again, try examples directly with ary_chk_idx_to_slc, then see if tstOptr screws them up qnial> ary_chk_idx_to_slc null null ?ixca2 ?ixca6 >> same problem, but doesn't use tstOptr Work FIRST with ary_compatible_idx fonn qnial> ary_compatible_idx null null ?ixca1 ?ixca6 >> Works! qnial> tstOptr "ary_chk_compatible_idx_testSimple | o|null01_null |?ixca1 ?ixca6|?ixca2 ?ixca6| >> DOESN'T work!? qnial> tstOptr "ary_chk_compatible_idx_testSimple in tstSimple : ?.. Calcl := Optrphr EACHRIGHT apply ( rows transpose mix Datcols ) -->[nextv] +-------------+------+-------------+-------------+------+-------------+-------------+-------------+------+---- |?ixca2 ?ixca6|?ixca2|?ixca1 ?ixca6|?ixca1 ?ixca8|?ixca1|?ixca2 ?ixca6|?ixca2 ?ixca8|?ixca2 ?ixca8|?ixca2|?ixc +-------------+------+-------------+-------------+------+-------------+-------------+-------------+------+---- ..~.. --+------+-------------+------+------+------+-------------+-------+-------+-------+------+-------+------+----- a2|?ixca2|?ixca2 ?ixca9|?ixca2|?ixca2|?ixca2|?ixca2 ?ixca9|?ixca12|?ixca12|?ixca12|?ixca9|?ixca12|?ixca9|?ixca --+------+-------------+------+------+------+-------------+-------+-------+-------+------+-------+------+----- ..~.. --+------+------+------+------+ 12|?ixca7|?ixca7|?ixca7|?ixca7| --+------+------+------+------+ >> Ah hah! not first test null null -> ?ixca2 ?ixca6, rather than ?ixca1 ?ixca6 ?> why? first data null null : -->[nextv] rows transpose mix datCols +---+ |+++| |||||... |+++| +---+ -->[nextv] optrPhr ary_chk_compatible_idx -->[nextv] optrPhr apply (null null) ?ixca2 ?ixca6 >> Ah hah! -->[nextv] optrPhr apply ([null] [null]) ?ixca2 ?ixca9 -->[nextv] ary_chk_compatible_idx (null null) ?ixca2 ?ixca6 -->[nextv] ary_compatible_idx null null ?ixca1 ?ixca6 >> OK - so the problem is ary_chk_compatible_idx in 'arrays- testOptrs.ndf' ary_chk_compatible_idx IS OP ary idx { ary_chk_idx_apply_optrPhr ary idx "ary_compatible_idx } ary_chk_idx_apply_optrPhr IS OP ary idx optrPhr { LOCAL resFltL ; resFltL := ary_compatible_idx (gage shape ary) idx ; % true if compatible, fault if not ; IF (NOT ary_hasFaults resFltL) THEN resFltL := apply optrPhr (ary idx) ; ENDIF ; resFltL } OOPS!! self-referent Try : ary_chk_compatible_idx IS OP ary idx { ary_compatible_idx ary idx } >> OK, much improved ?ixca12 return for all examples that should have valid non-error result error instead of non-error result? #? ary_compatible_idx '?ixca12' (~= aryVlc idxVlc) ary_compatible_idx change : +.....+ IF (~= aryVlc idxVlc) THEN faultL := link faultL (fault '?ixca12') ; +.....+ To : +.....+ IF (~= aryVlc (gage shape idx)) THEN faultL := link faultL (fault '?ixca12') ; +.....+ qnial> tstOptr "ary_chk_compatible_idx_testSimple o ary_chk_compatible_idx_testSimple 13 32 27 >> oops, worse qnial> gage shape null 0 >> may be the problem? ary_compatible_idx change : +.....+ aryVlc idxVlc := EACH valence idx ary ; aryShp idxShp := EACH (gage shape) ary idx ; ELSEIF (OR (ary EACHBOTH < idx)) THEN faultL := link faultL (fault '?ixca14') ; +.....+ To : +.....+ aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; ELSEIF (OR (aryShp EACHBOTH < idxShp)) THEN faultL := link faultL (fault '?ixca14') ; +.....+ qnial> tstOptr "ary_chk_compatible_idx_testSimple o ary_chk_compatible_idx_testSimple 20 28 27 >> Ah, much better! reomove leftovers from aryShp version : ELSEIF (NAND (EACH isInteger (ary_to_atmL idx))) THEN faultL := link faultL (fault '?ixca3') ; #? ary_compatible_idx '?ixca3' nonInteger atms in ary Interesting case - idx as atm generates error : "lst01_idxAtm 'the bigg fat cow' 4 l 'should be OK, note isLst result, no space before isAtm idx' Update results after changes : -->[stepv] resume o ary_chk_compatible_idx_testSimple 22 26 27 Remainder are ALL cases of isInteger idx : +--+------------+-------------+-------------+ | o|lst01_idxAtm| l|?ixca12 | +--+------------+-------------+-------------+ | o|lst02_idxAtm| l|?ixca12 | +--+------------+-------------+-------------+ | o|lst03_idxAtm| l|?ixca12 | +--+------------+-------------+-------------+ | o|lstL01_idx | l|?ixca12 | +--+------------+-------------+-------------+ ary_compatible_idx change : +.....+ aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; +.....+ To : +.....+ aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; IF (= null idxShp) THEN idxShp := 1 ; ENDIF ; +.....+ Update results after changes : qnial> tstOptr "ary_chk_compatible_idx_testSimple o ary_chk_compatible_idx_testSimple 26 22 27 o|lst01_atm |? i x c a 8 |?ixca8 | >> weird 'arrays- testOptrs.ndf' change : +.....+ (EACH fault '?ixca8') +.....+ To : +.....+ [fault '?ixca8'] +.....+ qnial> tstOptr "ary_chk_compatible_idx_testSimple l ary_chk_compatible_idx_testSimple 27 22 27 >> AWESOME! 08********08 #] 23Jun2022 ary_chk_slc_to_idx_testSimple ary_chk_slc_to_idx change : +.....+ { ary_chk_slc_to_idx_apply_optrPhr (gage shape ary) slc "aryShp_slc_to_idx } +.....+ To : +.....+ { ary_chk_slc_to_idx_apply_optrPhr ary slc "aryShp_slc_to_idx } +.....+ 'types.ndf' aryShp_compatible_idx probelem with [nullr, atmr] : mostly?ixca2 - prevents good results try examples directly with ary_chk_idx_to_slc, then see if tstOptr screws them up qnial> ary_chk_idx_to_slc null null ?ixca2 ?ixca6 >> same problem as via tstOptr flag_break aryShp_idx_to_slc NUTS!!! arg reversal AND ary[, Shp] mixup optr change : +.....+ ary_chk_slc_to_idx_apply_optrPhr IS OP ary slc optrPhr { LOCAL resFltL ; resFltL := aryShp_compatible_slc slc (gage shape ary) ; % true if compatible, fault if not ; IF resFltL THEN resFltL := apply optrPhr (ary slc) ; ENDIF ; resFltL } +.....+ To : +.....+ ary_chk_slc_to_idx_apply_optrPhr IS OP ary slc optrPhr { LOCAL resFltL ; resFltL := aryShp_compatible_slc slc ; % true if compatible, fault if not ; IF resFltL THEN resFltL := apply optrPhr (ary slc) ; ENDIF ; resFltL } +.....+ Change to : ary_chk_idx_to_slc IS OP ary idx { ary_chk_idx_apply_optrPhr ary idx "aryShp_idx_to_slc } Also - same change to other ch qnial> tstOptr "ary_chk_idx_to_slc_testSimple o ary_chk_idx_to_slc_testSimple 12 28 27 >> no correct answers work, many problems with errors too optr change : +.....+ ary_chk_idx_apply_optrPhr IS OP ary idx optrPhr { LOCAL resFltL ; resFltL := aryShp_compatible_idx (gage shape ary) idx ; % true if compatible, fault if not ; IF (NOT ary_hasFaults resFltL) THEN resFltL := apply optrPhr (ary idx) ; ENDIF ; resFltL } +.....+ To : +.....+ ary_chk_idx_apply_optrPhr IS OP ary idx optrPhr { LOCAL resFltL ; aryShp := gage shape ary ; resFltL := aryShp_compatible_idx aryShp idx ; % true if compatible, fault if not ; IF (NOT ary_hasFaults resFltL) THEN resFltL := apply optrPhr (aryShp idx) ; ENDIF ; resFltL } +.....+ Nuts!! easst to change aryShp optrs to ary in arrays.ndf!!! (all that work wasted!) 08********08 #] 23Jun2022 ary_chk_... - REVERSE my recent changes (oops) : In 'arrays- testOptrs.ndf' ary_chk_slc_to_idx change : +.....+ { ary_chk_slc_to_idx_apply_optrPhr (gage shape ary) slc "aryShp_slc_to_idx } +.....+ To : +.....+ { ary_chk_slc_to_idx_apply_optrPhr ary slc "aryShp_slc_to_idx } +.....+ Same thing for [ary_chk_idx_getAllSlc, ary_chk_idx_to_slc, ary_chk_idxA_to_slc, ary_chk_slc_to_idx] Were OK : [ary_chk_compatible_idx, ary_chk_itm_getAllSlc, ary_chk_sub_getAllSlc, ary_chk_itm_getAllSlc_to_itm, sub_chk_idx_to_slc] ary_chk_idx_apply_optrPhr IS OP ary idx optrPhr { LOCAL resFltL ; resFltL := aryShp_compatible_itmShp (gage shape ary) idx ; % true if compatible, fault if not ; IF (NOT ary_hasFaults resFltL) THEN resFltL := apply optrPhr (ary idx) ; ENDIF ; resFltL } change to : resFltL := aryShp_compatible_idx (gage shape ary) idx ; % true if compatible, fault if not ; 08********08 #] 22Jun2022 get rid of "strip" (now use cut or create cutCat) +-----+ olde code ary_strip_itm IS OP ary itm - remove itm from ary, standard QNial library ary_strip_slc IS OP ary slcL - remove slcL from an array (22Nov2021 not [finished, tested]) ary_strip_sub IS OP ary sub - removes sub from ary IF flag_debug THEN write 'loading ary_strip_itm' ; ENDIF ; #] ary_strip_itm IS OP ary itm - remove itm from ary, standard QNial library # 04Nov2021 initial from strings.ndf (~identical) ary_strip_itm IS OP ary itm { lst1 := (NOT (itm match ary )) sublist ary ; (NOT (itm match lst1)) sublist lst1 } IF flag_debug THEN write 'loading ary_strip_slc' ; ENDIF ; #] ary_strip_slc IS OP ary slcL - remove slcL from an array (22Nov2021 not [finished, tested]) # 04Nov2021 initial from strings.ndf (~identical) # 11Nov2021 revamped for arys, not ready! must calculate "opposite of slc" to remove it!!! ary_strip_slc IS OP ary slcL { ary|[aryShp_invert_slc ary slcL] } IF flag_debug THEN write 'loading ary_strip_sub' ; ENDIF ; #] ary_strip_sub IS OP ary sub - removes sub from ary # 04Nov2021 initial from strings.ndf (~identical) ary_strip_sub IS OP ary sub { LOCAL idxs len subbies ; len := gage shape sub ; subbies := (gage shape ary) reshape l ; idxs := link sub_posnAAllItmInTop_ary sub ary ; subbies#idxs := o ; subbies sublist ary } # 28Nov2021 qnial> ary_strip_sub '[#=; backtrack ;=#]Howell - Mega-Life, Mega-Death and the Sun, the rise and fall of civilisations.pdf' '[#=; backtrack ;=#]' Howell - Mega-Life, Mega-Death and the Sun, the rise and fall of civilisations.pdf qnial> ary_strip_sub '[#=; backtrack ;=#]Howell - Mega-Life[#=; backtrack ;=#], Mega-Death and the Sun, the rise and fall of civilisations.pdf[#=; backtrack ;=#]' '[#=; backtrack ;=#]' Howell - Mega-Life, Mega-Death and the Sun, the rise and fall of civilisations.pdf 08********08 #] 07Jun2022 ary_restruct_groupTest the results table columns all mixed - check each test returns 5 items might be due to miss-named optrs : optr change : +.....+ ary_restruct_groupTest := "d_arrayTests ( "aryA_join_vertical_testSpecial "aryA_join_horizontal_testSpecial "ary_to_atmL_testSimple "ary_replaceAllAtmWith_atm_testSimple "aryPL_transStr_isSameStruct_testSimple ) ( 'not ready yet : ' '07Apr2022 most optr tests not created yet' ) ; +.....+ To : +.....+ ary_restruct_groupTest := "d_arrayTests ( "aryA_catVertical_testSpecial "aryA_catHorizontal_testSpecial "ary_to_atmL_testSimple "ary_replaceAllAtmWith_atm_testSimple "aryPL_transStr_isSameStruct_testSimple ) ( 'not ready yet : ' '07Apr2022 most optr tests not created yet' ) ; +.....+ qnial> groupTest "ary_restruct_groupTest l ary_restruct_groupTest 40 0 40 >> bingo same thing with : ary_split_groupTest := "d_arrayTests ( "sub_splitSeparate_ary_testSimple "sub_splitSeparate_ary_testStd "sub_splitAtEnd_ary_testStd "sub_splitAtEnd_ary_testSimple "sub_splitAtFront_ary_testStd "sub_splitAtFront_ary_testSimple "subL_splitSeparate_ary_testSimple "subL_splitAtEnd_ary_testSimple "subL_splitAtFront_ary_testSimple "ary_subP_splitSeparateTo_midIndxs_subL_testSimple "ary_subL_getLenMatchesTo_subPL_testSimple ) ( 'not ready yet : ' 'all are included' ) ; >> nope, optr names are all OK So what is the problem? ?type error in fault : "sub_splitAtEnd_ary_testStd "sub_splitAtFront_ary_testStd looks like tstStandard not working? check other tstStandards in 'arrays- testGroupsCluster.ndf' ary_isIn_groupTest - not defined in 'arrays- testGroupsCluster.ndf' 'types.ndf' [atm, itm, sub][,Any]in - returns a list of booleans according to shape of ary : 02Dec2021 missing slc aryPL_checkIs IS OP aryPairL - check if aryPL is a list of pairs, each pair is two arys atm_inTop_ary IS OP atmTop ary - boolean indication of whether atom is in first-level-only of ary atmA_anyInTop_ary IS OP atmA ary - boolean indication of whether any of atmATop are in strA atmA_anyInTop2_ary IS OP atm ary - boolean indication of whether any of atmA are in ary will not match for nested parts of [atmTop, str]A - need a different optr, or upgrade this one itm_inTop_ary IS OP atm ary - boolean indication of whether item is in first-level-only of ary itmA_anyInTop_ary IS OP itmA ary - boolean indication of whether any of atmATop are in ary because itmA_anyIn_ary does NOT use grep, it easily handles '$.*/[\]^' characters, sub_inTop_ary IS OP sub ary - won't work with null [sub, ary], isAtm ary subL_anyInTop_ary IS OP subL ary - returns true if ANY of subL are in ary 'types- testOptrs.ndf' ********************* loaddefs link d_Qtest 'types/types- testOptrs.ndf' +-----+ [is, check] tests : (24Nov2021 no formal tests yet - just in ndf files) ary_shape_sub_testSimple := - reshape sub to make it compatible with ary sub_compatible_ary_testStd := - see if sub can "fit into" ary +-----+ inTop_ary of [atm, str, lst, aryS][,Any] : sub_inTop_ary_testStd := - returns list of Substr positions in Str, or an error subL_anyInTop_ary_testSimple := - returns true if ANY of subStrL are in str (types.ndf) indx_compatible_ary_testSimple := - does indx "fit" ar? So ary_isIn_groupTest : remove from 'arrays- testGroupsCluster.ndf' include in 'types- testOptrs.ndf' qnial> groupTest "ary_isIn_groupTest o ary_isIn_groupTest 20 47 80 >> works, but bad results : +--+------------------------------+-------+------+-----+ |OK|test (optr) |correct|faults|total| +--+------------------------------+-------+------+-----+ | o|ary_shape_sub_testSimple | 0| 10| 10| all are ?not an operation, +--+------------------------------+-------+------+-----+ moved to 'arrays- testOptrs.ndf' | o|sub_compatible_ary_testStd | 0| 27| 27| all are ?not an operation +--+------------------------------+-------+------+-----+ | o|sub_inTop_ary_testStd | 16| 0| 27| mediocre results, but runs +--+------------------------------+-------+------+-----+ | o|subL_anyInTop_ary_testSimple | 4| 0| 6| mediocre results, but runs +--+------------------------------+-------+------+-----+ | o|indx_compatible_ary_testSimple| 0| 10| 10| all are ?not an operation +--+------------------------------+-------+------+-----+ 08********08 #] 04Jun2022 restart work with ary_replaceAllAtmWith_atm is the old atm_restructSameAs_ary?? ary_restruct_groupTest log.txt - must get this to work first, because used in other optrs? Obviously I changed something in my most recent work, so nothing is working Array restructure [to,from] cart [atm, str, lst, ary] : aryA_catVertical_testSpecial IS - aryA_catHorizontal_testSpecial IS - ary_to_atmL_testSimple := - convert the simple ary (non-nested) to a list of atoms ary_replaceAllAtmWith_atm_testSimple := - build new array by replacing all atoms of ary with atm aryPL_transStr_isSameStruct_testSimple := - use different transformers with the same test data for comparison of ary structures 08********08 #] 12Apr2022 fix atm_restructSameAs_ary atm_restructSameAs_ary change : +.....+ ELSE EACH atm_restructSameAs_ary (cart atm [ary]) +.....+ To : +.....+ ELSE atm EACHRIGHT atm_restructSameAs_ary ary +.....+ >> OK, works add errors for nulls, maybe isAtm ary? ?? YIKES!! two definitions!!! I removed older defn : +-----+ IF flag_debug THEN write 'loading sub_inTop_ary' ; ENDIF ; #] sub_inTop_ary IS OP sub ary - true if sub is in aryS (simply array) #] 09Nov2021 this looks very inefficient! (don't know if it works yet) # 04Nov2021 initial from strings.ndf (~identical) # 09Nov2021 ary version - lets see how hard this is - use valence and FOR loops to start sub_inTop_ary IS OP sub ary { LOCAL resFltL ; resFltL := sub_posnA1stItmInTop_ary sub ary ; IF (= null resFltL) THEN o ELSEIF (OR (faultSelect := EACH isfault resFltL)) THEN resFltL := faultSelect sublist resFltL ; ELSE l ENDIF } +-----+ # olde list.ndf code # 04Nov2021 initial from strings.ndf (~identical) sub_in_lst IS OP sub lst { LOCAL flag_in len_sub len_lst i_lst i_sub ; len_sub := gage shape sub ; len_lst := gage shape lst ; flag_in i_lst i_sub := o 0 0 ; WHILE (i_lst < len_lst) DO WHILE (AND ((i_sub + i_lst) < len_lst) (i_sub < len_sub) (= sub@i_sub lst@(i_lst + i_sub)) ) DO i_sub := i_sub + 1 ; ENDWHILE ; IF (= i_sub len_sub) THEN flag_in := l ; EXIT 'done' ; ELSE flag_in := o ENDIF ; i_lst := i_lst + 1 ; i_sub := 0 ; ENDWHILE ; flag_in } 08********08 #] 11Apr2022 sub_posnAAllItmInTop_ary olde code # olde code shapeAryL := gage shape aryL ; subPosns := sub_posnAAllItmInTop_ary subL aryL ; # Other code for comparison : sub_posnAAllItmInTop_ary IS OP sub ary { LOCAL aryPoint aryPointL faultL resultL subr subVolume ; IF flag_break THEN BREAK ; ENDIF ; faultL resultL := null null ; resFltL := sub_posnA1stItmInTop_ary sub ary ; IF (ary_checkIfAnyFaults resFltL) THEN faultL := resFltL ; ELSE aryPointL := resFltL ; ENDIF ; % ; % this was already done by sub_posnA1stItmInTop_ary, should avoid this second calc somehow ; IF (= null faultL) THEN subr := sub_checkFitIntoTop_ary sub ary ; % only one fault can come from sub_checkFitIntoTop_ary? ; IF (isfault subr) THEN faultL := subr ; ENDIF ; ENDIF ; % ; % ??? wrong - Y axis of shape 1 will be a problem!!!? ; IF (= null faultL) THEN subVolume := tell (gage shape subr) ; FOR aryPoint WITH aryPointL DO resultL := append resultL (aryPoint EACHRIGHT + subVolume) ; ENDFOR ; ENDIF ; % ; IF (= null faultL) THEN resultL ELSE faultL ENDIF } # olde code - sort of worked IF ((gage shape sub) > (gage shape ary)) THEN [ary] ELSE IF flag_break THEN BREAK ; ENDIF ; IF (isAtm sub) THEN subL := [sub] ; ELSE subL := sub ; ENDIF ; IF (isAtm ary) THEN aryL := [ary] ; ELSE aryL := ary ; ENDIF ; shapeAryL := gage shape aryL ; subPosns := sub_posnAAllItmInTop_ary subL aryL ; IF (= null subPosns) THEN [aryL] ELSE (OR (aryL EACHRIGHT ary_indexA_convertTo_boolA subPosns)) boolA_splitJoin_ary aryL ENDIF ENDIF 08********08 #] 11Feb2022 remove slc as a Long ways from update, change, remove, add] ary operators - just try end-of-day : qnial> loaddefs link d_Qndfs 'arrays.ndf' errors found: 8 INDXL_SLICE_ARY -> now called slc_splitSeparate_ary? >> OK, stuck in ghost optrs that don't work, but at least loaddefs is clean!! +-----+ olde code # IF flag_debug THEN write 'loading slc_splitAtFront_ary' ; ENDIF ; # slc_splitAtFront_ary IS OP slc ary - splits ary at each point that slc occurs # slc in aryLOut combined with next item # 04Nov2021 initial from strings.ndf (~identical) # 11Febv2022 deactivated - just use sub_splitAtFront_ary # IF flag_break THEN BREAK ; ENDIF ; slc_splitAtFront_ary IS OP slc ary { LOCAL i aryL aryL_len aryLOut ; IF flag_break THEN BREAK ; ENDIF ; aryL := slc_splitSeparate_ary slc ary ; shapeAryL := gage shape aryL ; % ouch! - needed for char return of aryL - this will cause other problems!! ; FOR i WITH (tell shapeAryL) DO IF (isAtm aryL@i) THEN aryL@i := [aryL@i] ; ENDIF ; ENDFOR ; aryL_lenLess1 := (gage shape aryL) - 1 ; slcStrIndxL := (slc EACHRIGHT = aryL) sublist (gage shape aryL) ; slcStrIndxL := (NOT (aryL_lenLess1 = slcStrIndxL)) sublist slcStrIndxL ; boolL := ary_indexA_convertTo_boolA ary slcStrIndxL ; boolL boolA_splitJoin_ary aryL } # IF flag_debug THEN write 'loading slc_splitAtEnd_ary' ; ENDIF ; # slc_splitAtEnd_ary IS OP slc ary - split ary where slc occurs, slc @end of each split # 04Nov2021 initial from strings.ndf (~identical) # 11Febv2022 deactivated - just use sub_splitAtEnd_ary slc_splitAtEnd_ary IS OP slc ary { LOCAL i aryL aryL_lenLess1 aryLOut ; aryL := slc_splitSeparate_ary slc ary ; aryL_lenLess1 := (gage shape aryL) - 1 ; aryLOut := null ; i := 0 ; WHILE (i < aryL_lenLess1) DO IF (aryL@i = slc) 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 } # IF flag_debug THEN write 'loading ary_splitLftRgtTo_midIndxs_slcP' ; ENDIF ; # ary_splitLftRgtTo_midIndxs_slcP IS OP ary slcP - split ary, return [indxs, aryL] # by paired [left, right]-end-marks, return [Indxs of mids, aryL] # 02Dec2021 not adpated yet from strings.ndf, then lists.ndf # 11Febv2022 deactivated - just use ary_splitLftRgtTo_midIndxs_subP ary_splitLftRgtTo_midIndxs_slcP IS OP ary slcP { LOCAL i i_heads i_tails midIndxs splits validIndxs ; IF flag_break THEN BREAK ; ENDIF ; aryLft aryRgt := slcP ; splits := link ((slc_splitSeparate_ary ary aryLft) EACHLEFT slc_splitSeparate_ary aryRgt) ; midIndxs := tell (gage shape splits) ; i_heads := (aryLft EACHRIGHT = splits) sublist midIndxs ; i_tails := (aryRgt EACHRIGHT = splits) sublist midIndxs ; IF (OR (null EACHRIGHT = i_heads i_tails)) THEN null (fault '?asrlmislc1') ELSE IF (OR (' OR[i_heads, i_tails] is null' IF flag_debug THEN write 'loading ary_insert_sub' ; ENDIF ; #] ary_insert_sub IS OP ary - creates one aryOut by splitting ary with sub, (19Nov2021 not ready) #] inserting an sub at each place in ary that it occurs #] must find "full slices" of ary containing sub!!! # 02Dec2021 not adapted yet from lst version # Howell: from ary_convertTo_str above # loaddefs 'C:\Documents and Settings\William Neil Howell\My Documents\Qnial\MY_NDFS\strings.ndf' # 14Nov2021 I haven't used DOS for >= a decade, this has been re[name, work]ed many times over the years!! # have to check earlier coce before corruption, and upgrade to ary base # 11Feb2022 ary insertions or replacements MUST be with ary_insert_sub IS OP ary sub { IF OR (valence sub = 0) (isstring sub) THEN string sub ELSE link (link (EACH string (front list sub) EACHLEFT link sub)) (string last list sub) ENDIF } IF flag_debug THEN write 'loading ary_replace_slcP' ; ENDIF ; #] ary_replace_slcP IS OP ary slcP - substitutes slcNew for slcOld in ary #] designed for strings - I haven't generalized it! # www.BillHowell.ca 25Sep05 # 04Nov2021 initial from strings.ndf (~identical) ary_replace_slcP IS OP ary slcP { LOCAL i_ary i_slcOld len_ary len_slcOld textnew ; % ; slcOld slcNew := slcP ; IF (NOT (slcOld = null)) THEN len_slcOld := gage shape slcOld ; len_ary := gage shape ary ; i_ary i_slcOld := 0 0 ; textnew := null ; WHILE (i_ary < len_ary) DO WHILE (AND ( (i_slcOld + i_ary) < len_ary) (i_slcOld < len_slcOld) (= slcOld@i_slcOld ary@(i_ary + i_slcOld) ) ) DO i_slcOld := i_slcOld + 1 ; ENDWHILE ; %write link '[i_ary,i_slcOld]= ' (string i_ary) ', ' (string i_slcOld) ; IF (len_slcOld = i_slcOld) THEN textnew := link textnew slcNew ; i_ary := i_ary + len_slcOld - 1 ; ELSEIF (0 <= i_slcOld) THEN textnew := link textnew ary@i_ary ; ELSE write fault '?slcReplace1' ; ENDIF ; %write textnew ; i_ary := i_ary + 1 ; i_slcOld := 0 ; ENDWHILE ; ELSE textnew := null ; ENDIF ; % ; IF (= null textnew) THEN ary ELSE textnew ENDIF } # fault codes : #? '?slcReplace1' '?ary_replace_slcP: i_slcOld is anomalous' # IF flag_debug THEN write 'loading slcA_axis_slice_ary' ; ENDIF ; # slcA_axis_slice_ary IS OP slc ary - ary is split at each slc of axis (mush at this stage) # I don't think it can work as, in general subArys have diff shapes! # 11Feb2022 careful - concept is useless - only one slice can occur as resultant shapes all over the map slcA_axis_slice_ary IS OP slc ary { LOCAL posnA anti_slices ; anti_slices := ary_invert_slcA ary posnA ; ary|[anti_slices] } 08********08 #] 10Feb2022 QNial start loaddefs - problems with arrays.ndf +--+ >>> loading start : arrays.ndf ?undefined identifier: ANTI_SLICES := ARY_INVERT_SLCINDXA <***> ARY POSNA ; ?undefined identifier: FIRST ( GLOBAL_AXISSPLITL <***> EACHLEFT CHOOSE SUBPOSNL ?undefined identifier: SUB EACHRIGHT SUB_SPLITSEPARATE_ARY <***> ARYA ; NULL ?undefined identifier: ( ( SUB_SPLITSEPARATE_ARY <***> ARYAFT ARY ) ?undefined identifier: ARYL := SLC_SPLITSEPARATE_ARY <***> SLC ARY ; ?undefined identifier: ARYL := SUB_SPLITSEPARATE_ARY <***> SUB ARY ; ?undefined identifier: SUB EACHRIGHT SUB_SPLITATFRONT_ARY <***> ( FIRST ARYA ?undefined identifier: ARYL := SLC_SPLITSEPARATE_ARY <***> SLC ARY ; ?undefined identifier: ARYL := SUB_SPLITSEPARATE_ARY <***> SUB ARY ; ?undefined identifier: SUB EACHRIGHT SUB_SPLITATEND_ARY <***> ( FIRST ARYA ?undefined identifier: ( ( SLC_SPLITSEPARATE_ARY <***> ARY ARYLFT ) ?undefined identifier: ( ( SLC_SPLITSEPARATE_ARY <***> ARY ARYLFT ) <<< loading ended : arrays.ndf errors found: 12 ... >>> loading start : strings.ndf >>>>>> loading start : strings header.ndf <<<<<< loading ended : strings header.ndf ?undefined identifier: STRL := ARY_SUBP_SPLITSEPARATETO_MIDINDXS_SUBL <***> '[#=; ' ' ;=#]' <<< loading ended : strings.ndf errors found: 1 ... ?undefined identifier: USR_WKSPCSYM_STATUS <***> +--+ Oops - now I'm confused, have 2 subdirs in d_Qndfs : QNial [symbol, arg] changes symbols -> OK renamed 'symbols flatliner derivations' do I need 'QNial operator options.ndf'? leave out & see +-----+ 'start_QNial_mySyms.sh' - which files should be loaded at project startup? for now, core [symbol, arg] changes : bash "$d_start"'start_app.sh' "$delay_edt" "editLeft" "$d_symbols" 'QNial symbol notes.txt' bash "$d_start"'start_app.sh' "$delay_edt" "editLeft" "$d_symbols" 'QNial symbol plan.txt' bash "$d_start"'start_app.sh' "$delay_edt" "editor" "$d_symbols" 'QNial symbol changes.ndf' augment at a later date +-----+ Fix current loaddefs errors : ?undefined identifier: USR_WKSPCSYM_STATUS <***> >> done +--+ arrays.ndf not defined yet? : ary_invert_slcindxA global_axisSplitL slc_splitSeparate_ary defined, but depend on one of undefined above : sub_splitSeparate_ary ary_subP_splitSeparateTo_midIndxs_subL +--+ strings.ndf ARY_SUBP_SPLITSEPARATETO_MIDINDXS_SUBL 08********08 #] 24Nov2021 position tests - ary versions (same tests as for lists, not generalised for more complex array situations) 28Nov2021 almalgamated [ary, str] position tests into ary 30Nov2021 put list version of subPosn back in, fix ary version # 30Nov2021 qnial> tstSimple sub_posnA1stItmInTop_ary_test >> all OK! # 30Nov2021 qnial> tstSimple sub_posnAAllItmInTop_ary_test >> 8/10 OK - not bad... +-----+ olde code 23Nov2021 day-end : create lst-only version! arys might be the problem 24Nov2021 trouble-shoot? +-------------------+ Lst-based position of [atm, chr, itm, sub, etc] : (see lists.ndf) 0/6 nop tstSimple itm_posn1stIn_lst_test 3/4 tstSimple itm_posnLAllIn_lst_test 2/7 nop tstSimple sub_posnL1stItmIn_lst_test 0/6 nop tstSimple subL_posnLLAllItmIn_lst_test missing from lists.ndf - probably in strings.ndf, or just use transformers? : >> transformers should do, as it is mainly within-lst results that must be ordered? 0/6 tstSimple itm_posnL1stIn_lstL_test >> however, itmL_posnL1stIn_lst might need proper ordering! 30Nov2021 # olde code : permutations are NOT used here!!! % 29Nov2021 how do I handle permutations? consider "increasing indexes within axis" only ; % utilise only axis involved ; IF (AND (> EACH valence ary sub)) THEN ???? ENDIF ; IF (AND ((shapeAry - shapeSub) EACHBOTH >= (indx + shapeSub))) THEN slicer := indx + tellShapeSub ; IF (sub = ary|maxIndx1stSubItem) THEN matchIndx1stSubItem := link matchIndx1stSubItem indx ; ENDIF ; ENDIF ; % 29Nov2021 currently only for lowest (first) axis only, no [rotation, reflection] ; % start indexing from each indxA_1stSubItm_in_aryTop ; % for (valence sub < valence ary), I need to add commas for axis possibilities? ; % select matches ; tellShapeSub := EACH tell (shape sub) ; FOR indx WITH indxA_1stSubItm_in_aryTop DO n_commas := - EACH valence ary sub ; slicerLL := tellShapeSub sub_permute_lst indx ; % many will be non-viable ; FOR slicer WITH slicerLL DO IF (sub = ary|slicer) THEN matchIndx1stSubItem := link matchIndx1stSubItem indx ; ENDIF ; ENDFOR ; ENDFOR ; shapeSub := shape sub ; shapeAry := shape ary ; tellShapeSub := EACH tell (shape sub) ; qnial> slicet := slicer qnial> slicet@2 := null +-+---++ |1|1 2|| +-+---++ Must make this the same valence as ary! : subber := 1 2 4 reshape sub sub := first ary|[1, 1 2, ] 08********08 #] 15Nov2021 sub [position, in] aryN - redo coding pinn_chr_writeScreenUnbalancedLines IS OP pinn chr pinn_chr_writeScreenUnbalancedLines (link d_Qtest 'QNial test optrs.ndf') `( >> failed to pick out missing paren str := 'faultL := EACH write "" "+-----+" (link "#] " (string optrPhr) " test " timestamp_DDMMMYYYY_HMS ; ' sub_posnA1stItmInTop_ary (string `() str >> didn't work (later) qnial> searchL := 'faultL' 'EACH write ' '+-----+' '(link "#] " (string optrPhr)' ' test " timestamp_DDMMMYYYY_HMS ; ' +------+------------+-------+------------------------------+----------------------------------+ |faultL|EACH write |+-----+|(link "#] " (string optrPhr)| test " timestamp_DDMMMYYYY_HMS ; | +------+------------+-------+------------------------------+----------------------------------+ qnial> sub_insertBetweenThenLink_aryL '\|' searchL faultL\|EACH write \|+-----+\|(link "#] " (string optrPhr)\| test " timestamp_DDMMMYYYY_HMS ; >> perfect, I'm surprised that it still works... qnial> sub_insertBetweenThenLink_aryL '\|' ['hello'] hello >> wow - It works even though I didn't plan it... qnial> a := (link d_Qtest 'fileops/test input files/' 'test- QNial setup.ndf') ['^#] .* IS OP '] ' ' (link d_Qtest 'fileops/pinn_searchL_options_grepTo_povrOrStdout/' 't01 test- QNial setup.ndf') +------------------------------------------------------------------------------------------------------+------ |/media/bill/Dell2/Website - raw/Qnial/code develop_test/fileops/test input files/test- QNial setup.ndf|+----- | ||^#] . | |+----- +------------------------------------------------------------------------------------------------------+------ ~..~ -----------+--+----------------------------------------------------------------------------------------------- ----------+| |/media/bill/Dell2/Website - raw/Qnial/code develop_test/fileops/pinn_searchL_options_grepTo_pov * IS OP || | ----------+| | -----------+--+----------------------------------------------------------------------------------------------- ~..~ -----------------------------------+ rOrStdout/t01 test- QNial setup.ndf| | | -----------------------------------+ qnial> sub_insertBetweenThenLink_aryL '\|' searchL faultL\|EACH write \|+-----+\|(link "#] " (string optrPhr)\| test " timestamp_DDMMMYYYY_HMS ; qnial> pinn_searchL_options_grepTo_povrOrStdout (link d_Qtest 'fileops/test input files/' 'test- QNial setup.ndf') ['^#] .* IS OP '] ' ' (link d_Qtest 'fileops/pinn_searchL_options_grepTo_povrOrStdout/' 't01 test- QNial setup.ndf') >> null, but no file output >> So what's the problem? 08********08 #] 11Nov2021 sub [position, in] aryN - redo coding lat - list of atoms -> string, tha "missing type" test for lower types in sub_posnAAllInTop_aryN? better effiencies 12Nov2021 I need to backup "core ndfs" NOW!! pinn_chr_writeScreenUnbalancedLines link d_Qndfs 'fileops.ndf' >> this was done +-----+ olde # 29Sep2021 NOTE : I already changed : find_string[,s]' ??? is this OK? # loaddefs link d_Qndfs 'QNial symbol header.ndf' IF flag_debug THEN write 'loading optr_names_raw' ; ENDIF ; #] faults?date? - conversion table for optr names # still have to fix all arg[number, order]s lstRaw := ; n_cols := 2 ; n_rows := floor ((gage shape optr_names_raw) / 2) ; faults?date? := rows (n_rows n_cols reshape optr_names_raw) ; # loaddefs link d_Qndfs 'QNial symbol header.ndf' IF flag_debug THEN write 'loading optr_names_raw' ; ENDIF ; #] boolean?date? - conversion table for optr names # still have to fix all arg[number, order]s lstRaw := ; n_cols := 2 ; n_rows := floor ((gage shape optr_names_raw) / 2) ; booleans?date? := rows (n_rows n_cols reshape optr_names_raw) ; # loaddefs link d_Qndfs 'QNial symbol header.ndf' IF flag_debug THEN write 'loading optr_names_raw' ; ENDIF ; #] arrays?date? - conversion table for optr names # still have to fix all arg[number, order]s lstRaw ; n_cols := 2 ; n_rows := floor ((gage shape optr_names_raw) / 2) ; arrays?date? := rows (n_rows n_cols reshape optr_names_raw) ; # 12Nov2021 questionable code ELSEIF (= "atmL resFltL) THEN ELSEIF (= "str resFltL) THEN ELSEIF (= "lst resFltL) THEN ELSEIF (= "lstL resFltL) THEN ? FOR i WITH (tell ((gage shape aryGoodIndxLL) - (gage shape sub)) DO IF (= sub1stItm ary@i) ? IF (= ary@aryGoodIndxLL@i sub@subGoodIndxLL@i) ? THEN aryGoodIndxL := link aryGoodIndxL aryGoodIndxLL@i ; subGoodIndxL := link subGoodIndxL subGoodIndxLL@i ; ENDIF ; ENDIF ; ENDFOR ; % don't need : ; % subMatch1stItmIndxL := append subMatch1stItmIndxL sub1stIndxL@i ; % don't need : ; % subMatchAllIndxL := append subMatchAllIndxL subFitIndxLL@i ; % return ALL indxs ; % aryMatchAllIndxL := append aryMatchAllIndxL aryFitIndxLL@i ; # 06Sep2021 for deletion : sub_posnAAllInTop_aryN IS sub_posnAAllInTop_aryN # qnial> sub_posnAAllInTop_aryN 5 (1 2 3 4 5 8 3 5 9 1) IF flag_debug THEN write 'loading subL_posnAAllInTop_ary' ; ENDIF ; #] subL_posnAAllInTop_ary IS OP subL ary - posn of all subL, for all occurences of subL in ary # 11Nov2021 initial - lost old string equivalent? No matter - this is much more challenging subL_posnAAllInTop_ary IS OP subL ary { firstItems := subL_posnA1stItm1stInTop_ary subL ary ; (tell (gage shape) subL) EACHRIGHT + firstItems } IF flag_debug THEN write 'loading subL_posn1stItm1stInTop_ary' ; ENDIF ; #] subL_posn1stItm1stInTop_ary IS OP subL ary - 1st posn of 1st itm of subL in ary #] returns initial 1st char positions for each subL, or a [null, error] #] 04Nov2021 NOT READY! only works with subL of atoms for now??! #] subL is a sequence of itms of ary, eg ((0 1) 2) in ((0 1) 2 3 4 5), not in (0 1 2 3 4 5) # 04Nov2021 initial from strings.ndf (~identical) subL_posn1stItm1stInTop_ary IS OP subL ary { subL EACHLEFT sub_posn1stInTop_ary ary } # subL_posnL1stIn_lst (tell 10) (4 5) 4 IF flag_debug THEN write 'loading subLL_posnAItmAllIn_ary' ; ENDIF ; #] subLL_posnAItmAllIn_ary IS OP ary subLL - all itm positions for all occurences each subLL in ary # 04Nov2021 initial from strings.ndf (~identical) # 09Nov2021 ary version subLL_posnAItmAllIn_ary IS OP ary subLL { subLL EACHLEFT subL_posnAAllInTop_ary ary } IF flag_debug THEN write 'loading table_build ' ; ENDIF ; #] table_build IS OP n_cols labld_data - process loaddef of table with column headers # 20Apr2020 adapted from 'MindCode/globals initialize.ndf' table_build IS OP n_cols labld_data { LOCAL n_rows subCols subTemp titles ; n_rows := floor ((gage shape labld_data) / n_cols) ; subTemp := n_rows n_cols reshape labld_data ; titles := subTemp|[0,] ; subCols := cols subTemp|[count (n_rows - 1),] ; titles EACHBOTH assign subCols ; titles subCols } IF flag_debug THEN write 'loading table_add_rowTitles ' ; ENDIF ; #] table_add_rowTitles IS OP tableData rowTitles - res ipsa loqitor # 11Nov2020 table_add_rowTitles IS OP tableData rowTitles { LOCAL n_rows subCols subTemp titles ; n_rows n_cols := gage shape tableData ; n_cols := 1 + n_cols ; newTable := n_rows n_cols reshape [null] ; newTable|[,0] := rowTitles ; newTable|[,(1 + (tell (n_cols - 1)))] := tableData ; newTable } IF flag_debug THEN write 'loading table_add_colTitles ' ; ENDIF ; #] table_add_colTitles IS OP tableData colTitles - res ipsa loqitor # 11Nov2020 table_add_colTitles IS OP tableData colTitles { LOCAL n_rows subCols subTemp titles ; n_rows n_cols := (gage shape) tableData ; n_rows := 1 + n_rows ; newTable := n_rows n_cols reshape [null] ; newTable|[0,] := colTitles ; newTable|[(1 + (tell (n_rows - 1))),] := tableData ; newTable } IF flag_debug THEN write 'loading table_addRowColTitles ' ; ENDIF ; #] table_add_rowColTitles IS OP tableData rowTitles colTitles - common [row,col]Titles@0 #] colTitles overwrites newTable@(0 0), if null then newTable@(0 0) := rowTitles@0 # 11Nov2020 initial, 11Jan2021 changed such that FULL [row, col] titles are required. simpler, flexible table_add_rowColTitles IS OP tableData rowTitles colTitles { LOCAL n_rows subCols subTemp titles ; n_rows n_cols := 1 + ((gage shape) tableData) ; n_rowCheck n_colCheck := EACH (gage shape) rowTitles colTitles ; IF (~= (n_rows n_cols) (n_rowCheck n_colCheck)) THEN write (newTable := fault '?table_addRowColTitles error : incompatible [row, col, data] shapes') ; ELSE newTable := n_rows n_cols reshape [null] ; newTable|[,0] := rowTitles ; newTable|[0,] := colTitles ; newTable|[(1 + (tell (n_rows - 1))), (1 + (tell (n_cols - 1)))] := tableData ; IF (= null newTable@(0 0)) THEN newTable@(0 0) := rowTitles@0 ; ENDIF ; ENDIF ; newTable } IF flag_debug THEN write 'loading table_remove_colTitles ' ; ENDIF ; #] table_remove_colTitles IS OP table - remove column titles from table # table_remove_colTitles_test table_remove_colTitles IS OP table { table|[(tell (first (gage shape table) - 1)) + 1,] } # for test, see link d_Qtest 'PuetzUWS- tests.ndf' # loaddefs link d_Qndfs 'array, table.ndf' IF flag_debug THEN write 'loading table_remove_rowTitles ' ; ENDIF ; #] table_remove_rowTitles IS OP table - remove column titles from table table_remove_rowTitles IS OP table { table|[,(tell (second (gage shape table) - 1)) + 1] } IF flag_debug THEN write 'loading table_remove_rowColTitles ' ; ENDIF ; #] table_remove_rowColTitles IS OP table - remove column titles from table table_remove_rowColTitles IS OP table { table|[(tell (first (gage shape table) - 1)) + 1, (tell (second (gage shape table) - 1)) + 1] } IF flag_debug THEN write 'loading table_write' ; ENDIF ; #] table_write IS OP titles - output labelled table # 20Apr2020adapted from 'MindCode/globals initialize.ndf' table_write IS OP titles { write transpose mix ((EACH solitary titles) EACHBOTH link (EACH execute titles)) ; } IF flag_debug THEN write 'loading tbl_selectRowsBy_col_key' ; ENDIF ; #] tbl_selectRowsBy_col_key IS OP tbl col key - returns a table of selected rows # 12Oct2021 initial # should generalise to regExpr or something ... tbl_selectRowsBy_col_key IS OP tbl col key { LOCAL keyCol selRowL ; keyCol := tbl|[,col] ; selRowL := (key EACHRIGHT = tbl|[,col]) sublist (tell first (gage shape) tbl) ; mix (selRowL choose (rows tbl)) } # testTbl := 5 4 reshape 11 12 13 14 21 "hit 23 24 31 "hit 33 34 41 42 43 44 51 "hit 53 54 # tbl_selectRowsBy_col_key testTbl 1 "hit # tbl_selectRowsBy_col_key testTbl 1 42 # 04Nov2021 olde code subL_splitAtFront_lst IS OP lst subL { LOCAL lstL sub subsub ; lstL := [lst] ; FOR sub WITH subL DO FOR lst_remain WITH lstL DO IF (sub in lst_remain) THEN subsub := lst_remain sub_splitAtFront_lst sub ; % move all to one level ; lstL := null ; FOR i WITH (tell gage shape subL) DO IF (isLst subsub@i) THEN lstL := link lstL [subsub@i] ; ELSE lstL := link lstL (link subsub@i) ; ENDIF ; ENDFOR ; ENDIF ; ENDFOR ; ENDFOR ; lstL } IF flag_debug THEN write 'loading lstL_cutBy_itmL' ; ENDIF ; #] lstL_cutBy_itmL IS OP lstL itmL - cut each lstL by all itmL, omitting itmL, ??lists only (not arys)?? #] note that a character list is just a lst, but I use "itmL" to emphasize that each itm cuts lstL_cutBy_itmL IS OP lstL itmL { (NOT (itmL EACHLEFT EACHRIGHT EACHRIGHT = lstL)) EACHBOTH boolL_cut_lst lstL } #] aryList_extractMulplicate_subArys IS OP selectOp aryL - find mulplicates in lstL by selectOp #] see d_Qroot 'setup.ndf' - works with lstLs, or any array type (in form of list) IF flag_debug THEN write 'loading List Howells [bash scripts, QNial operators' ; ENDIF ; #] List Howells [bash script, QNial optr]s - essential map for finding shit, twig the bash cmd line #] see "$d_bin""0_list Howells [bash scripts, QNial operators].sh" #] $ find "$d_Qndfs" -name "*.ndf" |...[greps,sort]...| xargs...grep "#\] " "FILE" | sed $ find "/media/bill/Dell2/PROJECTS/Qnial/MY_NDFS/" -name "*.ndf" | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | sort | tr \\n \\0 | xargs -0 -IFILE grep "#\] " "FILE" | sed "s/#] /\t/" >>"/media/bill/Dell2/PROJECTS/Qnial/MY_NDFS/0_list of Howells QNial programs.txt" IF flag_debug THEN write 'loading List usage of one of Howells QNial operators' ; ENDIF ; #] 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_Qndfs" -name "*.ndf" |...[greps,sort]...| xargs -0 -IFILE grep..."" "FILE" $ find "$d_Qndfs" -name "*.ndf" | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | sort | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number "" "FILE" # may want saved to file : >"$d_temp""optr_usage temp.txt" 08********08 #] 02Oct2021 ary1_transStr_isSameStructAs_ary2[, _calcResults, _test] +-----+ testing # `t EACHRIGHT link ('01' '02' '03' '04' '05' '06' '07' '10' '11' '12' '13' '20' '21' '22') # EACH (gage shape) stdResults overallResults testNum dat1 dat2 eachResults twigResults leafResults # mix ((l l) lll) llll oooo # mix ([l l] lll) llll oooo # mix ((1 2) 3 4 5) (2 3 4 5) (`a `b `c `d) # mix (each single (l l) l l l) llll oooo # mix (each solitary (l l) l l l) llll oooo # transpose mix testNum dat1 dat2 eachResults twigResults leafResults # AND EACHBOTH = stdResults (transpose mix eachResults twigResults leafResults) # stdResults EACHBOTH = (rows transpose mix eachResults twigResults leafResults) # transpose mix (overallResults testNum dat1 dat2 eachResults twigResults leafResults) # str_toUpperCase 'EACH' # ary1_transStr_isSameStructAs_ary2_calcResults (`z (`z `t) 'My name is Sue') 'EACH' (`t (1 2) 'Bert has a bik') # rows transpose mix (dat1L (n_rows reshape (solitary transStr)) dat2L) from sub_posnL1stItmInTop_ary : % copy of code for aryS, with minor changes to avoid null shapes of atoms? ; sub1stItm := first sub ; ary1stIndxL := null ; FOR aryPoint WITH aryFitIndxLL DO IF (= sub1stItm ary@aryPoint) THEN % link or append? ; ary1stIndxL := append ary1stIndxL aryPoint ; ENDIF ; ENDFOR ; % ; IF (= null ary1stIndxL) THEN resFltL := link resFltL (fault '?sub_posnAAllInTop_ary error = null sub1stIndxL') ; ELSE % select full matches of ary1stIndxL ; aryMatch1stItmIndxL := null ; FOR aryPoint WITH (tell ((gage shape ary1stIndxL) - (gage shape sub))) DO arySlice := aryPoint ; IF (= sub ary@arySlice) THEN aryMatch1stItmIndxL := append aryMatch1stItmIndxL aryPoint ; ENDIF ; ENDFOR ; ENDIF ; +-----+ # olde code (= [lll] r01) '01' c01 d01 r_Each01 r_Twig01 r_Leaf01 (= [lll] r02) '02' c02 d02 r_Each02 r_Twig02 r_Leaf02 (= [lll] r03) '03' c03 d03 r_Each03 r_Twig03 r_Leaf03 (= [lll] r04) '04' c04 d04 r_Each04 r_Twig04 r_Leaf04 (= [lll] r05) '05' c05 d05 r_Each05 r_Twig05 r_Leaf05 (= [lll] r06) '06' c06 d06 r_Each06 r_Twig06 r_Leaf06 (= [ooo] r07) '07' c07 d07 r_Each07 r_Twig07 r_Leaf07 (= [lll] r10) '10' c10 d10 r_Each10 r_Twig10 r_Leaf10 (= [lll] r11) '11' c11 d11 r_Each11 r_Twig11 r_Leaf11 (= [lll] r12) '12' c12 d12 r_Each12 r_Twig12 r_Leaf12 (= [lll] r13) '13' c13 d13 r_Each13 r_Twig13 r_Leaf13 (= [lll] r20) '20' c20 d20 r_Each20 r_Twig20 r_Leaf20 (= [lll] r21) '21' c21 d21 r_Each21 r_Twig21 r_Leaf21 (= [lll] r22) '22' c22 d22 r_Each22 r_Twig22 r_Leaf22 ; dat1 := '01' (null) '02' (2 5 reshape [null]) '03' (`z) '04' (`z `t) '05' (`z `t) '06' ('My name is Sue') '07' ('My name is Sue') '10' (2 5 reshape 'My name is Sue') '11' (2 5 reshape 'My name is Sue') '12' (2 2 reshape (1 `t `z ['all'])) '13' (2 2 reshape (1 `t `z ['all'])) '20' (`z) '21' (`z) '22' (`z) ; n_cols := 2 ; n_rows_dat1 := floor ( (gage shape dat1) / n_cols) ; dat1 := second cols (n_rows_dat1 n_cols reshape dat1) ; # enddoc