#] #] ********************* #] "$d_Qtest"'types atomic/types atomic- develop.txt' - # www.BillHowell.ca 02Oct2021 initial 23Nov2024 renamed [dir, fil]s # 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"'types atomic/types atomic- develop.txt' | sed 's/^#\]/ /' # ********************* 24************************24 #] current status of tests - see "$d_Qtest"'/test results/' 30Mar2023 huge number of tests to create!! 24************************24 08********08 #] ??Mar2024 08********08 #] ??Mar2024 08********08 #] ??Mar2024 08********08 #] ??Mar2024 08********08 #] ??Mar2024 08********08 #] ??Mar2024 08********08 #] ??Mar2024 08********08 #] ??Mar2024 08********08 #] ??Mar2024 08********08 #] ??Mar2024 08********08 #] 16Mar2024 ary_sub_in [fix, test] qnial> tstOptr "ary_sub_in_testStd o ary_sub_in_testStd 0 32 27 >> hilarious, whole test batch is dependent on bolean returns, not OT[null, faultL] after many fix iterations : qnial> tstOptr "ary_sub_in_testStd l ary_sub_in_testStd 27 32 27 >> trickey - whether a [solitary, lst] depends on test return should be good to do tblHtm_transpose now? #08********08 #] 09Mar2024 types.ndf - continue fixes isLayTbl IS OP datTbl titLL : % titles cannot be characters ; IF (OR (EACH ischar titLL@i)) THEN faultL := link faultL (fault '?tblDatTitComp04') ; ENDIF ; % titles cannot be boolean ; IF (OR (EACH isboolean titLL@i)) THEN faultL := link faultL (fault '?tblDatTitComp05') ; ENDIF ; change : IF (NOT ary_allItmsUnique_bol titLL@i) to : IF (NOT ary_allItmsUnique titLL) OUCH!! NAND isn't perva[sive, ding]!!! : qnial> a 0 1 2 3 12 13 14 15 4 5 6 7 16 17 18 19 8 9 10 11 0 1 2 3 qnial> NAND LEAF isInteger a o qnial> LEAF isInteger a llll llll llll llll llll llll qnial> AND LEAF isInteger a l geany regexpr search \(~=[ ]*null removed isLayAtmAA, couldn't think of difference with isLayAtmA (now with ary_to_atomL) just use EACH atomic .. I defined IF flag_debug THEN write 'loading isLayLstAA' ; ENDIF ; I defined isLayLstL findall does TOP level only (itms) +-----+ olde code have _fits been supplanted by is? # +-----+ # ary_[idx, itm, slc, sub]_fit, returns OR[null, faultL] : IF flag_debug THEN write '+-----+' ; ENDIF ; IF flag_debug THEN write 'ary_[idx, itm, sub, slc]_fit : ' ; ENDIF ; IF flag_debug THEN write 'loading ary_idx_fit' ; ENDIF ; # ary_idx_fit IS OP ary idx - faultL = OR [null, faultL], # idx MIGHT fit into ary (max gage shape) # 25Apr2022 initial # IF flag_break THEN BREAK ; ENDIF ; ary_idx_fit IS OP ary idx { LOCAL aryVlc idxVlc faultL ; % ; faultL := isLayAry ary ; faultL := link faultL (isLayAryIdx idx) ; % ; IF (= null faultL) THEN aryVlc idxVlc := EACH valence ary idx ; aryShp idxShp := EACH (gage shape) ary idx ; IF (~= aryVlc idxShp) THEN faultL := link faultL (fault '?aryVlcIdxShp') ; ELSEIF (OR (aryShp EACHBOTH <= idx)) THEN faultL := link faultL (fault '?aryIdxTooBig') ; ENDIF ; ENDIF ; % ; faultL } #? ary_idx_fit ?aryVlcIdxShp (~= aryVlc idxShp) #? ary_idx_fit ?aryIdxTooBig (OR (aryShp EACHBOTH < idxShp)) IF flag_debug THEN write 'loading ary_idxSeq_fit' ; ENDIF ; # ary_idxSeq_fit IS OP ary idxSeq - faultL = OR [null, faultL] # idxSeq refers to idxL in sequence @ topLevel of ary, MUST have same valence as ary! # 25Apr2022 initial # IF flag_break THEN BREAK ; ENDIF ; ary_idxSeq_fit IS OP ary idxSeq { LOCAL aryVlc idxVlc faultL ; % ; faultL := isLayAry ary ; faultL := link faultL (isLayAryIdx idxSeq) ; ??? does this check that idxSep has consecutive idx? ?? % ; IF (= null faultL) THEN aryVlc idxVlc := EACH valence ary idxSeq ; aryShp idxShp := EACH (gage shape) ary idxSeq ; IF (~= aryVlc idxShp) THEN faultL := link faultL (fault '?aryIdxSeqVlcShp') ; ELSEIF (OR (aryShp EACHBOTH <= idxSeq)) THEN faultL := link faultL (fault '?aryIdxSeqTooBig') ; ENDIF ; ENDIF ; % ; faultL } #? ary_idxSeq_fit ?aryIdxSeqVlcShp (~= aryVlc idxShp) #? ary_idxSeq_fit ?aryIdxSeqTooBig (OR (aryShp EACHBOTH < idxShp)) IF flag_debug THEN write 'loading ary_itm_fit' ; ENDIF ; # ary_itm_fit IS OP ary itm - itm "fit into" ary? # ary : cannot use addresses with [null, fault, atm, solitary, single] # itm : I can't think of any faults?!?!?!? any itm is good? # 01Jul2022 initial ary_itm_fit IS OP ary itm { LOCAL aryVlc idxVlc faultL ; % ; faultL := isLayAry ary ; % can't think of ANY itm that can't be used ; % faultL := link faultL (isLayAryItm?? itmx) ; % ; faultL } #? ary_itm_fit ??? (can"t think of ANY itm that can"t be used) IF flag_debug THEN write 'loading ary_pat_fit' ; ENDIF ; # ary_pat_fit IS OP ary pat - pattern "fits into" ary? # 01Jul2022 initial placeholder ary_pat_fit IS OP ary pat { LOCAL aryVlc patVlc faultL ; % ; faultL := isLayAry ary ; faultL := link faultL (isLayAryPat pat) ; % ; IF (= null faultL) THEN IF (~= patVlc aryVlc) THEN faultL := link faultL (fault '?aryPatCom1') ; ELSEIF (OR (EACHBOTH > pat ary)) THEN faultL := link faultL (fault '?aryPatCom2') ; ENDIF ; ENDIF ; faultL } # fault codes (can't have apos! use quotes) : #? ary_pat_fit ?aryPatComp1 (~= patVlc aryVlc), pat must be "up-dimensioned" if patVlc < aryVlc #? ary_pat_fit ?aryPatComp2 (OR (EACHBOTH > pat ary)) pat too large along at least one axis IF flag_debug THEN write 'loading ary_slc_fit' ; ENDIF ; # ary_slc_fit IS OP ary slc - ensure [slc, ary] compatible # 06May2022 initial # IF flag_break THEN BREAK ; ENDIF ; ary_slc_fit IS OP ary slc { LOCAL axsL axsIdxL maxIdxL faultL ; % ; faultL := isLayAry ary ; faultL := link faultL (isLayArySlc slc) ; % ; IF (= null faultL) THEN IF (~= (valence ary) (1 + sum (slc EACHLEFT = `,))) THEN faultL := link faultL (fault '?aryVlcSlcShp') ; ELSE axsL := ary_itm_cut_subL (front rest slc) `, ; axsIdxL := axsL EACHLEFT ary_itm_cut_subL ` ; maxIdxL := null ; FOR axs WITH axsIdxL DO idxL := execute axs ; idxL := (NOT = null axs) subList axs ; IF (= null idxL) THEN maxIdx := 0 ; % temporary fudge until I come up with a better idea ; ELSE maxIdx := max (EACH tonumber idxL) ; ENDIF ; maxIdxL := link maxIdxL [maxIdx] ; ENDFOR ; IF (OR ((gage shape ary) EACHBOTH <= maxIdxL)) THEN faultL := link faultL (fault '?arySlcShp') ; ENDIF ; ENDIF ; ENDIF ; % ; faultL } #? ary_slc_fit ?aryVlcSlcShp (~= (valence ary) (1 + sum (slc EACHLEFT = `,))) #? ary_slc_fit ?arySlcShp (OR ((gage shape ary) EACHBOTH < maxIdxL)) # 06May2022 olde code IF (= null axsStrL) THEN faultL := link faultL [fault '?slca11'] ; qnial> a := ary_itm_cut_subL 'Hello, worl,d my babde' `, +-----+-----+----------+ |Hello| worl|d my babde| +-----+-----+----------+ qnial> b := ` EACHRIGHT ary_itm_cut_subL a +-------+------+------------+ |+-----+|+----+|+-+--+-----+| ||Hello|||worl|||d|my|babde|| |+-----+|+----+|+-+--+-----+| +-------+------+------------+ # qnial> a := ary_itm_cut_subL ', 1 2, ,1, 3 4 5' `, +----+-+-+------+ | 1 2| |1| 3 4 5| +----+-+-+------+ >> problem - 1st axs must have a space before comma, or null will be dropped qnial> b := EACHRIGHT ary_itm_cut_subL a ` +-----+--+---+-------+ |+-+-+|++|+-+|+-+-+-+| ||1|2||||||1|||3|4|5|| |+-+-+|++|+-+|+-+-+-+| +-----+--+---+-------+ >> Perfect! null is retained!!! # ary1_isItmOf_ary2 IS OP ary1 ary2 - tests TOP level of ary2 only # 02Dec2021 initial ary1_isItmOf_ary2 IS OP ary1 ary2 { LOCAL faultL ; faultL := ary1 in ary2 ; IF (= l faultL) THEN faultL := null ; ENDIF ; faultL } ary_idxA_chkAppOp IS OP ary idxA optrPhr : resFltL := null ; FOR idx WITH idxA DO resFltL := link resFltL [ary_idx_fit ary idx] ; ENDFOR ; IF (NOT ary_hasFaults resFltL) THEN resFltL := apply optrPhr (ary idxA) ; resFltL := (gage shape idxA) reshape resFltL ENDIF ; ary_itm_chkAppOp IS OP ary itm optrPhr : { LOCAL resFltL ; resFltL := isLayAry ary ; % need to add isItmFindAble (is null?) ; IF (= null resFltL) THEN resFltL := apply optrPhr (ary itm) ; ENDIF ; % if itm not found, ary_itm_get_idxL returns fault ; resFltL etc... #08********08 #] 08Mar2024 types.ndf - return OR[null (true), faultL] # 12Nov2021 QNial dictionary - list of atomic types : type repr test boolean o isboolean integer 0 isinteger real 0. isreal character ` ischar phrase `" isphrase fault `? isfault type l 3 3.3 `3 '3.3' "33 +-+-+--+--+-----+--+ |o|0|0.|` |' '|""| +-+-+--+--+-----+--+ change : IF (= l faultL) to : IF (~= null faultL) +-----+ olde code isLayArySlc IS OP ary slc : aryVlc idxVlc := EACH valence ary axiIdxL ; ELSEIF (NAND (isTypIntLL axiIdxL)) THEN faultL := link faultL (fault '?isAryIdxNotIntLL') ; ELSEIF (~= (EACH (gage shape) axiIdxL)) THEN faultL := link faultL (fault '?isAryIdxMisShp') ; ENDIF ; #08********08 #] 07Mar2024 create Lay vs Typ search replace changed NOT isAryIdxable isLayAry types.ndf ONLY arrays.ndf, [types, arrays]- testOptrs isArySub isLayArySub [types, arrays].ndf [types, arrays]- testOptrs isItmIdxable isLayAryItm types.ndf arrays.ndf, [types, arrays]- testOptrs +-----+ use bash to change words! later think of : [boolean, faults, fileops, lists, strings, webSite, windows] will have to change ops to : include ary as arg return [null (true), faultL] no change for now : ary_[atm, sub]_in ary_[atm, itm, sub]A_anyIn ary_[*]_fit, leave most of arrays.ndf intact bash fileops run.sh povrL_pStrP_replace_run() { pOvrL="$d_Qroot"'240307 pNdfL for [types, arrays]x[, - testOptrs].ndf.txt' pStrPL="$d_Qroot"'240307 pStrP for [types, arrays]x[, - testOptrs].ndf.txt' echo 'changes for [types, arrays]x[, - testOptrs].ndf' povrL_pStrP_replace 1 1 "$pOvrL" "$pStrPL" } >> uncomment povrL_pStrP_replace_run @ end of file +--+ files : # see "$d_Qroot"'240307 pStrP for [types, arrays]x[, - testOptrs].ndf.txt' # see "$d_Qroot"'240307 pNdfL for [types, arrays]x[, - testOptrs].ndf.txt' #08********08 #] 06Mar2024 arySub operators isArySub takes over old capabilities of ary_sub_fit remove ary_sub_fit, fit is checked by ary_sub_get_[idx1stL, idxL] (or no action results, just fault) +-----+ from "$d_Qndfs"'array notes.txt' doing it by hand works, testSimple does not - must fix checks ary_sub_get_idxL_chk IS OP ary sub { ary_sub_chkApply_optrPhr ary sub "ary_sub_get_idxL } see types.ndf ary_sub_chkApply_optrPhr IS OP ary sub optrPhr { LOCAL resFltL ; resFltL := ary_sub_fit ary sub ; % true if compatible, fault if not ; IF resFltL THEN resFltL := apply optrPhr (ary sub) ; ENDIF ; resFltL } +-----+ olde code ary_sub_fit IS OP ary sub { LOCAL aryVlc subVlc faultL ; % ; faultL := isArySub ary sub ; % ; IF (= null faultL) THEN IF (~= (EACH valence ary sub)) THEN faultL := fault '?arySubFitVlc' ; ELSEIF (OR (EACHBOTH > (EACH (gage shape) sub ary))) THEN faultL := fault '?arySubFitShp' ; ENDIF ; ENDIF ; faultL } # any sub is legitimate? IF (= null sub) THEN faultL := link faultL (fault '?subAdrCompNull' ) ; ELSEIF (isFault sub) THEN faultL := link faultL (fault '?subAdrCompFault') ; ELSEIF (isSolitary sub) THEN faultL := link faultL (fault '?subAdrCompSolty') ; ELSEIF (isSingle sub) THEN faultL := link faultL (fault '?subAdrCompSingl') ; ELSEIF (isAtm sub) THEN faultL := link faultL (fault '?subAdrCompAtm' ) ; ENDIF ; #? isArySub ?subAdrCompNull (= null sub), nulls aren"t subs! #? isArySub ?subAdrCompFault (isFault sub), faults aren"t subs! #? isArySub ?subAdrCompSolty (isSolitary sub), solitarys aren"t subs! #? isArySub ?subAdrCompSingl (isSingle sub), singles aren"t subs! #? isArySub ?subAdrCompAtm (isAtm sub), atms aren"t subs! IF flag_debug THEN write 'loading ary_sub_fit' ; ENDIF ; # ary_sub_fit IS OP ary sub - returns sub posns in ary that "fit" # sub must be "up-dimensioned" if subVlc < aryVlc # before considering actual position! # 11Nov2021 initial # this is interesting, as sub does NOT have to include all dimensions of ary # it can have different "orientations", for example, is "backwards" legitimate? # here we ONLY include directions along the axes (should address angles in future) # basic rule : there must be some permutations of shapeSub that "fit into" (<=) shape ayN # this also may restrict search region, which could be [very helpful, more efficient]!! # 30Nov2021 measurement units constraint example of decreasing freedom with higher dimension. # 30Nov2021 Here FORCE (= EACH valence sub ary) # 11Apr2022 reduced faultL to fault # 11Apr2022 ary_sub_fit need more tests for unused faults! # 01Jul2022 solitary is OK,can use addresses, single cannot : 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 # IF flag_break THEN BREAK ; ENDIF ; ary_sub_fit IS OP ary sub { LOCAL aryVlc subVlc faultL ; % ; faultL := isArySub ary sub ; % ; IF (= null faultL) THEN faultL := null ; IF (~= (EACH valence ary sub)) THEN faultL := fault '?arySubFitVlc' ; ELSEIF (OR (EACHBOTH > (EACH (gage shape) sub ary))) THEN faultL := fault '?arySubFitShp' ; ENDIF ; ENDIF ; faultL } # fault codes (can't have apos! use quotes) : #? ary_sub_fit ?arySubFitVlc (~= (EACH valence ary sub)) #? ary_sub_fit ?arySubFitShp (OR (EACHBOTH > (EACH (gage shape) sub ary))) # 13Apr2022 tests qnial> ary_sub_fit (EACH (gage shape) (4 5 reshape (tell 30)) 4) l qnial> ary_sub_fit (EACH (gage shape) (4 5 reshape (tell 30)) (5 6 7 8)) l qnial> ary_sub_fit (EACH (gage shape) (4 5 reshape (tell 30)) (4 5)) l qnial> ary_sub_fit (EACH (gage shape) (4 5 reshape (tell 30)) (2 3 reshape 1 2 3 6 7 8)) l qnial> ary_sub_fit (EACH (gage shape) (4 5 reshape (tell 30)) (2 3 reshape 1 2 3 6 7 8 9)) 1 2 3 6 7 8 # '_test' ary_sub_get_idx1stL 'ary_sub_fit_testStd' # 20Apr2022 olde code ELSEIF (valSub > valAry) THEN resFltL := link resFltL (fault '?sca4') ; #08********08 #] 06Mar2024 rename checks : eg ary_chk_idxA_apply_optrPhr to ary_idxA_chKApply_optrPhr #08********08 #] 05Mar2024 isIdx, isAryIdxSeq see "$d_Qndfs"'array notes.txt' types.ndf change : IF (NAND (0 EACHRIGHT >= (EACH min idxSeq))) to : IF (AND (0 EACHRIGHT <= (EACH min idxSeq))) qnial> ary_idxSeq_to_slc (3 2 5 reshape tell 10) ((1 0 0) (1 0 1) (1 0 2) (1 0 3)) [1 , 0 , 0 1 2 3] >> OK d_Qtest 'arrays/arrays- testOptrs.ndf' : tstOptr "ary_chk_idxSeq_to_slc_testSimple types.ndf change : ary_chk_idxSeq_apply_optrPhr IS OP ary idxSeq optrPhr { LOCAL resFltL ; resFltL := ary_idxSeq_fit ary idxSeq ; % true if compatible, fault if not ; IF resFltL THEN resFltL := apply optrPhr (ary idxSeq) ; ENDIF ; resFltL } to : ary_chk_idxSeq_apply_optrPhr IS OP ary idxSeq optrPhr { LOCAL resFltL ; resFltL := isAryIdxSeq ary idxSeq ; % null if compatible, fault if not ; IF (= null resFltL) THEN resFltL := apply optrPhr (ary idxSeq) ; ENDIF ; resFltL } +-----+ d_Qtest 'types/types- testOptrs.ndf' : fix isAryIdxSeq_testSimple qnial> tNow 14:53:51 qnial> tstOptr "isAryIdxSeq_testSimple l isAryIdxSeq_testSimple 11 8 11 +-----+ olde code # { LOCAL resFlt ; % ; resFltL := null ; % rather than "trickle down" to isIdx, maybe best to do tests here? ; IF (NAND (LEAF isInteger idxSeq)) THEN resFltL := fault '?idxSeqNotIntLEAF' ; ENDIF ; IF (~= 1 (valence idxSeq)) THEN resFltL := link resFltL (fault '?idxSeqNotLBase') ; ENDIF ; IF (NAND (1 EACHRIGHT = (EACH valence idxSeq))) THEN resFltL := link resFltL (fault '?idxSeqNotLL') ; ENDIF ; % ; IF (= null resFltL) THEN axiIdxL := EACH (sortup cull) idxSeq ; minAxiIdxL maxAxiIdxL := cols mix (EACH [min, max] idxSeq) ; IF (AND (0 EACHRIGHT <= minAxiIdxL)) THEN resFltL := null ; ELSE resFltL := fault '?isIdxSeqMinAxiL' ; ENDIF ; ENDIF ; % ; resFltL } 08********08 #] 05Mar2024 [arrays, types].ndf - bookmarked functions I have been testing (may help to sort out stuff?), see "$d_Qndfs"'array notes.txt' arrays.ndf - check if in d_Qtest 'arrays/arrays- testOptrs.ndf' : y ary_to_atmL IS OP ary y ary_idxSeq_to_slc IS OP ary idxSeq y ary_itm_get_idxL IS OP ary itm y ary_sub_get_idx1stL IS OP ary sub y ary_sub_get_idxL IS OP ary sub x tblHtmInn_transform_tblHtmOut IS OP tblHtmInn tblHtmOut types.ndf x isAryIdxable IS OP ary y isAtm IS OP ary y isIdxSeq IS OP idxSeq x isVerBar IS OP ary y ary_sub_in IS OP ary sub x ary_sub_fit IS OP ary sub (none of above ops is in in d_Qtest 'arrays/arrays- testOptrs.ndf') #08********08 #] 03Mar2024 ary_sub_in is this working? qnial> ary_sub_in 'kostume' 'kos' l ?arySubInNot qnial> ary_sub_get_idx1stL 'kostume' 'kos' ?L >> nuts, big problem qnial> ary_sub_get_idx1stL 'kos' 'kostume' ?arySubFitShp >> OK 08********08 #] 10Apr2022 types tests & fixes to optrs qnial> loaddefs link d_Qtest 'types/types- testOptrs.ndf' >>> loading start : types/types- testOptrs.ndf +-----+ [is, check] tests : (24Nov2021 no formal tests yet - just in ndf files) loading isAtm_testSimple ?not an operation loading isIdxSeq_testSimple loading isSlc_testSimple +-----+ ary_[atm, itm, sub]_[,any]in : loading sub_posnA1stItmInTop_ary_testStd loading ary_subL_anyIn_testSimple +-----+ ary compatibility with [idx, itm, sub, slc] : loading ary_adrCompatible_testSimple loading ary_idx_compatible_testSimple loading ary_idxSeq_compatible_testSimple loading ary_sub_compatible_testStd <<< loading ended : types/types- testOptrs.ndf 08********08 #] 09Apr2022 isTyp - must return null if true? (for easy link to shed resFltL) +-----+ olde code isSlcStr IS OP slc # 04Jul2022 trash code (what was I thinking?) IF (= null slc) THEN slcr := front rest slc ; IF (NAND (slc EACHLEFT in ' ,0123456789')) THEN resFltL := fault '?slcBrktX' ; ENDIF ; ENDIF ; IF flag_debug THEN write 'loading isAryNonNulAtm' ; ENDIF ; # isAryNonNulAtm IS OP ary - fault if ary is[Null, Atm] # 14Apr2022 initial - not needed after fixed tstStandard for a single data input # may be useful for something else # IF flag_break THEN BREAK ; ENDIF ; isAryNonNulAtm IS OP ary { LOCAL resFlt ; resFlt := null ; IF (= null ary) THEN resFlt := fault '?nnaa1' ; ELSEIF (isAtm ary) THEN resFlt := fault '?nnaa2' ; ELSE resFlt := null ; ENDIF ; resFlt } #? isAryNonNulAtm ?isAtmNul = null ary #? isAryNonNulAtm ?isAtmNul = null ary IF flag_debug THEN write 'loading isSlc' ; ENDIF ; # isSlc IS OP slc - test if slc conforms to format of a full slice definition # isIntLL(slc) where slc[axi] MUST define OR[full slice, [int]]! # cannot test if slc is a full slice, because for that you need to know ary(shape), # but can check if contiguous from [min, max](axi) OR single int(axi) # 07Apr2023 simple copy of isIdxSeq - need to change over!! # IF flag_break THEN BREAK ; ENDIF ; isSlc IS OP slc { LOCAL resFlt ; resFlt := null ; axiLL := transpose mix slc ; slcSortUp := sortup slc ; minslc maxslc := [min, max] slcSortUp ; chkslc := minslc + (tell (maxslc - minslc + 1)) ; IF (= slcSortUp chkslc) THEN resFlt := null ; ELSE resFlt := fault '?isSlc01' ; ENDIF ; resFlt } # fault codes (can't have apos! use quotes). : #? isSlc ?isSlc01 isAtm slc, maybe other problems # olde code 07Apr2023 # 07Apr2023 don't need delta(int(axi))=[-1,0,1] !!! Just need [min, max](axi) in bounds # 07Apr2023 later - delta(int(axi))=[random, function, specified, etc]) +-----+ 10Apr2023 olde code IF flag_debug THEN write 'loading ary_atmA_anyInBol' ; ENDIF ; # ary_atmA_anyInBol IS OP ary atmA - boolean version 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 # 09Oct2021 initial # d_Qtest 'strings/strings- tests.ndf' # 09Oct2021 because chrA_anyIn_strA does NOT use grep, it easily handles '$.*/[\]^' characters # 11Oct2021 couldn't get [TWIG, EACHLEFT TWIG] to work # 11Oct2021 sortup a big text document - blow up memory, take forever? # 13Oct2021 from test "t22 : 'fails due to non-simple (nested) chrA?? I need to generalize ary_to_atmL' # 09Nov2021 ary version # 1Nov2021 is this redundant? thinks it's a carry-over, one of two to delete ary_atmA_anyInBol IS OP ary atmA { % handles simple arrays, but not all nested arys (fix at some time in the future?) ; atmL := cull sortup ary_to_atmL atmA ; str := cull sortup ary_to_atmL ary ; IF (AND (EACH isString atmL str)) THEN OR link (atmL EACHLEFT in str) ELSE fault '?atmA_anyIn_ary : NOT [atmA, ary] inputs' ENDIF } { LOCAL resFltL ; resFltL := null ; resFltL := link resFltL (isAryIndxable ary) ; resFltL := link resFltL (isAtmA atm)) ; % ; IF (= null resFltL) THEN resFltL := OR (atmA EACHLEFT ary_atm_in ary) ; IF (~= 1 resFltL) THEN resFltL := link resFltL (fault '?aryAtmAAnyInNot') ; ENDIF ; ENDIF ; resFltL } #? ary_atmA_anyIn ?aryAtmAAnyInNot (NOR (ary EACHRIGHT ary_atm_in atmA)) # olde code faultL := link faultL (isItmIdxable itm) ; % ; IF (NOT ary_hasFaults faultL) THEN IF (~= itmVlc aryVlc) THEN faultL := link faultL (fault '?aryVlcItmVlc') ; ELSEIF (OR (EACHBOTH > itm ary)) THEN faultL := link faultL (fault '?acitm2') ; ENDIF ; ENDIF ; #? ary_itm_fit ?aryVlcItmVlc - (~= itmVlc aryVlc), itm must be "up-dimensioned" if itmVal < aryVal #? ary_itm_fit ?acitm2 - (OR (EACHBOTH > itm ary)) itm too large along at least one axis 08********08 #] 07Apr2022 isIdxSeq_testSimple qnial> tstOptr "isIdxSeq_testSimple o isIdxSeq_testSimple 1 13 15 >> yuch +-----+ olde code # +-----+ # address compatibility of [ary, idx, itm, sub, slc], returns OR[null, faultL] : # typically null return if correct (links nicely to null) IF flag_debug THEN write '+-----+' ; ENDIF ; IF flag_debug THEN write 'address compatibility of [ary, idx, itm, sub, slc], returns OR[null, faultL] : ' ; ENDIF ; IF flag_debug THEN write 'loading isLst' ; ENDIF ; # isLst IS OP lst - check if lst is a list # 21Oct2021 initial, 04Nov2021 updated with valence isLst IS OP lst { LOCAL result ; result := null ; IF (NOT isLst lst) THEN result := link result (fault (link '?isLst error : lst is not a list')) ; ENDIF ; result } isIdxSeq IS OP idxSeq IF (= idxSeqSortUp chkIdxSeq) THEN resFlt := null ; ELSE resFlt := fault '?isIdxSeq01' ; ENDIF ; # olde code 07Apr2023 # 07Apr2023 don't need delta(int(axi))=[-1,0,1] !!! Just need [min, max](axi) in bounds # 07Apr2023 later - delta(int(axi))=[random, function, specified, etc]) # Tests 16Dec2022 : qnial> isIdxSeq (tell 10) l >> OK qnial> isIdxSeq (2 3) l >> OK qnial> isIdxSeq [2] l >> OK qnial> isIdxSeq 2 ?isIdxSeq01 >> OK - idxSeq must be a list, not an atm qnial> isIdxSeq (3 2 1) ?isIdxSeq01 >> oops, need to sort!! -> I fixed this qnial> isIdxSeq (3 2 1) l >> OK # cannot test if maxAxiIdxL EACHBOTH >= aryMaxAxiIdxL # minAxiIdxL >= 0 chkIdxSeq := minIdxSeq + (tell (maxIdxSeq - minIdxSeq + 1)) ; 08********08 #] 06Apr2022 fault problems ary_idx_compatible change all "compatible" optrs from : IF (= null faultL) THEN l ELSE faultL ENDIF to : faultL "lst_int01 ary_idx_compatible 'the bigg fat cow' 4 [fault ?idxNotIntL'] 'fault ?idxNotIntL: idx MUST be a list' "lst_intL01 ary_idx_compatible (tell 10) [4] l 'OK - should work, must be double-solitary!?' +-----+ "null_null01 ary_idxSeq_compatible null null (EACH fault '?aryAdrCompNul' '?idxAdrCompNul') 'not defined for null = [itm, ary]' null EACHRIGHT ary_idx_compatible null >> wrong! returns null instead of error!? (tell 10) EACHRIGHT ary_idx_compatible null >> wrong! returns null instead of error!? null EACHRIGHT ary_idx_compatible 4 "lst_int01 ary_idxSeq_compatible 'the bigg fat cow' 4 null 'should be OK: null' link null null link null (link (EACH idx_adrCompatible 4)) "lst_intL01 ary_idxSeq_compatible (tell 10) [4] null 'should be OK: null' "lst_intL02 ary_idxSeq_compatible (tell 10) (4 5 6) null 'should be OK: null' +-----+ olde code # 05Apr2023 olde code ary_idx_compatible # 10Dec2022 idx be a list of valence 1, shape = valence ary!! # (or it won't generalize to higher dimension) # 07Apr2023 olde code IF (AND (= 1 aryVlc) (isAtm idx)) THEN faultL := null ; ELSE IF (isAtm idxSeq) THEN resFltL := ary ary_idx_compatible idxSeq ; ELSE ENDIF ; idx_adrCompatible IS OP idx - ensure idx is compatible with address optrs # idx MUST be an intL! however, IFF ary is a list, then an intAtm is OK # 06Apr2023 NYET! a null idx is good - it returns the whole ary ary_idxSeq_compatible IS OP ary idxSeq IF (= null resFltL) THEN resFltL := link resFltL (idxSeq_slcCompatible idxSeq) ; ENDIF ; # loaddefs link d_Qtest 'types/types- testOptrs.ndf' IF flag_debug THEN write 'loading idxSeq_slcCompatible_testSimple' ; ENDIF ; # idxSeq_slcCompatible_testSimple := - is idxSeq useable for a slice? (ie intLA sequential) # 02Apr2023 initial, far too few tests! # tstOptr "idxSeq_slcCompatible_testSimple idxSeq_slcCompatible_testSimple := "tstSimple 1 "d_typeTests ( "null01 null (fault '?idxSeqSlcComp01') 'idxSeq cannot be null' "atm01 4 [fault '?idxVal'] 'idxSeq cannot be atomic' "atm02 [[4]] null 'should be OK - double-solitary int is a contiguous intLA' "lst01 [tell 10] null 'should be OK - idxSeq can be lists' "ary01 (3 4 reshape [1 2 3 4]) null 'should be OK - but cannot yet handle isAry(idxSeq)' "ary02 (2 3 reshape random 1) (6 reshape (fault '?idxVal')) 'fault ?idxSeqSlcComp01 idxSeq non-contiguous intLA' ) ; IF flag_debug THEN write 'loading ary_idxSeq_compatible' ; ENDIF ; # ary_idxSeq_compatible IS OP ary idx - test if [ary, idxSeq] compatible OR[null, faultL] # EACH idxSeq MUST have same valence as ary! # 15Dec2022 initial # 16Dec2022 problem if idxSeq not already sorted? # 16Dec2022 should eliminate (= 1 (gage shape idxSeq)) - REQUIRE [idx] # 07Apr2023 % is idxSeq "contiguous" (rectangular ary) or does it have gaps? ; # % repeated code also in idxSeq_slcCompatible ; # IF flag_break THEN BREAK ; ENDIF ; ary_idxSeq_compatible IS OP ary idxSeq { LOCAL axiIdxL idxVlc resFltL ; % ; IF flag_break THEN BREAK ; ENDIF ; resFltL := ary_adrCompatible ary ; IF (OR (= null idxSeq) (isAtm idxSeq)) THEN resFltL := link resFltL ( idxSeq_slcCompatible idxSeq) ; ELSE resFltL := link resFltL (link (EACH idxSeq_slcCompatible idxSeq)) ; ENDIF ; % ; IF (= null resFltL) THEN resFltL := ary EACHRIGHT ary_idx_compatible idxSeq ; ENDIF ; % ; resFltL } # fault codes (can't have apos! use quotes) : #? ary_idxSeq_compatible ?aryidxSeqComp01 idxSeq non-contiguous (NOT isIdxSeq axiIdxL) 08********08 # 03Apr2023 test # ary_idxSeq_compatible null null ?idxSeqSlcComp01 >> wrong why doesn't ary_idx_compatible return a fault? idxSeq_slcCompatible returns ?idxSeqSlcComp01 ary_idxSeq_compatible change : resFltL := ary EACHRIGHT ary_idx_compatible idxSeq ; To : resFltL := ary ary_idx_compatible idxSeq ; ary_idxSeq_compatible change : IF (NOT ary_hasFaults resFltL) THEN resFltL := null ; % is idxSeq "contiguous" (rectangular ary) or does it have gaps? ; % repeated code also in idxSeq_slcCompatible ; IF (NOR (EACH isIntSeq axiIdxL)) THEN resFltL := fault '?aryidxSeqComp01' ; ENDIF ; ENDIF ; To : IF (NOT ary_hasFaults resFltL) THEN resFltL := null ; % is idxSeq=intLL "contiguous" (delta = [-1, 0, 1])? ; % repeated code also in idxSeq_slcCompatible ; IF (NOT isIntSeq axiIdxL) THEN resFltL := fault '?aryidxSeqComp01' ; ENDIF ; ENDIF ; qnial> ary_idxSeq_compatible null null ?aryAdrComp2 ?idxNull ?idxSeqSlcComp01 >> should NOT have ?idxSeqSlcComp01 NOT ary_hasFaults (EACH fault '?aryAdrComp2' '?idxNull') >> OK Change to : resFltL := ary ary_idx_compatible idxSeq ; IF (NOT ary_hasFaults resFltL) THEN resFltL := idxSeq_slcCompatible idxSeq ; ENDIF ; qnial> ary_idxSeq_compatible null null ?aryAdrComp2 ?idxNull >> OK +-----+ olde code from ary_idxSeq_compatible IS OP ary idx - true if [ary, idxSeq] compatible, or faultL IF (NOR ((valence ary) EACHRIGHT = (EACH (gage shape) idxSeq))) THEN resFltL := fault '?aryidxSeqComp01' ; ENDIF ; % is idxSeq allIn ary? ; IF (OR (ary EACHRIGHT ary_idx_compatible idxSeq)) THEN resFltL := l ; ELSE resFltL := fault '?aryidxSeqComp02' ; ENDIF ; % is idxSeq "contiguous" (rectangular ary) or does it have gaps? ; % repeated code also in idxSeq_slcCompatible ; IF (= 1 (gage shape idxSeq)) THEN resFltL := l ; ELSE axiIdxL := EACH (sortup cull) (cols mix idxSeq) ; IF (NOR (EACH isIntSeq axiIdxL)) THEN resFltL := fault '?aryidxSeqComp03' ; ENDIF ; ENDIF ; 05Apr2023 remove old examples, work #? idx_adrCompatible ?idxVal (~= 1 (valence idx)), idx MUST be a list # 10Nov2022 problem with indexes - should always be a minimum of solitary (valence >= 1)? # remove solitary for now ELSEIF (isSolitary idx) THEN faultL := link faultL (fault '?idxAdrCompSolty') ; # 29Nov2022 removed ELSEIF (isFault idx) THEN faultL := link faultL (fault '?idxAdrCompFault') ; ELSEIF (isSingle idx) THEN faultL := link faultL (fault '?idxAdrCompSingl') ; # ? idx_adrCompatible ?idxIsSolty (isSolitary idx), solitarys aren"t addresses! # ? idx_adrCompatible ?idxIsSingl (isSingle idx), non-int singles aren"t addresses! IF (~= 1 (valence idx)) THEN faultL := link faultL (fault '?idxVal' ) ; ELSE 08********08 #] ??Mar2024 tstOptr "ary_sub_compatible_testStd qnial> tstOptr "ary_sub_compatible_testStd ?tstStandard error : incompatible IDdatL IDresL : null_null01 null_atm01 null_lst01 atm_null01 atm_atm01 atm_atm02 lst_null01 lst_atm01 lst_atm02 lst_lst01 lst_ null_null01 atm_null01 lst_null01 null_atm01 atm_atm01 atm_atm02 null_lst01 atm_lst01 atm_lst02 lst_lst01 lst_ lst02 lst_lst03 lst_lst04 lst_lst05 lst_lst06 lst_lst07 lst_lst08 lst_lst09 lst_lst10 lstL_lst01 lst_lstL01 ls lst02 lst_lst03 lst_lst04 lst_lst05 lst_lst06 lst_lst07 lst_lst08 lst_lst09 lst_lst10 lst_lstL01 lstL_lst01 ls t_lstL02 lstL_lstL01 ary_atm01 ary_lst01 ary_lst02 ary_ary01 tL_lst02 lstL_lstL01 atm_ary01 lst_ary01 lst_ary02 ary_ary01 ?type error in fault 08********08 #] 02Apr2023 types.ndf, [ary_adrCompatible, ary_idx_compatible, ary_idxseq_compatible] # should return OR[l, faultL] +-----+ qnial> tstOptr "ary_adrCompatible_testSimple l ary_adrCompatible_testSimple 4 2 4 >> yes +-----+ qnial> tstOptr "ary_idx_compatible_testSimple o ?ary_idx_compatible_testSimple error : unknown tstTypPhr 0 1 1 >> garbage, as there are 10 tests No changes except loaddefs? qnial> tstOptr "ary_idx_compatible_testSimple o ary_idx_compatible_testSimple 0 16 10 >> runs, but all wrong... (argOrder?) changed test argOrder, other fixes qnial> tstOptr "ary_idx_compatible_testSimple o ary_idx_compatible_testSimple 5 13 10 null return, not l (links nicely to null) : ary_adrCompatible IS OP ary { LOCAL resFlt ; resFlt := null ; qnial> tstOptr "ary_idx_compatible_testSimple o ary_idx_compatible_testSimple 6 13 10 few more fixes qnial> tstOptr "ary_idx_compatible_testSimple l ary_idx_compatible_testSimple 11 12 11 >> OK, works +-----+ need to create idxSeq_slcCompatible_testSimple to use in ary_idxseq_compatible qnial> tstOptr "idxSeq_slcCompatible_testSimple o idxSeq_slcCompatible_testSimple 0 25 5 >> nuts, nothing works qnial> tstOptr "idxSeq_slcCompatible_testSimple o idxSeq_slcCompatible_testSimple 5 9 6 >> great start - ToDo : "ary01 (3 4 reshape [1 2 3 4]) null 'should be OK - but cannot yet handle isAry(idxSeq)' +-----+ ary_idxSeq_compatible -> must create test set qnial> tstOptr "ary_idxSeq_compatible_testSimple o ary_idxSeq_compatible_testSimple 3 17 11 >> needs work... qnial> tstOptr "ary_idxSeq_compatible_testSimple o ary_idxSeq_compatible_testSimple 9 12 12 >> still needs work... +-----+ olde code # 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) # 29Nov2022 remove #? ary_idx_compatible ?aryVlcIdxShp (~= aryVlc idxShp) IF (AND (isAtm idx) (= 1 aryVlc)) THEN faultL := null ; 08********08 #] 30Mar2022 ary_adrCompatible_testSimple continued... see also "$d_Qtest"'types atomic/types atomic- develop.txt' loaddefs link d_Qtest 'types/types- testOptrs.ndf' qnial> tstOptr "ary_adrCompatible_testSimple #?.. Calcl := Optrphr EACHRIGHT apply ( first Datcols ) -->[nextv] optrPhr ary_adrCompatible -->[nextv] first datCols ++-+----------------+-----------------------------------+ ||4|the bigg fat cow|0.726391 0.726391 0.726391 0.726391| || | |0.726391 0.726391 0.726391 0.726391| || | |0.726391 0.726391 0.726391 0.726391| ++-+----------------+-----------------------------------+ -->[nextv] +------------------------+------------------------+-+-+ |+---------+------------+|+---------+------------+|l|l| ||?no_value|?aryAdrComp2|||?no_value|?aryAdrComp1|| | | |+---------+------------+|+---------+------------+| | | +------------------------+------------------------+-+-+ #-->[nextv] Optrphr EACHRIGHT apply first Datcols +------------------------+------------------------+-+-+ |+---------+------------+|+---------+------------+|l|l| ||?no_value|?aryAdrComp2|||?no_value|?aryAdrComp1|| | | |+---------+------------+|+---------+------------+| | | +------------------------+------------------------+-+-+ +-----+ Try : # -->[nextv] ary_adrCompatible null +---------+------------+ |?no_value|?aryAdrComp2| +---------+------------+ Doesn't make sense given : # ary_adrCompatible IS OP ary - ensure ary is compatible with address optrs, returns OR[null, faultL] # 01Jul2022 initial ary_adrCompatible IS OP ary { LOCAL fault ; resFlt := l ; IF (1 > (valence ary)) THEN resFlt := fault '?aryAdrComp1' ; ELSEIF (= null ary) THEN resFlt := fault '?aryAdrComp2' ; ENDIF ; resFlt } # fault codes (can't have apos! use quotes). : #? ary_adrCompatible ?aryAdrComp1 (1 > (valence ary)), ary ~=is[Atm, Solitary] #? ary_adrCompatible ?aryAdrComp2 (= null ary), ary NOT isNull YIKES!!! problem is very basic : ?.. Resflt := Fault '?aryAdrComp2' -->[nextv] +---------+------------+ |?no_value|?aryAdrComp2| +---------+------------+ -->[nextv] fault '?4rhrt' +---------+------+ |?no_value|?4rhrt| +---------+------+ >> I don't remember ever seeing this glitch -->[nextv] a := fault '?4rhrt' +---------+------+ |?no_value|?4rhrt| +---------+------+ -->[nextv] gage shape a 2 -->[nextv] first a ?no_value -->[nextv] second a ?4rhrt -->[nextv] isfault (second a) o -->[nextv] isstring (second a) l >> very bad news, I seem to have forgotten how this works!!! STUPID!!!!! { LOCAL fault resFlt ; cannot redclare fault!! I'm surprised that this wasn't a big error return!!?!?!?! qnial> ary_adrCompatible null ?aryAdrComp2 >> OK! also isAtm test created 08********08 #] 29Mar2022 ary_adrCompatible_testSimple from : "$d_Qmkts"'0_PuetzUWS intnl stocks notes.txt' using : pCsv := link d_PROJECTS 'economics, markets/mktDat M/rawCsv/rawCsv CADUSD TV.txt' pCsv_to_pYrFrac pCsv >> no output? or pTmp1 still not used? y pCsv_to_pYrFrac 1.txt y pCsv_to_pYrFrac mktDat M log.txt NUTS! one chr per output line commented out : % tblWhole_writeTabSep_padd tabWholeNew|[idxLNew,] pYrFrac ; 'plog MinMaxYrFrac.txt' : 230324 15h56m CA10Y "mktDat M" ?address 2022.66 230326 13h31m CADUSD "mktDat M" ?address ?address >> fix this first so I can see what's going on... see : ary_adrCompatible_testSimple in : "$d_Qtest"'types/types- testOptrs.ndf' Market data downloads REQUIRE : * "$d_Qmkts"'market symbol [regressSL, detrend].ndf' = launches loads incl mktData "$d_Qmkts"'market symbol header.ndf' qnial> loaddefs link d_Qmkts 'market symbol [regressSL, detrend].ndf' ... loading mktTblWhole ------------------------------------------------------------- Break debug loop: enter debug commands, expressions or type: resume to exit debug loop executes the indicated debug command current call stack : pinn_readexecute_tabtbl pth_typ_exists ------------------------------------------------------------- >> I wasted my time on an auto-load-break -->[stepv] foff o -->[stepv] resume >> OK, all loadded qnial> tstOptr "ary_adrCompatible_testSimple o ary_adrCompatible_testSimple 2 2 4 "$d_Qtest"'types/test results/ary_adrCompatible_testSimple log.txt' +--+----------+-----------------------+------------------------+ |OK|test# |std |calc | +--+----------+-----------------------+------------------------+ | o|null01 |? a r y A d r C o m p 2|+---------+------------+| | | | ||?no_value|?aryAdrComp2|| | | | |+---------+------------+| +--+----------+-----------------------+------------------------+ | o|atm01 |?aryAdrComp1 |+---------+------------+| | | | ||?no_value|?aryAdrComp1|| | | | |+---------+------------+| +--+----------+-----------------------+------------------------+ | l|lst01 | l| l| +--+----------+-----------------------+------------------------+ | l|indx_lst01| l| l| +--+----------+-----------------------+------------------------+ >> first two results are wrong!?? >> why the 2-item results? should only be a single fault! ary_adrCompatible_testSimple change: (EACH fault '?aryAdrComp2') to : [fault '?aryAdrComp2'] +--+----------+------------+------------------------+ |OK|test# |std |calc | +--+----------+------------+------------------------+ | o|null01 |?aryAdrComp2|+---------+------------+| | | | ||?no_value|?aryAdrComp2|| | | | |+---------+------------+| +--+----------+------------+------------------------+ | o|atm01 |?aryAdrComp1|+---------+------------+| | | | ||?no_value|?aryAdrComp1|| | | | |+---------+------------+| +--+----------+------------+------------------------+ | l|lst01 | l| l| +--+----------+------------+------------------------+ | l|indx_lst01| l| l| +--+----------+------------+------------------------+ >> still a glitch 08********08 #] 07Jun2022 update - types_groupTest qnial> groupTest "types_groupTest o types_groupTest ?tstOptr error : unknown tstTypPhr ?tstOptr error : unknown tstTypPhr ?tstOptr error : unknown tstTypPhr >> yuchh fixed, then : qnial> groupTest "types_groupTest o types_groupTest 20 37 70 +--+------------------------------+-------+------+-----+ |OK|test (optr) |correct|faults|total| +--+------------------------------+-------+------+-----+ | o|sub_inTop_ary_testStd | 16| 0| 27| +--+------------------------------+-------+------+-----+ | o|subL_anyInTop_ary_testSimple | 4| 0| 6| +--+------------------------------+-------+------+-----+ | o|indx_compatible_ary_testSimple| 0| 10| 10| ?not an operation +--+------------------------------+-------+------+-----+ | o|sub_compatible_ary_testStd | 0| 27| 27| ?not an operation +--+------------------------------+-------+------+-----+ >> works, but mediocre results [indx_compatible_ary_testSimple, sub_compatible_ary_testStd] - standard results look wrong +-----+ indx_compatible_ary_testSimple standard results not standard results - problem with tests #] 24************************24 #] done ToDos 09Mar2024 create : isTypIntA, isTypRea[L, LL, A], isTypStrL, isTypBol[L, LL, A], isTypPhr[L, LL, A], isTypFlt[L, LL, A] # enddoc