JPhrases/Test

From J Wiki
Jump to navigation Jump to search

4C. Test

d0=: -:&(/:~) Are x and y permutations of each other?
m1=: /:~-:i.@# Is y a permutation vector?
m2=: -:-@|: Is y antisymmetric?
m3=: -:|: Is y symmetric?
m4=: [:+./[:*./]=/0 1"_ Are all atoms of Boolean list y equal?
m5=: *./ .= +./ Are all atoms of Boolean list y equal?
m6=: *./ .= *./ Are all atoms of Boolean list y equal?
d7=: -.@(] <:/ .>: >.@] , [)"1 Is y in the half open on the right interval x and is it an integer?
d8=: e. Is list x a row of array y?
m9=: *./@(= >./\) Are columns of y in ascending order?
m10=: *./@(= <./\) Are columns of y in descending order?
m11=: >./=<./ Are atoms of numerical list y equal?
m12=: *./ +. -.@(+./) Are atoms of Boolean list y equal?
m13=: *./ = +./ Are atoms of Boolean list y equal?
m14=: *./@(= {.) Are atoms of list y equal?
m15=: 0:=#|+/ Are atoms of Boolean list y equal?
m16=: *./@(#1&|.) Are atoms of Boolean list y equal?
m17=: ([:,:0:,#)-: v19"_ rxmatch ] Is y a legal J name?
d18=: rxmatch=: 17!:0 '' to get rxmatch
v19=: 'alpha:[[:alnum:]_]* '"_ 'regex' to get alpha: and alnum: