Skip to content

Index of phrases

Constants and functions referred to in the Q Phrasebook.

phrases.q

DEC:"0123456789"
HEX:"0123456789abcdef"
PI:3.141592653589798238
PUN:",;:.!?"
depth:{$[type[x]<0; 
  0; 
  "j"$sum(and)scan{1=count distinct count each x}each raze over x]}
fac:{prd 1+til x}                       / factorial
ly:{mod[;2] sum 0=x mod\:4 100 400}     / is x a leap year?
oa:{x xexp/:0 1}                        / ones and all Xs (float)
oe:{x xexp\:0 1}                        / 1 and each X (float)
shape:{$[0=d:depth x; 
  0#0j; 
  d#{first raze over x}each(d{each[x;]}\count)@\:x]}  / FIXME correct for shape 0#0
tc:('[til;count])
tt:{2 vs til "j"$2 xexp x}              / truth table of order x
zm:{(2#count x)#0}                      / zero matrix (square matrix)

Arithmetic

new description phrase
100 sum a vector sum x
101 sum columns of matrix sum x
102 sum rows of matrix sum each x
103 sum items grouped by y sum each x value group y
104 add vector to each row of matrix x+/:y
105 add vector to each column of matrix x+'y
106 add x to last item of y @[y;count[y]-1;+;x]
107 sum reciprocal series sum y%x
108 sum over subsets of x specified by y x mmu y
109 sum squares sum x*x
110 alternating sum sum x*(count x)#1 -1
111 alternating sum series sums x*(count x)#1 -1
112 increase absolute value without sign change x+y*(x=0)+signum x
113 vector and its negative 1 -1*/:x
114 numeric array and its negative x,''neg x
115 first difference deltas x
116 pairwise difference 1_neg deltas x
117 zeroing an array x*0
118 product prd x
119 multiplication table of order x {x*\:x}1+til x
120 square x retaining sign x*abs x
121 multiply each column by vector x*y
122 multiply each row by vector x*\:y
123 vector (cross) product (-).(*/')(1 neg\1 -1)rotate''2 2#(x;y)
124 alternating product prd x xexp(count x)#1 -1
125 direct matrix product flip each x*\:\:y
126 matrix product x mmu y
127 dot product of vectors sum x*y
128 product over subsets of x specified by y x('[prd;xexp])\:y
129 divide by 0 not[z]*y%x+z:x=0
130 divisors where 0=x mod/:til 1+x
131 greatest common divisor 1+last where min each 0=x mod/:1+til min x
132 pairwise ratios 1_ratios x
133 maximum table {x|\:x}til x
134 minimum table {x&\:x}til x
135 consecutive integers from x to y x+til 1+y-x
136 arithmetic progression of y numbers from x with step g x+g*til y
137 arithmetic progression from x to y with step g x+g*til 1+ floor (y-x)%g
138 primes to n a where not a in distinct raze a*/:\:a:2_ til x
139 x first triangular numbers sums til x
140 first 10 figurate numbers of order x x+\/10#1
141 fractional part x mod 1
142 integer and fractional parts of positive x f,'x-f:floor x
143 magnitude of fractional part a-floor a:abs x
144 fractional part with sign signum[x]*abs[x]mod 1
145 leading digit of numeric code abbb floor x%1000
146 last part of abbb x mod 1000
147 identity for floating-point maximum, negative infinity max 0#0.0
148 identity for floating point minimum, positive infinity min 0#0.0

Casting and representation

new description phrase
200 binary from integer 2 vs x, 0b vs x, 0x0 vs x
201 integer from binary 2 sv x
202 hexadecimals from integers HEX 16 vs x
203 hexadecimals from decimal characters HEX 16 vs "i"$x
204 decimal digits from integer 10 vs x
205 integer in base y y vs x
206 integer in base 10 100 1000 10 100 1000 vs x
207 integer from hexadecimal 16 sv HEX?x
208 vector from date 100000 100 100 vs x
209 integer from date "I"$ string[x] except "."
210 number from string parse x
211 number from string, default y parse $[x~"";y;x]
212 numeric codes from string "i"$x
213 integer from Roman d:0,1000 500 100 50 10 5 1 "MDCLXVI"
sum floor a*-1 xexp a<1 rotate a:d?x
214 numbers from text matrix parse each x
215 numbers from evaluating rows of text matrix raze('[eval;parse])each x

Execution

new description phrase
300 case structure $[c0;t0;c1;t1;c2;t2;f]
301 choose x or y depending on flag g $[g;x;y]
302 reverse on condition y y reverse/x
303 conditional change of sign y*1 -1 x
304 efficient execution of f x where x has repeated values u:distinct x
(f u)u?x
305 error to stop execution '`stop
306 execute rows of character matrix ('[eval;parse])each x
307 sum numbers in character matrix sum parse " " sv x

Finance

new description phrase
400 present value of cash flows c at times t and discount rate d sum c*d xexp t
401 future value of cash flows sum x* (1+y%100) xexp reverse tc x
402 compound interest for principals y at percentages g for periods x y*\:(1+g%100)xexp\:x
403 annuity coefficient for x periods at interest rate y% y%/:100*flip 1-(1+y%100)xexp\:neg x
404 fifo stock y decremented with x units 1_deltas 0,0|(sums y)-x
405 payback C:prds(count W)#1+R
C*B-sums W%(count W)#T _ 1,C
406 round to nearest integer floor 0.5+x
407 round to two decimal places 0.01*floor 0.5+x*100
408 round y to x decimals (10 xexp neg x)*`long$y*10 xexp x
409 round to nearest even integer floor x+not 1>x mod 2
410 round, but to nearest even integer if fractional part is 0.5 floor x+0.5*not 0.5=x mod 2
411 round x to nearest multiple of y y*floor 0.5+x%y
412 round x to zero if magnitude less than y @[x;where y>abs x;:;0.0]
413 round summands i:floor Y:y%x
a:{(floor .5+/x)#idesc x}Y-i
x*@[i;a;+;1]

Find

new description phrase
500 y in x x?y
501 flags where x
502 all occurrences of y in x where x in y
503 first occurrence of y x?y
504 first occurrence of maximum x?max x
505 first occurrence of minimum x?min x
506 first occurrence of g (circularly) after y q)mod[;count x] y+(y rotate x)?g
507 last occurrence of y count[x]-1+reverse[x]?y
508 last occurrence of y, counted from the rear reverse[x]?y
509 distinct items value group x
510 first differing item of x and y first where x<>y
511 items not in y not x in y
512 consecutive repeated items where differ x
513 rows of matrix y in matrix x x?y
514 items of y in array x shape[x] vs where raze[x] in raze y
515 rows of y in in corresponding rows of x x?'y
516 first blank x?" "
517 last non-blank (" "=reverse x)?0b
518 string x in string y z:where y=first x
z where x~/:y z+\:tc x
519 blank rows all flip x=" "
520 rows starting with item of y x where x[;0]in y

Flags

new description phrase
600 invert 0s after first 1 maxs x
601 invert 1s after first 1 (tc x)=x?1
602 invert 0s after first 0 tc[x]<>x?0
603 invert 1s after first 0 mins x
604 smearing 1s between pairs of 1s x or(<>)scan x
605 invert fields marked by pairs of 1s (not x)&(sums x)mod 2
606 invert all but first 1 in group of 1s x>-1 _ 0,x
607 insert 0 in list of 1s x after indexes y raze @[x,\:();y;,;0]
608 zero all items x&0
609 flags at y for vector x (tc x) in y
610 vector length x with 1s at y (til x) in y
611 vector length y with 0s at x @[y#1;x;:;0]
612 1s followed by 0s x>til y
613 0s followed by 1s x<=til y
614 1s preceded by 0s (til y)>=y-x
615 0s preceded by 1s (til y)<y-x
616 interlace 1s and 0s (raze/)flip(x;y)#''1 0
617 alternate takes of 1s and 0s (count[x]#1 0)where x
618 flag positive integers x in til 1+max x
619 count 1s sum x
620 lengths of groups of 1 deltas sums[x]where 1_(<)prior x,0
621 first 1 in x x?1
622 first 1 after index y first a where y<a:where x
623 yth 1 (sums x)?1
624 all all x
625 any any x
626 none not any x
627 x implies y x<=y
628 x but not y x>y
629 exclusive or x<>y
630 Kronecker delta x=y
631 simple parity (sum x) mod 2
632 running parity (sums x) mod 2
633 first group of 1s x and(and)scan x=(or)scan x
634 first 1s in groups of 1s 1_(>)prior 0,x
635 last 1s in groups of 1s 1_(<)prior x,0
636 select items flagged by y x[;;where y]

Format

new description phrase
700 formatted integers flip DEC 10 vs x
701 count of format ('[count;string])
702 leading zeros for positive integers in field width y 1_'string x+10 xexp y
703 number of decimals count each 2_'string x mod 1
704 number of decimals, maximum y y&count each 2_'string x mod 1
705 number of positions in nonnegative integer 1+floor log10 x+0=x
706 number of positions in integer 1+(x<0)+floor 10 xlog abs x+0=x
707 time hh:mm:ss from integer hhmmss ":"sv 0 2 4_ string x
708 date yyyy/mm/dd from integer yyyymmdd "/"sv 0 4 6_ string x
709 indexing plotting characters with flags " X" x
710 histogram " *"(1+ til max x)<=/:x
711 barchart of integer list " X" reverse til[max x]<\:x
712 horizontal barchart of integers " X" x>\:til max x
713 horizontal barchart, normalized to length y " X" (floor x*y%max x)>\:til y

Geometry

new description phrase
800 degrees from degrees and minutes sum x%1 60
801 degrees from radians 57.295779513082323*x
802 radians from degrees 0.017453292519943295*x
803 nautical miles from radians x*180*60%PI
804 great circle distance cos distinct(prd sin x)+(prd cos x)*cos(-/)y
805 area of triangle with sides x (Heron’s rule) sqrt prd(sum x%2)-0,x
806 arctangent y÷x atan y%x
807 complementary angle (arccos sin x) acos sin x
808 rotation matrix for angle x (in radians) counter-clockwise ((cos x;neg sin x);(sin x;cos x))
809 contour levels y at points with altitude x y -1+sum not y>x

Indexes

new description phrase
900 all indexes of vector x tc x
901 y-wide sublists of x y+til count[x]-y-1
902 sublists of length y, starting at x x+\:til y
903 all pairs of til[x] and til[y] ap:{x vs til prd x}x,y
904 indexes of an array ap shape x
905 scattered indexing x ./: y
906 raveled index from general index shape[x] sv y
907 index an arbitrary-rank array x . y

Mathematics

new description phrase
1000 Beta function gamma:prd"f"$1_til@
((gamma x)*gamma y)%gamma[x+y]
1001 number of combinations of n objects taken k at a time fac[n]%fac[n-k]*fac[k]
1002 number of permutations of n objects taken k at a time prd(n-k-1)+til k
1003 permutations (1 0#x){raze(1 rotate)scan'x,'y}/x
1004 invert permutation iasc x
1005 connectivity list from connectivity matrix rc[x;]where raze x
1006 connectivity matrix from connectivity list (2#x)#(til x*x)in x sv/:y
1007 node matrix from connection matrix b:flip each x=/:1 -1
(mmu\:) . "f"$(b;tc x)
1008 connection matrix from node matrix (-/)flip x=/:tc distinct raze x
1009 first y Fibonacci numbers y{x,sum -2#x}/0 1
1010 maximum separation of items of x (max x)-min x
1011 partitions of y with no part less than x part:{t:x _ til 1+floor y%2;(raze t,''t part'y-t),y}
1012 Pascal’s triangle x {0+':x,0}\ 1
1013 pointer chasing ((r*til p)mod p)\[1]
1014 polygon area 0.5*sum last[x]{(-/)y*reverse x}':x
1015 quadraticsolution q:0.5*y+signum[y]*sqrt(y*y)-4*x*z
(q%x),z%q
1016 saddle-point indexes rc[x;]where raze minmax x
1017 flag row minimums rn:{x=min each x}
1018 flag column maximums cx:{x=\:max x}
1019 flag minmaxs minmax:{(rn x)&cx x}
1020 row-column indexes of ravel-indexes y in matrix x rc:{(div;mod).\:(y;count first x)}
1021 value of saddle point raze[x]where raze minmax x
1022 set union distinct y,x
1023 set difference x except y
1024 set intersection x where x in y
1025 range union f:{(x b;1 rotate a b:0,where x>1+a:-1 rotate maxs y)}
flip f . flip asc x
1026 Taylor series sum y*(x xexp a)%prds 1|a:tc y
1027 value of Taylor series with coefficients y at x sum y*prds 1.0,x%1+til(count y)-1

Matrixes

new description phrase
1100 apply to dimension 1 function defined on dimension 0 f each x
1101 truth table of order x 2 vs til "j"$2 xexp x
1102 upper triangular matrix of order x {x<=\:x}til x
1103 lower triangular matrix of order x {x>=\:x}til x
1104 identity matrix of order x {x=/:x}til x
1105 Hilbert matrix of order x reciprocal 1+{x+/:x}til x
1106 empty row to start matrix of x columns ()
1107 main diagonal x ./:2#'tc x
1108 diagonals from columns (neg til 5)rotate'x
1109 columns from diagonals (til 5)rotate'x
1110 add vector y to main diagonal of x @'[x;tc x;+;y]
1111 extend distance table to next leg x('[min;+])\:x
1112 extend a transitive binary relation x('[any;&])\:x
1113 first column as a matrix x[;enlist 0]
1114 value of two-by-two determinant (-)over(x 0)*reverse x 1
1115 Shur product ((last shape x)#x) * (first shape y)#'y
1116 Shur sum ((last shape x)#x) + (first shape y)#'y

Miscellaneous

new description phrase
1200 zero items of x not flagged by y x*y
1201 zero items of x not in y x*x in y
1202 zero items of x not in y y*y in x
1203 replace items of y flagged by x with 1 y xexp not x
1204 replace items of y flagged by x with g @[y;where x;:;g]
1205 replace items of x with value y[0] with y[1] @[x;where x=y 0;:;y 1]
1206 replace first item of x with y @[x;0;:;y]
1207 replace last item of x with y @[x;-1+count x;:;y]
1208 limiting x between l and h, inclusive l|h&x
1209 change sign of y where x is 1 x*1 -1 y
1210 apply f over all of x (f//)x
1211 arithmetic precision of system in decimals reverse[string 10 xlog 3]?"."
1212 avoid parentheses using reverse reverse 1,count x
1213 count occurrences of x in y sum y=x
1214 count of x between endpoints (l,h) sum raze (x<h)&x>l
1215 cyclic counter 1+(1+til x)mod y
1216 insert x in y after index g y[til g+1],x,(g+1)_y
1217 insert row x in matrix y after row g (y,enlist x)iasc(tc y),g
1218 move x into first quadrant {x-min x}each x
1219 name variable according to x (`$x)set y
1220 y items selected with replacement from til x y?x
1221 y objects selected without replacement from til x neg[y]?x
1222 y-shaped array of numbers from x[0] to x[1]-1 y#x[0]+prd[y]?x[1]-x[0]
1223 randomize the random seed \S x
1224 remove y from x x except y
1225 remove every y-th item of x x where 0<(1+tc x)mod 3
1226 remove every second item x where(count x)#0 1
1227 remove leading, multiple and trailing ys from x a[0]_x where not a and 1 rotate a:x=y
1228 range; nub; remove duplicates distinct x
1229 right to left scan reverse(y\)reverse x
1230 y where x is 0 x+y*x=0
1231 select from y according to sign of x y 1+signum x
1232 select every y-th item of y x where 0=(1+tc x)mod 3
1233 items of x divisible by y x where 0=x mod y
1234 select from g based on index of x in y g y?x
1235 select x or y depending on g g'[x;y]
1236 selection by encoded list 2 vs x
1237 drop first, suffix 0 1_x,0
1238 drop last, prefix 0 -1_0,x
1239 shift x right y, fill 0 (y#0),neg[y]_x
1240 shift x left y, fill 0 (y _ x),y#0
1241 rotate rows left y rotate x
1242 rotate rows right neg[y]rotate x
1243 streak of numbers with same sign {1+(x;0)y}\[1;]differ signum x
1244 sum items of y by ordered codes g in x sum each((count[g]#0),y)value group g,x

Parts and items

new description phrase
1300 vector from items raze over x
1301 items from parts y _ x
1302 start flags from lengths (til sum x)in sums 0,x
1303 end flags from lengths (1+til sum x)in sums x
1304 start indexes from flags where x
1305 start indexes from lengths sums -1_0,x
1306 end indexes from lengths sums[x]-1
1307 start indexes for x fields of length y where 0=(til x*y)mod 3
1308 end indexes for x fields of length y -1+sums x#y
1309 lengths from start indexes 1_deltas where x,1
1310 reverse each part x reverse idesc sums tc[x] in y
1311 rotate each part x iasc y+sums y
1312 apply uniform function to each part raze x each(…)_y
1313 aggregate each part x each(…)_y
1314 maximums of parts flagged by y max each where[y]_x
1315 sums of parts with lengths y deltas sums[x] sums[y]-1
1316 sums of parts grouped by y value sum each x group y
1317 sums of parts flagged by y sum each where[y]_x
1318 running sums of parts flagged by y raze sums each where[y] _ x
1319 maximum sum of parts max 0 (0|+)\x
1320 find part y of parts beginning with first of x x where y=sums x=first x
1321 start indexes of equal-item parts where differ x
1322 end indexes of equal-item parts where(1_(<>)prior x),1b
1323 running parity of parts flagged by y raze(sums each where[x] _ y)mod 2
1324 groups of 1s flagged by y x&a|(<)prior a:(<>)scan y
1325 insert 0s after each part raze((0,where y)_y),'(0,x)#'0
1326 or-scan of parts flagged by y raze maxs each where[y]_ x
1327 and-scan of parts flagged by y raze mins each where[y]_ x
1328 gth part flagged by y (where[y]_x) g
1329 insert y after each item of x raze x,'y
1330 append y items g to each item of x raze x,\:y#g
1331 prepend y items of g to each item of x raze(y#g),/:x
1332 insert 0 after indexes y count[x]>iasc(tc x),y
1333 insert g copies of h after indexes y a:g*count y
(x,a#h)iasc(tc x),a#count y
1334 insert g copies of h before indexes y a:g*count y
((a#h),x)iasc(a#y),tc x

Polynomials

new description phrase
1400 polynomial with roots x {(x,0)-y*0,x} over 1,x
1401 polynomial product sum(tc x)rotate'(1_'zm x),'y*/:x
1402 polynomial derivative -1 _ x*reverse tc x
1403 value of ascending polynomial coefficients y at points x x sv\:y
1404 coefficients of best linear fit of points (x,y) (least squares) oa:{x xexp/:0 1}
cbf:{first(enlist y)lsq oa x}
1405 predicted values of best linear fit (least squares) oe:{x xexp\:0 1}
pvbf:{(oe x)mmu cbf[x;y]}
1406 coefficients of exponential fit of points (x,y) (*). exp(1;x)*cbf[x;log y]
1407 predicted values of exponential fit exp pvbf[x;log y]
1408 G-degree polynomial fit of points (x,y) a:x xexp/:til g+1
b:first(enlist y)lsq a
reverse b
1409 extrapolated value of abscissa x and ordinate y at g a:x xexp/:reverse tc x
b:(enlist y) lsq a
g sv raze b
1410 y-th moment of x c:count x
(sum(x-(sum x)%c)xexp y)%c

Rank

new description phrase
1500 rank of an array (number of dimensions) depth x
1501 shape of an array shape:{$[0=d:depth x; 0#0j; d#{first(raze/)x}each(d{each[x;]}\count)@\:x]}
1502 atom from 1-item vector first x
1503 vector from array (raze/)x
1504 vector from column y of matrix x[;y]
1505 1-row matrix from vector enlist x
1506 1-row matrix from atom or vector {$[0<type x;(1,count x)#x;1 1#x]}
1507 2-row matrix from two vectors (x;y)
1508 y-row matrix from vector x y#enlist x
1509 1-column matrix from vector 1#'x
1510 2-column matrix from two vectors x,'y
1511 2-column matrix from vector 2 cut x,(count[x]mod 2)#" "
1512 x-column matrix from vector y x#'y
1513 matrix with diagonal x x*{x=/:\:x}tc x
1514 increase rank of y to rank of x (depth[x]-depth y)enlist/y

Shape

new description phrase
1600 conform table x rows to list y s:(count y),count first x
s#(raze x),(prd s)#0
1601 conform table x columns to list y a:(count each(x;y))#0
a[;til count first x]:x
1602 empty vector ()
1603 y cyclic repetitions of vector x (y*count x)#x
1604 array with shape of y and x as its rows count[y]#enlist x
1605 replicate a dimension of rank-3 array x y-fold x[;raze(y#1)*\:til(shape x)1;]
1606 replicate y x times x#y
1607 join atom to each list item x,'y
1608 append y at the bottom of matrix x x,enlist y
1609 fill x to length y with x’s last item y#x,y#last x
1610 append empty row on matrix flip(flip x),'" "
1611 count items count x
1612 count atoms count raze over x
1613 first atom in x (first/)x
1614 count rows in matrix x count x
1615 count columns in matrix x count first x
1616 count columns in array x last shape x
1617 depth (rank) of an array phrases.q
1618 shape of an array phrases.q
1619 all axes of rectangular array x til depth x
1620 drop first y rows from top of matrix x y _ x
1621 drop first y columns from matrix x y _'x
1622 conditional drop of y items from list x (y*g)_ x
1623 conditional drop of last item of list x (neg g)_x
1624 remove columns y from x s:til each shape x
x . (-1_s),enlist(last s)except y
1625 transpose matrix x on condition y y flip/x
1626 transpose planes of three-dimensional x flip each x
1627 tree from depth;value tdv:{[d;v](1#v),(c _ d-1)tdv'(c:where 1=d)_ v}
1628 depth from tree dt:{0,/1+dt'[1_ x]}
1629 value from tree vt:{(1#x),/vt each 1_ x}

Sort and merge

new description phrase
1700 ordinals (ranking, all different) idesc idesc x
1701 ordinals (ranking, shareable) asc[x]?x
1702 choose grading direction x iasc x*1 -1[y]
1703 grade up x according to key y x iasc y?x
1704 playing order of x ranked players f:1+2 sv reverse tt neg floor neg 2 xlog x
f*f<=x
1705 sort x asc x, desc x
1706 sort y on x y iasc x
1707 sort rows of x on column y x iasc x[;y]
1708 sort ascending indexes x according to data y x iasc y x
1709 move flagged items to one end x idesc y
1710 sort y by value into x classes value asc y group x xrank y
1711 which class of y x belongs to -1+sum x>/:y
1712 assign x to one of y classes of width h, starting with g a:x where (x>=g)&x<g+y*h
@[;0;1_](g,a){x asc key x}group floor(g,a)%h
1713 merge x y by g (x,y)[iasc idesc g]
1714 mesh: merge x y z under control of g (x,y,z)rank g
1715 merge items from x and y alternately raze x,'y
1716 ripple shuffle x iasc idesc count[x]#0 1

Statistics

new description phrase
1800 maximum max x
1801 non-negative maximum max 0,x
1802 maximum of x with weights y max x*y
1803 minimum min x
1804 minimum of x with weights y min x*y
1805 average (mean) (sum x)%count x
1806 average (mean) of x weighted by y (sum x*y)%count x
1807 median of x t:.5*1-count x
.5*sum over x[(iasc x) (neg floor t;floor neg t)]
1808 standard deviation sqrt sum{x*x}[x-(sum x)%c]%c:count x
1809 variance (dispersion) sum {x*x}[x-(sum x)%c]%c:count x
1810 normal deviates from interval (0,1) x?1.
1811 running sum sums x
1812 moving sum y msum x

Strings

new description phrase
1900 alphabetic comparison x<y
1901 remove blanks x except " "
1902 remove trailing blanks (neg reverse[x=" "]?0b)_ x
1903 remove leading blanks x where maxs x<>" "
1904 remove leading and trailing blanks x{y _ x}/1 -1*(" "=1 reverse\x)?'0b
1905 collapse multiple blanks x where 1 rotate(or)prior a:x<>" "
1906 move blanks to end x iasc x=" "
1907 justify right neg[(reverse[x]=" ")?0b]rotate x
1908 center text x in line of width y neg[floor(y-count x)%2]rotate y#x,y#" "
1909 insert spaces in text -1_raze x,'" "
1910 conditional text $[x;"true";"false"]
1911 double quotes ssr[x;"\"";"\"\""]
1912 remove leading zeros ((x="0")?0b) _ x
1913 remove punctuation characters x except PUN
1914 ordinal of word in x pointed at by y sum not y<1+where x=" "
1915 find start of string x in string y y ss x
1916 find first occurrence of string x in string y first y ss x
1917 locate quotes and text between them (or)prior(<>)scan x="\""
1918 locate text between quotes (and)prior(<>)scan x="\""
1919 depth of parentheses sums({x-0b,-1_y}/)"()"=\:x
1920 first word in string x
1921 insert blank in y after flag in x raze y,'x#'" "
1922 insert x[i] blanks after y[g[i]] raze((0,1+g)_y),'(x,0)#'" "
1923 spread flagged field heads right x raze(count each a _ x)#'a:where y

Temporal

new description phrase
2000 is year x a leap year? ly:{sum[0=x mod\:4 100 400]mod 2}
2001 days in month x of Gregorian year y $[x=2;28+ly y;(0,12#7#31 30)x]
2002 date in ascending format "/"sv reverse 0 4 6_ x
2003 current time of 12-hour clock p:x>11:59:59
string[x-43200*p]," ","AP"[p],"M"
2004 current date, American format "/"sv string 1 rotate parse ssr[;".";" "] string x

Tests

new description phrase
2100 do ranges of x and y match? (~)over('[asc;distinct])each(x;y)
2101 quick membership for non-negative integers @[(1+max x,y)#0;y;:;1]x
2102 do x and y have items in common? any x in y
2103 is x a subset of y? all x in y
2104 does x match y? x~y
2105 do x and y match? x~y
2106 pairwise match 1 rotate(~)prior x
2107 are x and y permutations of each other? (asc x)~asc y
2108 is matrix x symmetric? x~flip x
2109 is matrix x antisymmetric? x~neg flip x
2110 is x upper triangular? zm[x]~x*{x>\:x}tc x
2111 is x lower triangular? zm[x]~x*{x<\:x}tc x
2112 is y a row of x? y in x
2113 are items integral? x=floor x
2114 are items even? not x mod 2
2115 is range of x 1? 1=count distinct x
2116 are items 1s and 0s only (boolean)? {t:abs type x; $[t~1;1b;t in 5 6 7 9h;all x in t$0 1;0b]}
2117 are items in interval [y)? (</')x<\:y
2118 are items integers in interval [g,h)? (x=floor x)&(</)x<g,h
2119 are items in interval [ y )? (<)over x<y
2120 are items in interval ( y ]? (<)over x<=y
2121 are items in interval ( y[0],y[1] ) (<)over x<y+0 1
2122 are items in interval [ y[0],y[1] (<)over x<y+1 0
2123 are items in ascending order? all(>=)prior x
2124 are items unique? x~distinct x
2125 does item differ from previous one?
2126 does item differ from next one? 1_ differ x
2127 is x a permutation? x~rank x
2128 is count of atoms 1? 1=count raze over x
2129 is x a vector? 0<type x
2130 is x empty? 0=count raze over x

Text

new description phrase
2200 left-justify fields of length y to length g raze g#/:((sums 0,-1_y)_x),\:g#" "
2201 right-justify fields of length y to length g raze(neg g)#/:(g#" "),/:(sums 0,-1_y) _ x
2202 collapse multiple occurrences x where 1 rotate(or)prior a:x<>y
2203 comma-separated list from matrix ","sv x
2204 rows starting with y x where x[;tc y]~\:y
2205 rows with items different from y max y<>flip x
2206 frame character matrix flip"-",'(flip"|",'x,'"|"),'"-"
2207 insert y "*" after "=" g:where x="="
raze((0,1+-1_ g)_x),\:y#"*"
2208 matrix from string at parts flagged by x a:(where y)_x
a,'#'[;" "]max[b]-b:count each a
2209 remove duplicate rows distinct x
2210 variable length lines (x;y;z)
2211 collapse whitespace x where{x|1_x,1b}max" "<>flip x
2212 remove blank rows x where max" "<>flip x
2213 remove leading blank rows ((min each x=" ")?0b)_ x
2214 remove trailing blank rows (neg sum mins reverse(and/)each x=" ")_ x
2215 remove blank columns x where max" "<>x
2216 remove leading blank columns sum[mins min x=" "]_'x
2217 remove trailing blank columns neg[sum mins reverse min x=" "]_'x
2218 append empty row flip(flip x),'" "
2219 insert empty row after row y a:flip(flip x),'" "
a rank@[count[a]#1;y+1;+;1]