j

iw: 20210504
lu: ????????

I've decided to continue learning J. I had months ago heard about it somewhere, then forgot or got up to other stuff, among other excuses. Installation via instructions provided in the wiki to access newest version. There exists an IDE called JQt. It runs on Android, ARM, iOS, GNU/Linux, Windows. Resources include:

Alternative attempts will be enumerated in comments; fixmes indicate incomplete problems and or unsatisfactory solutions. If your teeny-tiny brain can't handle opening and reading one of the above, I've written a small introduction.


My suboptimal, incomplete introduction to J Firstly, beware, the linguistic analogy is loose, (Western) European, and incomplete or too contingent. Don't bully it too-too much. A statement in J is called a sentence (S). And a phrase is part a sentence. It terminates with a(n OS-dependent) newline, and its constituents are called parts of sentence (PoS). Well, most of them, since no language, not even Lojban, contains control structures or statements as a primary or secondary. NB. is an initialism of the Latin 'nota bene', meaning 'note well', and it is used to start a comment, continuing until end of line. I am unaware whether it is a part of sentence, a control structure, or something else. J's REPL uses an indentation of 3 spaces for user input, which I'll use here only. Computation results are without. Lastly, along with all the other Iversonian array programming languages (for a comparison of some languages' features, see here, or check out each language's wiki or documentation: APL, BQN, Kx, K6unofficial, K3unofficial, Nial, Uiua), J parses: 1, from right to left; 2, without operator precedence, though parentheses take precedence (and I'll be using these to either explicate tacit code, to emphasise, or because necessitated); and, 3, usually greedily (read more about parsing in the J wiki, which PoS gobble such).

   - / 1 2 3 4 NB. = 1 - 2 - 3 - 4 = 1 - (2 - (3 - 4))
_2
   11 * 0 + 3 NB. = 11 * (0 + 3)
33

Lastly, to forgo umpteen resolves-tos and equals, I'll use the J dyadic primitive for 'match' (or exact copy; it takes shapes into account) '-:', which returns 0, false, or 1, true, to denote equality in value, parsing, result, or something else. I'll be giving examples of the PoS or concept and or of their usage.

   0 1 2 3 = 5 1 2 4
0 1 1 0
   0 1 2 3 -: 5 1 2 4
0

A noun (N) is a constant, a literal, an object, usually mathematical one: ±∞, NaN (indeterminate), numerals or numerics (booleans, reals, rationals, complexes, numeral of a base (any of), pi-based, radian-based, degree-based), strings (char array, though there is extended precision to UTF-4 and UTF-8, and with the unicode primitive 'u:'), boxes (a container type), all of any shape (a list (a 1-dimensional array) of non-negative values, roughly corresponding to something like a reduced matrix' column, row, and so on ranks, in a predefined order, always starting from row (because J is [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order), not all Iversonian or array programming languages are!)) or nestedness (boxes in boxes in ...), in addition the a special kind called a symbol, which is like a boxed string, but with special properties. All these are either scalars or arrays. The first haven't a shape (J has decided that shape of '0', or '0 0 0 ...' does not a scalar make, and I agree based on how I think of spaces. These despite their 0 length in each dimension or along each axis, exist in an #@\$-dimensional space.), the second do. The canonical left and right nominal arguments that are acted upon in definitions, covered later, are x and y.

   'Hello, world.' NB. N of shape of 13
'Hello, world.'
   1 2 3 NB. N of shape 3
1 2 3
   (0 $ 1) -: 1 NB. scalars are shapeless; $ shapes y's rank-1 items into x
0
   ('' $ 1) -: 1
1
   (1 $ 1) -: 1 NB. arrays have a shape
0
   i. 2 NB. N -: ([N] V N)
0 1
   {{1 + y}} 1 _ NB. V direct definition
2 _

A verb (V) is like a function in that it does something to something, that is, a noun. In J, verbs are 'monadic', 'dyadic', or 'nulladic' (words referring their arity, the number of arguments they accept; here, 1, 2, 0), depending on the primitive, or your V-definition.

   >: i. 2 3 NB. increment (by one) integers (of shape y)
1 2 3
4 5 6
   i: 4 NB. 'steps', or integers with their negatives
_4 _3 _2 _1 0 1 2 3 4
   2 ^ i:4 NB. exponentiation
0.0625 0.125 0.25 0.5 1 2 4 8 16
   % 5 10 20 NB. reciprocal
0.2 0.1 0.05
   */ $ i. >: i.10 NB. number of elements in array of shape 1 2 ... 10
3628800

An adverb (A) is a first-order higher 'function'. It modifies its left word or phrase to produce a derived entity, most often a verb. The verb or noun operand is canonically called u or m. In the common case, V' -: (V A). They're also commonly written without a separating space, even by clean coding veterans, which is how I'll proceed.

   i. 3
0 1 2
   ] \ i. 3 NB. monadically same, dyadically right using prefix, using prefix to apply v to sequentially to increasingly greater segments of y, starting from the the beginning
0 0 0
0 1 0
0 1 2
   2 ^ 3
8
   2 ^ ~ 3 NB. reflex, exchanges a V x and y, or copies y in absense of x
9
   (10 * >: i.2) */ (>: i.4) NB. table, returns array having entries (a u b) for every a in x and b in y/x->
10 20 30 40
20 40 60 80
   _ (1 2) } i.4 NB. amend, 'x m} y' amends y by creating a new noun that is a copy of y with the locations m replaced by new values x; very inefficient bc. not in place
0 _ _ 3

A conjunction (C) is a second-, third-, or fourth-order higher 'function', taking 2⸺4 PoS, argumentwise, and, doing something to or with those, can yield any PoS. The verb and noun to the right are canonically named v and n.

   ((+ & 2) ^: _1) 7 NB. ^: applies the left V and the right N times; negative reverse
5
   (2 & ^ , ^ & 2) 3 NB. & binds a dyadic V's x or y, creating a monad; beware greediness
8 9
   (7 8 9 &+  &. |.) 10 * i. 3 NB. 'under' applies v, then u, then the inverse of v to y (and x); not 3 7 11
19 28 37
   (2&* @ 10&-) 3 NB. @, @:, &, and &: compose verbs, rank- and action-wise they differ slightly, but significantly
20

A train is a sequence of PoS, which combine to a(nother) PoS. Linguistically, this makes no sense, afaik.
A hook is a V-only one, sometimes called a 2-train. V1 preprosseses y, before handing it off V2, which is dyadic, and, which in absense of an x, copies the original y as the other operand. That is, (x V2 (V1 y)) -: (x (V1 V2) y), and (y V2 (V1 y)) -: ((V2 V1) y).

   (2&* 1&+) 3 NB. add 1 from the right, then multiply by 2 from the right (and by self or x)
32
   (* *) _10 0 20 NB. multiply by sign, a crude absolute verb (opposite monadic primitive, |), which doesn't gel with complex numerals
10 0 20

A reverse hook operates similarly but in opposite direction, preprosessing with V2 and dyadically using V1. BQN has a primitive for this, whereas J doesn't. However, we can define one using definitions' left and right V:

   + {{v u}} -
- +

A fork is the second type of V train, also called a 3-train. ((v3 X) v2 (v1 Y)) -: (X (v3 v2 v1) Y) AND ((v3 Y) v2 (v1 Y)) -: ((v3 v2 v1) Y). V trains of more than 3 (or resolved PoS) alternate from the right to the left between hooks and forks: (V4 (V3 V2 V1)) is a hook with a preprosessing fork. Additionally, if you wish V2 to be monadic, you may use '[:', called cap, for the first tine of the fork.

   (2&* , 2&%) 4
8 0.5
   (+/ % #) i. 101 NB. arithmetic average of 0 thru 100; divide sum by length
50
   (< +:) 10 NB. -: (10 < (+: 10)) -: (10 < 2 * 10) NB. V2 is ambivalent, hence the need for a cap
1
   ([: < +:) 10 NB. -: (< (+: 10))
+--+
|20|
+--+

Assignment is done globally with =:, and locally with =.. Direct definitions of any PoS use {{...}} and are less of an eyesore than the dyadic define verb : , where x is the 0, 1, 2, 3, 4 for noun, adverb, conjunction, monadic verb, dyadic verb. Beware, the space before the colon is necessary (because of constant functions matching the regex '_?\d:', which return a number).

   q =: 2 (4 :'x + y + 10') 3 NB. dyadic (4) V, explicitly
_5
   w =: (3 : 'y % y ^ y') 4 NB. monadic (3) V, explicitly
0.015625
   0 : 0 NB. N (0) explicitly (0), followed by a block definition terminated with a single ), if you're using the define primitive.
   $ q=: 0 :0
1
2
3
)
6 NB. 3 stringized digits, 3 newlines
   7 (3) {{ |. ^: (x > y) (x <. y) + (i. 1 + m) * (m %~ | x - y)}} 2 NB. define an adverb to create a noun of length m+1, equidistantly spanning from the lesser to the greater of x and y
7 5.33333 3.66667 2
   1 :('|. ^: (x > y) (x <. y) + (i. 1 + m) * (m %~ | x - y)') NB. same adverb using inline definition with the primitive
   q =: +
   w =: -
   3 : '10 w (x q y)'
3 : '10 w (x q y)'
   13 :'10 w (x q y)' NB. define tacit (13) V, it notices the hook
10 w q
   13 : '10 w (x q y)' f. NB. 'fix' adverb replaces variables (once)
10 - +

NB. PROJECT EULER
NB.pe001
+/@~.@(#~(+/@(0&=)@(3 5&|)@,:]))i.1e3

NB.pe002
x:+/@(0&=@(2&|)#])@(4e6&>#])(1:`((],+/@(_2&{.))@$:@<:)@.*)1e2

NB.pe003
>./q:600851475143

NB.pe004
(>./@(((*/@(=|.)@":)"0)#])@,@(]*/]))1e2+i.9e2

NB.pe012
div1=:13 :'1{(0=q-<.q)#q=.y%(1+i.y-1)' NB. 1 fixme
div2=:13 :'(0=q-<.q)#q=.y%(2,>:@+:@i.@<.@(%&2))y' NB. 2 fixme
($:@>:`] @.(5e2<([:#(*/ .^"1(#:i.@(*/))@:>:)/@:(__&q:))))M.28 NB. 3 fixme
{{while.5e2>:([:#(*/ .^"1(#:i.@(*/))@:>:)/@:(__&q:))w=.+/>:i.y=.y+1 do.end.w}}499 NB. 4

NB.pe005
<./((0&=@(+/"1@:((>:i.20)&|)"0))#])(*/}.~.0{"1(q:>:i.20))*>:i.1e2 NB. num should contain prime factors at least once
{.(#~([:*./0=(2+i.9)&|)"(0))>:i.1e999 NB. 2
{{q=.2519 while.do.if.([:*./0=(2+i.19)&|)q=.q+1 do.q return.break.end.end.}}'' NB. 3

NB.pe006
(([:*:+/)-([:+/*:))>:i.1e2

NB.pe007
p:1e4

NB.pe008
(>./@:((13&(*/)\)@"."0))'73167176531330624919225119674426574742355349194934969835203127745...' NB. 1
([:>./13(*/)\[:,"."0@{&a.@,.@(10&~:#])@I.~&a.)2!:0'xclip -o' NB. 2

NB.pe013
((i.10)&{@":@x:@ +/)2!:0'xclip -o | tr \\n \ ' NB. 1
(i.10)&{":x:+/".;._1 LF,2!:0'xclip -o' NB. 2

NB.pe014
q=:{{if.1&<@:{:y do.((],(((-:@:[*0=2&|)+(>:@:(3&*)@:[*1=2&|))@:{:)))y else.]y end.}}
w=:(#@:~.@:(q^:_))"0
e=:w i.1e6
(e=(>./e))#i.1e6 NB. 1
(i.>./)(($:@((-:`([:>:3*])@.(2&|)@{.),>:@{:))  `{:@.(1&=@{.)"1)M.(>:i.1e6),.1 NB. 2

NB.pe016
([:+/"."0@":x:)2^1e3

NB.pe009 fixme
q=:3 :0 NB. 1
a=.<:y+i.(1e3-y)
s=.0=(a*(a-1e3))+(y*(y-1e3))+(a*y)-5e5
if.1=+./s do.(s#a),y end.
         ( ([:*/ ($ #: (i.&1e3@:*:) @: ,)  (]+/]+/]) ) { ])>:i.50
)
q(1&|.)^:(i.1e3)(i.1e3)
([:*/([:($#:(i.&1e3)@,)]+/]+/]){])*:>:i.1e3 NB. 2
((($#:(i.&1e3)@,)]+/]+/]){])*:>:i.1e2
{{for_q.>:i.1e3 do.for_w.>:i.1e3-q do.for_e.1e3-q+w do.if.(1e3=q+w+e)*.((+/*:q,w)=(e^2))do.q,w,e return.end.end.end.end.}}'' NB. 3

NB.pe029
#~.,(^/])2+i.1e2-1

NB.pe030
<:+/((((+/@:(^&5)@:>@:((,.&.":)&.>))=[)"0)i.1e6)#(i.1e6)

NB.pe034
3&-+/((((+/@:!@:>@:((,.&.":)&.>))=[)"0)i.1e6)#(i.1e6)

NB.pe035
+/@:(*/@:(1&p:)@:~.@:(((1&|.)&.":)^:(>:i.5))"0)((-.@:(+:/@:(0&=)@:>@:((,.&.":)&.>))"0)#])p:i.(_1 p:1e6) NB. 0s result in repeating lesser primes

NB.pe123
((((<:@:p:@:<:^[)+(>:@:p:@:<:^[))|~*:@:p:@:<:)"0)>:i.1e5 NB. NaN error?
(((<:@:p:@:<:&^[)+(>:@:p:@:<:&^[)|~*:@:p:@:<:)"0)>:i.1e3 NB. yields 2 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ... Bolano would be happy
((((<:@:p:@:<:^[)+(>:@:p:@:<:^[))|~*:@:p:@:<:)"0)>:i.1e5 NB. this should be the answer, but after the first 9 it's all 0s
<./@:(#&(>:@:(_1 p:1e6))q=:(1e10&<@:(((<:@:p:@:<:^[)+(>:@:p:@:<:^[))|~*:@:p:@:<:)@:x:@:>:@:i.)(_1 p:1e6)

NB.pe056
+/@:>@:((,.&.":)&.>)x:!.0(4^12)
([,:)^:(i.[) (i.5)
(([,:)^:(i.[)(i.5)) *"2 (i.5)...
>:>./,+/"1@(,.&.":)"0,.@x:@((((#,#)$])^])@:>:@i.)1e2 NB. 2
([:>:[:>./[:,[:+/"1@(,.&.":)"0,.@x:@((^/])@:>:@i.))1e2 NB. 3

NB.pe015
(*/21&+i.20)%(*/>:i.20)

NB.pe759 fixme
q=:(((((2+%)*$:)@-:@<:)+]`(+:@$:@-:))@.2&|)`1:@.1&=
7&+1e9|(+/@:*:q@:>:@i.)(x:1e16)

NB.pe100 fixme gigafail lmao you suck
p100=:3 :0 NB. 1; if inequality born from the ratio unmet, searches for increments either head or tail fixme stack error
q=.+:@(*<:)@{.y
w=.(*<:)@+/y
if.q=w do.<"0@(],+/)y
elseif.q>w do.p100((0 1)+y)
else.p100((1 0)+y) end.
)
q=:(+:@(*<:)@{.) NB. 2 stack error
w=:((*<:)@+/)
a=:((a@((1 0)+])`(a@((0 1)+]))@.(q>w))`(<"0@(],+/))@.(q=w))
a 1e12

q=:{{(i.@<.@-:y)&{@:(|.,.])@:>:@i.y}}"0 NB. 3 out of memory
w=:{{{.@((1r2&=)#(y&*@1:))(%/)@(*/)@(,:<:)@({.,+/)"1 y}}
(((0&<)#])@,@:(w@q)) 1e12&+@>:@i.1e2
q=:{{ NB. 3 stack error
x=.x:x
if.1r2=(x%(x+y))*((<:x)%(<:x+y))do.
x
elseif.x<y do.
(x+y-1)q 2
else.
(x-1)q(y+1)
end.
}}
1e12 q 2

NB. ((>:x)$:y)`(           )@.(0.5&>@{{x(((*<:)@[)%((*<:)@]))y}})
w=:{{if.0.5&<q=.x:x(((*<:)@[)%((*<:)@]))y do.(>:x)w y elseif.0.5&<q do. x w(>:y)elseif.0.5&=q do.x,y end.}}

w=:{{if.0.5&<q=.x:x(((*<:)@[)%((*<:)@]))y do.(>:x)w y elseif.0.5&<q do. x w(>:y)elseif.0.5&=q do.x,y end.}}
(4 :'[,]`[$:(>:@])@.(0.5&>q)`(>:@[)$:]@.(0.5&<q=:x:([(((*<:)@[)%((*<:)@]))]))') NB. noun result req'd

{{)d x,y`x$:(>:@y)@.(0.5&>q)`(>:@x)$:y@.(0.5&<)q=:x:(x(((*<:)@[)%((*<:)@]))y)}}

{{ if.0.5&<q=:x:(x(((*<:)@[)%((*<:)@]))y)do.(>:x)$:y elseif.0.5&>q do.x$:(>:y)else.x,y end.}}
x,y`x$:(>:@y)@.(0.5&>q)`(>:@x)$:y@.(0.5&<)q=:x:(x(((*<:)@[)%((*<:)@]))y)}}
w=:{{ if.0.5&<q=:x:(x(((*<:)@[)%((*<:)@]))y)do.(>:x)w y elseif.0.5&>q do.x w(>:y)else.x,y end.}}

w=:{{ if.0.5<q=:x:x(%&(*<:))y do.(>:x)$: y elseif.0.5>q do.x $:(>:y)else.x,y end.}}


1e11{{
while.1 do.
echo x,y
if.1>c=.0.5%~x:y([((%/&<:)*%)+)x do.y=.>.y%c
elseif.1<c do.x=.>.x*c
NB. elseif.1e3>x+y do.'x y'=.<.@{.,>.@{:*&(c%0.5)x,y
NB. elseif.50>x+y do.'x y'=.>:x,y
elseif.1e12>x+y do.'x y'=.>:x,y
elseif.1=c do.break.
end.
end.
x,y
}}1e11

2e11{{
while.1 do.
echo x:!.0 x,y,c
if.1>!.0 c=.y(0.5%~[((%/&<:)*%)+)x do.y=.x:!.0>.y%c
elseif.1<!.0 c do.x=.x:!.0>.x*c
elseif.1e12>x+y do.'x y'=.>:x,y
elseif.1=c do.break.
end.
end.
x:!.0 x,y
}}2e11

1e11{{
while.1 do.
  echo y,x,c=.(x:!.0)(y(0.5%~[((%/&<:)*%)+)x)
  if.1(>!.0)c do.
    y=.(x:!.0)>.y%c
  elseif.1(<!.0)c do.
    x=.(x:!.0)>.x*c
  elseif.1(=!.0)c do.
    if.1e12(>!.0)z=.x+y do.
      'x y'=.(x:!.0)>.(1e12%z)*x,y
      NB. y=.1.1*y
    else.
      NB. echo 756872327473
      x:y,x,c
      return.
    end.
  end.
end.
}}1e11


756872327473

707106781198
707106788769
746298170449
757683635495
757683635524
757684062019
771292964228

NB. 3e11{{
NB. if.1e12(>!.0)z=.x+y do.'x y'=.x:>.(1e12%z)*x,y
NB. echo x,y end.
NB. while.1 do.
NB.   echo x,y,c
NB.   if.1(>!.0)c=.x:(y(0.5%~[((%/&<:)*%)+)x) do.y=.x:>.y*%c
NB.   elseif.1(<!.0)c do.x=.x:>.x*c
NB.   elseif.1(=!.0)c do.y return.
NB.   end.
NB. end.
NB. }}1e11




1e11{{
NB. while.1e12>x+y do.echo x,y if.1>c=.0.5%~y([((%/&<:)*%)+)x do. 'x y'=.>.x,y^%c elseif.1<c do. 'x y'=.>.x,y^c else. 'x y'=.1+x,y end.end.
while.1e12>x+y do.
echo x,y
if.1>c=.0.5%~y([((%/&<:)*%)+)x do.'x y'=.>.(x,y)*%c elseif.1<c do.'x y'=.>.(x,y)*c else. 'x y'=.1+x,y end.end.
NB. while.1e12>x+y do.echo x,y if.1>c=.0.5%~y([((%/&<:)*%)+)x do. 'x y'=.>.x,y*c elseif.1<c do. y=.>.y^c else. 'x y'=.1+x,y end.end.
while.1 do.
if.1>c=.0.5%~y([((%/&<:)*%)+)x do.y=.>.y%c
elseif.1<c do.x=.>.x*c
NB. elseif.1e12>x+y do.'x y'=.>:x,y
elseif.1=c do.goto_q.
end.
end.
label_q.x:x,y
}}1e11


84{{
NB. while.1 do.
for.i.45 do.
  echo x,y,c
  if.0.5(>!.0)c=.x([:(x:!.0)[((%/&<:)*%)+)y do.
    x=.(x:!.0)>.x*(0.5%c)
  elseif.0.5(<!.0)c do.
    y=.(x:!.0)>.y%(0.5%c)
  NB. elseif.0.5(=!.0)c do.
  elseif.0.5-:c do.
    if.1e12(>!.0)z=.(x:!.0)x+y do.
      'x y'=.(x:!.0)>.(1e12%z)*x,y
    else.
      echo 756872327473
      (x:!.0)y,x,c return.
    end.
  end.
end.
}}32

{{
NB. ([:*/(([:(,<:){.)%([:(,<:)+/)))15 6
([:*/(([:(,<:){.)%([:(,<:)+/)))y
}}x:1e12

NB.pe044
p=:-:@(3&*@*:-])"0
P=:(0:`{.@.(>.=<.))@{.@({:@:>@p.@(_1&*@+:,_1:,3:))"0
q=:}:@(],.(>:@i.))"0
(<./@(-/"1)@((*./@:*)"1#])@(P@(+/,-/)"1@:p@q)) NB. slow

NB.pe045
t=:-:@(*:+])"0
P=:(_.&*`{.@.(>.=<.))@{.@({:@:>@p.@(_1&*@+:,_1:,3:))"0
H=:(_.&*`{.@.(>.=<.))@{.@({:@:>@p.@(_1&*@],_1:,2:))"0
{.@}.@~.@:(0:`]@.(0&<@H*.0&<@P)@t)286&+i.1e5

NB.pe046
(12&=@#@~.@,@:q:)
(_.&*`]@.(12&=)@#@~.@,@:q:@:((i.@4:)+]))
~.@,@:((0:`]@.(12&=)@#@~.@,@:q:@:((i.@4:)+]))"0)
((((12&=)@#@:q:@((i.@4:)+]))"0)#])>:i.1e3

NB.pe036 1
ip=:*./@:(({.={:)"1@:{~((,.-@>:)@i.@<.@-:@#))
NB. 04+/@~."1@:(0:`(0:`]@.(ip@#:))@.(ip@(,.&.":))"0) i.1e6
1e10|+/@([:(]^])([:>:i.))@x:1e3
NB. 2
([:+/(#([:*./"1[:>(*/@(=|.)@":)&.>@((2&((([:>.[^.])#[)#:]);]))"0)))>:i.1e6

NB.pe057
+/({.>{:)"1#@":"0@x:(({:,0:)++/)^:(i.1e3)(x:1 1)

NB.pe053
(+/@,@:(1e6&<@((!@{.)%((!@{:)*(!@({.-{:))))"1@(],.>:@i.)"0))>:i.1e2

NB.pe055
+/@:-.50(q=:{{(((<:x)&q@])`0:@.(0=x))`1:@.(*/@(=|.)@":)@(+(|.&.":))x:y}}"0)i.1e4

NB.pe063
+/(3 :'(+/@(((10^(<:y))&<:)*.((10^y)&>))@((>:i.9)^]))y')"0 i.25

NB.pe778
q=:4 :'x((9+1e9)&|@((('' ''&~:)#])&.":)@(]`(_1&{&.":)@.(9&<)"0@(*&("."0@":))))y'
vari=:[{."_1]A.~#@:]([(]*i.@:%)&!-)[ NB. https://code.jsoftware.com/wiki/Phrases/Sets
w=:4 :'x+/@(q/"1@~.@vari(,])@(>:@i.))y' NB. works for small x y domain error on vari⸻find/devise more efficient gen, slow for 7 w 5

NB.pe040
*/"."0((10^i.6)&{@(' '&~:#])@":)i.10^(($:@>:)`]@.(6&<:@#@":@(+/)@:(((10&^)-(10&^@<:))*])@x:))1 NB. log10 of integers to generate for at least 1e6 digits

NB.pe041
>./@(((*./@:((>:@i.@#)e.("."0)))@":"0)#])p:i.(_1 p:2e9)

NB.pe076
p=:3 :0"0
if.0=y do.1:y
elseif.0>y do.0:y
else.
NB. (({.+i.@>:@-~/)@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)
NB. +/@:p/(((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)y
NB. (+/@:p@:((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)y

for_k.(((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)y do.
(p(y&-@-:@    3*k^2-k   ))*_1^(k+1)

+/@:(((p@(-&y)@-:@(*(<:@*&3)))*(_1:^>:))"0@((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)y
end.
end.
)

(((+/@:p@:((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)`0:)@.(0&>))`1:@.(0&=)
(#@~.@("."0@":@,))q NB. min amount of digits
(i.9)(]-.~-.)((~.@("."0@":@,))q)NB. missing numbers

NB.pe079
q=:NB. xp -o|tr \\n \ |xp

NB.pe193
8&+@(+/)@:((+./@:=&0@(|~((*:@p:@i.@(_1&p:)@(_4&p:)@%:))))"0)11&+i.2^50 NB. 1 limit error don't look up primes for each number, ffs
((*:@p:@i.@(_1&p:)@(_4&p:))2^25)([:<:[:#[:~.[:,[*(>:@i.@<.@(]%[)))2^50 NB. 2 limit error aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
{{for_q.(*:@p:@i.@(_1&p:)@(_4&p:)@%:)2^50 do.w=:~.@(w&,)@(q&*)@>:@i.@<.2^50%q end.}}w=:0 NB. 3 ???
{{for_q.(*:@p:@i.@(_1&p:)@(_4&p:)@%:)2^50 do.w=:w,((q&*)@>:@i.@<.2^50%q)end.}}w=:0 NB. 4 ???
(#@~.@,@{{(((>:@i.@<.(y&%))*])@*:@p:@i.@(_1&p:)@(_4&p:)@%:)y}})2^50 NB. 5 limit error

NB.pe065
(+/@("."0@>@{.@(<;._1)@('r'&,)@":))@+&2@(3 :'(((1:%({.+($:@}.)))`(x:@%))@.(1:=#))y')(99&{.(1,([,1,1,])/+:@>:@i.4e1)) NB. 1
(+/@("."0@>@{.@(<;._1)@('r'&,)@":))(+%)/x:(100&{.(2,1,([,1,1,])/+:@>:@i.4e1)) NB. 2

NB.pe796 fixme
q=:(!@{.%!@{:*!@-/)"1 NB. binomial coefficient    (x: q 54 13) * w -: 4  NB. exactly 4 suits
(]i.(>./))(q (54,.(13+i.41)))*(w0*42%(41+ -i.41)) NB. amount of combinations * chance for full suit + extra cards      index of greatest number, that is, with highest probability; 15
w0=:x:*/%/"1(13 2$ 52 54 12 53 11 52 10 51 9 50 8 49 7 48 6 47 5 46 4 45 3 44 2 43 1 42) NB. P 13 of same suit sequentially
(q 54,c) * (w0*42%(42-c)) NB. solve c for maximum, somehow

NB.pe074
([:+/60&=@{{$:`#@.([:+./{.E.}.)@(q,])y}}@(q=:[:+/ x:@!@"."0@":@{.)"0)i.1e6

NB.pe043
([:+/".@(([:(7#0)&-:|~&(p:i.7)@([:}.3".\":))#])"1)@(i.@!@#A.i.@#C.])'0123456789'

NB.pe698 fixme
is123=:{{)m(  "."0@":)y}}
([:+/((1,2,3)&e.@])@"."0@":)1112            (((1:,2:,3:)e.])@"."0@":) 1112
   (3 3 3 3 3 #: i.30)

NB.pe254 fixme
f=:([:+/!@"."0@":)
s=:([:+/"."0@":)

NB.pe080 fixme
("."0@":x:!.0@*&1e100@%:)1e2

NB.pe064 fixme
(([:+/(2&|)@{{$:`(<:@#)@.({.e.}.)@((1&|@%@{.),])y}}"0@(~:&0#])@(1&|)@:%:))>:i.1e4 NB. 1 fails ultimately bc. of comparison tolerances
(([:+/(2&|)@{{$:`(<:@#)@.([:+./{.(1e_3(1 :'|@-<:!.0 m*>.&|'))}.)@((1&|@%@{.),])y}}"0@(~:&0#])@(1&|)@:%:))>:i.1e4 NB. 2 https://code.jsoftware.com/wiki/Essays/Tolerant_Comparison#Models
(([:+/(2&|)@{{$:`(<:@#)@.([:+./{.(1e_4(1 :'|@-<:!.0 m*>.&|'))}.)@((1&|@%@{.),])y}}"0@((0&<@(1&|))#])@:%:))>:i.1e4 NB. 3 ???

NB.pe487 fixme
+/(p:({.+i.@{:)({.,-~/)(p:^:_1)4 p:(],2e3&+)2e9)|1e4([:+/[:+/]\@:>:@i.@]^[)1e12 NB. 1
+/(p:({.+i.@{:)({.,-~/)(p:^:_1)4 p:(],2e3&+)2e9)|([:+/@:((>:@i.@-@#)*])>:@i.@{.^{:)1e12 1e4 NB. 2 big nombr make memori go kthxbai

NB.pe160 fixme
({{((-@>:@i._5)&{`($:@}:))@.(=&'0'@{:)y}}@":@x:@!)1e15
{{(-@>:@i._5)&{`($:@}:)@.(=&'0'@{:)y}}@":@!x:!.0(1e15)

NB.pe050
({.@((>./@/:@{:@|:){])@(1&p:@{.#])@(1e6&>@{.#])@,@([:(+/,([:+/#@>&0))\"1($$(([:,<:/~@(>:@i.@#))*,))@((1&|.)^:(i.@#))@p:@i.@(_4&p:)))1e6

NB.pe120
(>:i.1e3)([:+/([:>./(*:@])|((<:@]^[)+(>:@]^[)))"1 0)(3&+i.998x)

NB.pe119 fixme
q=:{{if.1<z=.([:+/"."0@":)y do.+./y=z^(>:@i.(<.z^.y))else.0:y end.}}"0
{{if.q y do.if.x=1 do. y return.else.(<:x)$:(>:y)end.else.x$:>:y end.}}10
([ $: >:@])`((<:@[ $: >:@])`]@.(1:=[))@.(q)
 2    (3 :'([ $: >:@])`((<:@[ $: >:@])`]@.(1:=[))@.(q)')10

NB.pe235
0j12":>{:p.6e11,(9e2-3*])2+i.5e3-1 NB. obscenely heavy
(I.1&=(_5e3 5e3)I.((6e11,(9e2-3*])2+i.5e3-1)p.z))#z=:1.002(1e6){{(x<.y)+(i.1+m)*(m%~|x-y)}}1.0024 NB. nah
q=:((6e11,(9e2-3*])2+i.5e3-1)&p.)
rbm=:{{ NB. root bisection method
N=.0
M=.1e9 NB. max iterations
t=.1e_14 NB. tolerance
a=.1.0 NB. lower bound
b=.1.1 NB. upper bound
while.N<M do.
c=.-:a+b
if.(0=Q=.u c)+.(t>(-:b-a))do.0j12":c return.end.
N=.1+N
if.Q((=&*) u)a do.a=.c else.b=.c end.
end.
0:y
}}
q rbm ''

NB.pe802 fixme
q=:(((2^~{.)-{.-2^~{:),(1p1-{:+[:+:{.*{:))
F=:{{
N=.0
w=.y
whilst.w~:y do.
w=.q w
N=.1+N
end.
N
}}

NB.pe145 fixme
((([:*./e.&'13579')@":)"0@((0~:])#])@,@:((+(((('0'~:{.)#])@|.)&.":))"0))

NB.pe089
q=:];._1 LF,2!:0'cat p089_roman.txt'
(('IVXLCDM'e.~])#])

NB.pe011
x:>./(([:>./[:([:>./4*/\])(],|:)),([:>./[:([:>./4*/\])/.(],|:)))".;._1 LF,2!:0'xclip -o' NB. 1
>./4*/\;(</.@|.,</.,<"1,<"1@|:)(20 20)&$@".2!:0'xclip -o|tr \\n \ ' NB. 2

NB.pe010
+/p:i._1 p:2e6

NB.pe033 fixme
(((]%[)=(((([:-.+./&|:@:="1 0)#])%(([:-.+./&|:@:="0 1)#[))&("."0@":))) #])/"1 ((([:+./'0'&~:@{:@":"0)*.(~:/)"1)#])"1 >,(([:<[,])"0 0/])1e1&+i.1e2-1e1

NB.pe466 fixme
64([:#[:~.[:,*/&(>:@i.))1e16 NB. 1

NB.pe343 fixme
1&(((>:@[%(>:@[+.<:@]))$:(<:@]%(>:@[+.<:@])))`(%&])@.((]=<.)@%&]))^&3>:i.2e6 NB. fail to assign values, fail fail fail, i am failure, hear me whimper; extremely inefficient, out of memo for just the example

NB.pe022
+/(*>:@i.@#)([:+/(<:a.i.'A')-~a.&i.)&>/:~(<@}.@}:);._1',',1!:1 <'/tmp/p022_names.txt'

NB.pe092
+/(($:`(0:`1:@.(89=]))@.([:+./1 89=])[:+/*:@"."0@":)"0)>:i.1e7

NB.pe091 fixme
+/((]=<.)#])(([:%:[:*/-:@(+/)-0:,])"1)|:((>:,],:]),.(<:,],:]))(>:@i.@>.@%&3)1e9 NB. 1 outta memory and wrong
3 comb 51
   ((   (({.=(+/@}.))@:*:)#])@ \:~)"(1) 2 3 $ 3 4 5 3 4 6
      (((({.=(+/@}.))@:*:)#])@\:~)"(1) 3
(,.],.])i.51 NB. 2

NB.pe127 fixme
([:|:[:(i.2)&{   (i.3)&(|."0 _))

>,..{(i.1.2e5);(i.1.2e5);(i.1.2e5)
"1

*./
[:+./"1
0&{<1&{
'q w e'=.
([:*/[:~.q:)

NB.pe847 fixme
NB. (2&+`1&+@.([:+./1&=))    "0
R=:".@#&'1'
h=:[:+/>.@-:@((<:@{.),}.)@\:~ NB. fixme
H=:{{
[:+/
for_q.>:i.y-2 do.end.
}}
{{for_q.>:i.y-2 do.for_w.>:i.y-1+q do.echo (+/,__,])q,w,(y-q+w) end.end.}} 5
{{a=.0 for_q.>:i.y-2 do.for_w.>:i.y-1+q do.a=.a+h q,w,(y-q+w) end.end.a}} 5

NB.pe025
>:(i.1e3"_)#@":"0{{(],[:+/(_1 _2)&{)^:(y-2)(1x&,^:2)''}}6e3

NB.pe049
    p:({.+i.@}.) p:^:_1(4 p:1e4),(_4 p:1e5)
NB. (( any cycle  )#])???

NB.pe074 fixme
([:+/!@"."0@":) @. (???)  (i.1e6),.1 NB. 1

NB.pe551
{{{:(],[:+/"."0@":)^:y 1x,''}}1e6 NB. 1
{:>@{:@{{($:@(<:&.>@{.,((],([:+/"."0@":))&.>@{:)))`]@.(1&=@>@{.)y}}M.(1e6-2);1 NB. 2 fixme
NB.pe413 fixme
{{w=.0 for_q.i.y do.w=.w+(([:(1=#)[:(#~(0=z|]))[:;[:"."1&.>[:([:(((-@i.@#@(#~((32{a.)~:]))@{.){]))[:|.(]\))&.>[:<"1(1&}.)^:(i.z=.#q))q=.":q)end.<:w}}1e19 NB. 1.1 too big an input, RIP RAM
{{'qq w'=.0 while.y>q=.qq=.>:qq do.w=.w+(([:(1=#)[:(#~(0=z|]))[:;[:"."1&.>[:([:(((-@i.@#@(#~((32{a.)~:]))@{.){]))[:|.(]\))&.>[:<"1(1&}.)^:(i.z=.#q))q=.":q)end.w}}1e7 NB. 1.2 constant space idem

NB.pe017 fixme annoying
{{
NB. teens                            (1[0-9])$
z=.0++/(10*3 6 6 8 8 7 7 9 8 8)
NB. multiples of ten                ([2-9])\d$
z=.z++/(10*10*6 6 5 5 7 6 6)
NB. terminal non-zero digit, hundreds ([1-9])$ ([1-9])\d\d$
z=.z++/(((1e2&*),([:1e2&*7&+))3 3 5 4 4 3 5 5 4)
NB. and
z=.z+(9*10*10-1)*3
NB. 1e3
z=.z+11
NB. missing 217..?
}}''

NB.pe345 fixme
{{
'a r'=.0
z=.{{
if.1=#y do.
r=:r,+/a,y
a=:0
return.
end.
for_q.i.#y do.
for_w.i.#y do.
r(a=:a,(<q,w){y)z(([:((<"0((#~w&~:)(i.#y)))&{&.|:)(<"0((#~q&~:)(i.#y)))&{)y)
end.
end.
>./r
}}".;._1(10{a.),2!:0'xclip -o'

NB.pe345 fixme
([:+/1=[:"."0[:":i.)
{{while.do.end.}}

NB.pe101 fixme
q=:1 _1 1 _1 1 _1 1 _1 1 _1 1
NB.    q p.1+i.11
NB. 1 683 44287 838861 8138021 51828151 247165843 954437177 3138105961 9090909091 23775972551

NB.pe047
{{while.do.if.([:*./4=[:#@~.@q:0 1 2 3+])y do.break.else.y=.y+1 end.end.}}2

NB.pe048
10e10|+/^~x:1+i.1e3

NB.    ( (2=([: +/"1  (="1 0 ~.) ) ) # ~.) ,q
NB. ( (2=([: +/"1  (="1 0 ~.) ) ) # ~.) , (-/]) (#~(4=[:#[:~.[:"."0":)"0) @ ([: p: [: i. [: (-/ - {:)  p:^:_1) (_4 p:1e4),(4 p:1e3)
{{
for_q.</.|. (-/]) ([: p: [: ( ([:i.-/) + {:) p:^:_1) (_4 p:1e4),(4 p:1e3) do.
>q
    ([: (([:i.-/)+{:) p:^:_1) (_4 p:1e4),(4 p:1e3)
echo q
end.
}}''
(#~a:&~:)( (2=([: +/"1  (="1 0 ~.) ) ) # ~.) &. > </.|. (-/]) (#~(4=[:#[:~.[:"."0":)"0) @ ([: p: [: ( ([:i.-/) + {:) p:^:_1) (_4 p:1e4),(4 p:1e3)
(#~a:&~:)( (#~ 2&=) ([: +/(=/])))  (-/]) (#~(4=[:#[:~.[:"."0":)"0) @ ([: p: [: ( ([:i.-/) + {:) p:^:_1) (_4 p:1e4),(4 p:1e3)
(#~ ( (3 = [: +/"1 [: , ="0 1)"1))  (-/]) (#~(4=[:#[:~.[:"."0":)"0) @ ([: p: [: ( ([:i.-/) + {:) p:^:_1) (_4 p:1e4),(4 p:1e3)
(#~ ( (3 = [: +/"1 [: , ="0 1)"1))  |: (-/]) (#~(4=[:#[:~.[:"."0":)"0) @ ([: p: [: ( ([:i.-/) + {:) p:^:_1) (_4 p:1e4),(4 p:1e3)
(#~ (3=[:+/(=/])))  (-/]) (#~(4=[:#[:~.[:"."0":)"0) @ ([: p: [: ( ([:i.-/) + {:) p:^:_1) (_4 p:1e4),(4 p:1e3)

( [: (#~ (2 = [: +/ (=/ ])))"1 (| (-/ ]) [: (#~ (4 = [: # [: ~. [: "."0 ":)"0) [: p: [: (([: i. -/) + {:) p:^:_1) ) (_4 p:1e4),4 p:1e3
(#~ (2=[:+/(=/])))"1 | (-/]) ([: (#~(4=[:#[:~.[:"."0":)"0) [: ] [: ] ])   1487 1123 2231 44444 5798 4817 8147

( [: (#~ (    (2 = [: +/ (=/ ]))"1 @ (| (-/ ]))    )) ( [: (#~ (4 = [: # [: ~. [: "."0 ":)"0) [: p: [: (([: i. -/) + {:) p:^:_1) ) (_4 p:1e4),4 p:1e3
(#~(2 <: [: +/ 2 = [: +/ (=/ ]))"1)  > {:  ( [: {{ ({~(-@#@$)<\#@$#i.@#)"(#$y) ( (_1&|.) ^: (i.@#) y) }} (| (-/ ])) ) &. > qq,<1487 4817 8147 9


{{Y=.''
for_q.w=.([: (#~ (4 = [: # [: ~. [: "."0 ":)"0) [: p: [: (([: i. -/) + {:) p:^:_1)(_4 p:1e4),4 p:1e3 do.
Y=.Y , <  ( (#~ ([: *./"1 (":q) e. ":)"0)) w NB. /:~
end.
Y=.~.Y
NB. for_q.<;._1 Y do.
NB.  NB. echo (#~ (    (2 = [: +/ (=/ ]))"1 @ (| (-/ ]))    ))  >q
NB. echo (#~(2 <: [: +/ 2 = [: +/ (=/ ]))"1)  > {:  ( [: {{ ({~(-@#@$)<\#@$#i.@#)"(#$y) ( (_1&|.) ^: (i.@#) y) }} (| (-/ ])) ) &. > q
NB. end.
for_q.~.Y do.
 NB. echo (#~ (    (2 = [: +/ (=/ ]))"1 @ (| (-/ ]))    ))  >q
NB. echo (#~(2 <: [: +/ 2 = [: +/ (=/ ]))"1)  > {:  ( [: {{ ({~(-@#@$)<\#@$#i.@#)"(#$y) ( (_1&|.) ^: (i.@#) y) }} (| (-/ ])) ) &. > q
echo (#~(2 <: [: +/ 2 = [: +/ (=/ ]))"1)  > {:  ( [: {{ ({~(-@#@$)<\#@$#i.@#)"(#$y) ( (_1&|.) ^: (i.@#) y) }} (| (-/ ])) ) &. > q
end.
,.Y
}}''

   ] zz=: ,. (#~ a: & ~: )    ,             (#~ (3 <: #))&.> NB.z=.{{...}}


([:     {{+./,(({.~([: I. 0&=))y)="0 1|(}.~(1 + [: I. 0&=))y}}"1    (-/]) ) 0 10 20 25 200
0 10 20 30 40

NB.pe149 fixme
{{>./>{."1\:~(0&>:+/;._2])&.>"0(</.,([:</.|.),([:<"1|:),<"1)y}}q NB. 3580522
{{>./;+/L:0(0&<]/;.2])&.>(#~(1<#@>))(</.,([:</.|.),([:<"1|:),<"1)y}}q NB. 277570854
{{([:>./[:;^:2[:([:(0&=([:<+/);._2])(0($#:[:I.0>])@]}]))L:0(</.,([:</.|.),([:<"1|:),<"1))y}}q NB. 6029868
{{([:>./[:;^:2[:(0&=([:<+/);._2])L:0(</.,([:</.|.),([:<"1|:),<"1))y}}q NB. 6029868
{{([:>./[:+/S:0[:(0&>:<;._1])L:0(</.,([:</.|.),([:<"1|:),<"1))y}}8 8$,q NB. 277570854
{{([:>./[:;[:([:+/S:0[:(0&>:<;._1])(*0&<))L:0(</.,([:</.|.),([:<"1|:),<"1))y}}q NB. 6029868
{{([:>./[:;[:([:+/"1([:>'0'&chopstring)&.":&(*(0&<))) L:0 (</.,([:</.|.),([:<"1|:),<"1))y}}q NB. 3690479
{{([:>./[:;[:([:+/S:0[:(((2</\(([:|.1+i.@#)*(0&<))),{:)<;._1])(*0&<))L:0(</.,([:</.|.),([:<"1|:),<"1))y}}q NB. 6029868
{{([:>./[:;[:([:+/S:0((_1|.((2</\]),{:))@(0&<))<;.1(*0&<)) L:0 (</.,([:</.|.),([:<"1|:),<"1))y}}q NB. 6029868

q=.(2#2e3)$,(s=.{{if.56>y do.(5e5-~1e6|100003 _200003 0 300007 p.])y else.5e5-~1e6|1e6+(s y-24)+s y-55 end.}}"0 M.)1+i.2e3^2

52852124
^
277570854
48519449
6029868
5903977
5918647

NB.pe051
{{
for_digitNumber.2+i.8 do.
primes=.([:":[:,.[:p:[:({:+([:i.-/))((_1 p:10^>:),(_1 p:10^])))digitNumber
for_subtitutedDigitNumber.>:i.digitNumber-1 do.
for_constantDigitPattern.subtitutedDigitNumber{{q=.((w=.y-x)$<i.0 0),<i.1 0 for.i.x do.q=.(i.>:w),.&.>,&.>/\.>:&.>q end.;q}}1+digitNumber do.
substitutionPattern=.((i.1+digitNumber)(([:-.e.)#[)constantDigitPattern)
for_prime.primes do.
if.8=#z=.(#~1&p:)".('0123456789'substitutionPattern}])&.|:(10,(1+digitNumber))$,prime do.<./z return. end.
end.
end.
end.
end.
}}0

NB.pe309 fixme
{{
for_y.1+i.y do. NB.x
for_x.1+y+i.y-y do. NB.y
w=.-:(y*1&o.z)+(x*1&o.0.5p1-z)
w=. (0.5^~[:-/2^~])

h=(1&o.z)=(1&o.0.5p1-z)
(1 o.(,-&0.5p1))z

x*(?)

end.end.
}}2e2


NB.pe183 fixme
+/ (-`]@.([:  (2&x:([:+./~:)2 x:!.0])  [:>./[:([:*/[#]%[)/"1(,.~(1+i.)))"0)  5+i.1+1e4-5 NB. _49995838 very wrong, also wrong for 5⸺1e2
NB. +/ (-`]@.([:  (2&x:([:*./~:!.0)2 x:!.0])  [:>./[:([:*/[#]%[)/"1(,.~(1+i.)))"0) 5+i.1+1e2-5 NB. same
NB. +/ (]`-@.([:  (2&x:([:+./~:)2 x:!.0])  [:>./[:([:*/[#]%[)/"1(,.~(1+i.)))"0) 5+i.1+1e4-5x NB. nope
NB. (+/!.0) (-`]@.([:  (2&x:([:*./~:!.0)2 x:!.0])  [:>./[:([:*/[#]%[)/"1(,.~(1+i.)))"0) 5+i.1+1e2-5 NB. nope
NB. (+/!.0) (-`]@.([:  (2&x:([:*./~:!.0)2 x:!.0])  [:>./[:([:*/[#]%[)/"1(,.~(1+i.)))"0) 5+i.1+1e2-5x NB. nope
NB. (+/) (-`]@. (  ([:  ( (2 x:!.0])([:*./=)(2&x:)  )  [:>./[:([:*/[#]%[)/"1(,.~(1+i.)))"0) ) 5+i.1+100-5x NB. nope

NB.pe182 fixme
$ (#~ (1=+.&f)) (1+[:i.-&2) f=.*/<:'p q'=.19 37

NB.pe096 fixme
(9 9)&$"1 ;"1 ((10*i.50)+"(0 1)1+i.9) { <;._1 LF, 1!:1<'/tmp/p096_sudoku.txt' NB. my solver sucks ass

NB.pe099
($#:[:I.[:(>./=]),)([:x:[:({:*([:^.{.))".);._1 LF,1!:1<'/tmp/0099_base_exp.txt'

NB.pe113 fixme
+/((([:*./2<:/\])~:([:*./2>:/\]))([:"."0":))"(0)i.1e6 NB. 12897
+/,(((([:*./2<:/\])~:([:*./2>:/\]))([:"."0":)),(1=[:#[:~.":))"(0)i.1e6-1 NB. 12951
+/,(((([:*./2<:/\])~:([:*./2>:/\]))([:"."0":)),(1=[:#[:~.":))"(0)i.1e100-1 NB. head death of the universe?
{{'q w'=.0 while.y>q=.1+q do.w=.w++/(((([:*./2<:/\])~:([:*./2>:/\]))([:"."0":)),(1=[:#[:~.":))q end.w}}1e6 NB. 12951

NB.pe061 fixme
p3=.(-:*>:)
p4=.(*~)
p5=.(-:*(1-~3&*))
p6=.(*(1-~2&*))
p7=.(-:*(3-~5&*))
p8=.(*(2-~3&*))
P3=.(#~(1e3&<:*.9999&>:))p3>:i.1e3
P4=.(#~(1e3&<:*.9999&>:))p4>:i.1e3
P5=.(#~(1e3&<:*.9999&>:))p5>:i.1e3
P6=.(#~(1e3&<:*.9999&>:))p6>:i.1e3
P7=.(#~(1e3&<:*.9999&>:))p7>:i.1e3
P8=.(#~(1e3&<:*.9999&>:))p8>:i.1e3
c=.((2 3{[)-:0 1{])&":
{{
r=.0
for_q.(([:i.[:!#)A.([:i.#)C.])P3;P4;P5;P6;P7;P8 do.
  for_w.>
end.
}}


NB.pe062 fixme
5{{while.y=.y+1 do.
if.x=#q=.(#~(0=1|]))~.(i.@!@#A.i.@#C.])&.([:":^&3)y do.^&3<./q return.end.
echo q
NB. if.x=#q=.(#~(<.=>.))~.(i.@!@#A.i.@#C.])&.([:":^&3)y do.q return.end.
end.}}4000x

{{while.echo 5~:#q=.(#~(<.=>.))~.(i.@!@#A.i.@#C.])&.([:":^&3)y=.y+1 do.end.^&3<./q}}1x


NB.pe282 fixme
(14^8)|+/{{if.0=x do.y+1 elseif.(0<x)*.0=y do.(<:x)$:1 elseif.(0<x)*.0<y do.(<:x)$:(x$:<:y)end.}}M./"1(,.~)i.7
q=.{{if.0=x do.y+1 elseif.(0<x)*.0=y do.(<:x)q 1 elseif.(0<x)*.0<y do.(<:x)q(x q<:y)end.}}M.
(14^8)|+/q/"1(,.~)i.7

NB.pe065
{{+/"."0":0{2&x:(+%)/2,4}.&.|.1,,|:([:,&1,:&1)(2*1+i.>.y%3)*(>.y%3)$1}}100x
[:+/[:"."0[:":0{[:2&x:[:(+%)/2,4(}.&.|.)1,[:,[:|:[:([:,&1,:&1)(2*1+[:i.[:(>.)3%~])*1$~[:(>.)3%~]

NB.pe053
+/,(1e6<[:!/"1(,.~i.))"(0)>:i.100

NB.pe052
{{while.y=.y+1 do.if.*./*./"1(":y)e.~":"0(2+i.5)*y do.break.end.end.y}}125874

NB.pe037
+/(i.11){q=.(#~([:*./1 p:(]\,([:}.(]\.)))&.":)"0)p:4+i.1e5

NB.pe038 fixme
{{
while.y=.y+1 do.
  if.(1e9&<:*.1e10&>)y do.echo r=.y end.
([:*./'123456789'&e.)


r
}}1

NB.pe360 fixme
{{p=.,:0 0 0 for_X.([:(,-)(1+i.))y do.for_Y.([:(,-)(1+i.))y do.for_Z.([:(,-)(1+i.))y do.if.(0 0 0([:+/&.(^&2)-)r=.X,Y,Z)=y do.p=.p,r end.end.end.end.([:+/([:+/|)"1)p}}10e10
{{p=.,:0 0 0 for_X.([:(,-)(1+i.))y do.for_Y.([:(,-)(1+i.))y do.for_Z.([:(,-)(1+i.))y do.if.(0 0 0([:+/&.(^&2)-)r=.X,Y,Z)=y^3 do.p=.p,r end.end.end.end.([:+/([:+/|)"1)p}}45

NB. 34518
NB. 32736

NB.pe059
{{'r e'=.a:;".1!:1<'/tmp/0059_cipher.txt' for_q.3(4 :'>@:,@:({."1)(0&{::(<@:,"_ _1,"0(<@:<@:<"0@:i.@:#<@{])@:])1&{::)"1^:x($0);<y')'abcdefghijklmnopqrstuvwxyz' do. R=.q{{a.&i.^:_1 (((a.i.($y)$x)(22)b.]))y}}e if.+./'[On the sums of series of reciprocals]'E.R do.([:+/a.&i.)R return.end.end.}}''

NB.pe060 fixme
NB. 1 outta memory
{{r=.'' for_q.5([{."_1]A.~#@:]([(]*i.@:%)&!-)[)y do.
if.*./(1 p: (#~' '&~:)&.":)"(1)2(4 :'>@:,@:({."1)(0&{::(<@:,"_ _1,"0(<@:<@:<"0@:i.@:#<@{])@:])1&{::)"1^:x($0);<y')q do.r=.r,q
end.
end.
_5]\r}}p:1,3+i.40

NB.pe049 fixme
NB. 1
(#~(4=[:#[:~.[:"."0":)"0) @ ([: p: [: i. [: (-/ - {:)  p:^:_1) (_4 p:1e4),(4 p:1e3)
q=:(-/]) 1487 4817 8147 8889
([: +/"1  (="1 0 ~.) ) ,q
NB. 2
{{r=.1 3$0[d=.|(-/])y=.([:([:p:{.+([:i.-~/))[:(([:p:^:(_1)4 p:{.),[:p:^:(_1)_4 p:{:)/:~)y
for_w.d do.
if.0=c=.#D=.(#~[:-.[:~:[:|z&{.,(z=.I.0=w)&}.)w do.continue.else.
NB. echo D;z;z{y
NB. ???????????????????????????????
echo D
echo (;~$)D(-~,],+)"0 0 z{y
R=.D(-~,],+)"0 0 z{y end.
if.0=#R do.continue.elseif.(([:*./4=#&":"0)*.([:*./2([:*./e.&":)/\])*.(3=#)*.(1487([:-.[:*./"1 e.&":){.))"1 R do.r=.r,R end.
end.r}}1e4 1e3

NB.pe040 fixme
([:*/[:"."0(x:10^i.7){([:(#~' '&~:)":))i.1e6 NB. 2

NB.pe032 fixme
{{for_q.1e3+i.1e4 do.
if.+./-.~:":q do.continue.end.
for_e.1+i.>:#Q=.q:q do.
for_r.z=.(#~(":q)&([:-.[:+./e.))([:*/"1 e&(4 :'>@:,@:({."1)(0&{::(<@:,"_ _1,"0(<@:<@:<"0@:i.@:#<@{])@:])1&{::)"1^:x($0);<y'))Q do.
if.z(([:-.[:+./e.)&":)q do.q=.q,":z end.
end.
end.
}}

NB.pe062 fixme
for_q.i.2e3 do.
(#~([:*./q&e."1 1))(([:#":)x:{{>@:,@:({."1)(0&{::(<@:,"_ _1,"0(<@:<@:<"0@:i.@:#<@{])@:])1&{::)"1^:x($0);<y}}":)q=.q^3
{{>@:,@:{."1(0&{::([:<[:,"_ _1[:,[:"0([:<[:<[:<"0[:i.[:#[:<{])])1&{::)"1^:x($0);<y}}

NB.pe028
>:+/((([:<"1[:|:((#@$),#)$(i.@#)){]),(([:<"1[:|:((#@$),#)$(i.@#)){])&.|.)500(|.@|:@(,.(>:@(>./)@,+i.@#))^:4:(|.@|:@(,.(>:@(>./)@,+i.@#))^:4@]^:[))1

NB.pe027
*/,(q([:($#:[:I.[:(=~>./),){{while.1 p:x p.y do.y=.y+1 end.y}}"1 0)0){q=.>,{(i:1e3-1);(i:1e3);1

NB.pe026 fixme
>:,($#:[:I.[:(]=>./),) ([:{{R=.r=.0 for_q.({.~([:<.2%~#))<\y do.if.r<R=.-~/2{.I.(>q)E.y do.r=.R end.end.r}}&.|.50}.}:)S:0' 'cut 0j5e2":%>:i.1000x NB.off by 100, ha (w/ my setup)
>:,($#:[:I.[:(]=>./),) ([:{{R=.r=.0 for_q.({.~([:<.2%~#))<\y do.if.r<R=.-~/2{.I.(>q)E.y do.r=.R end.end.r}}&.|.50}.}:)S:0' 'cut 0j5e2":%>:i.1000x

NB.pe098 fixme
>./(#~((0=1|%:)*.0&<))((10#.0:`1:`2:`9:`6:@.([:+./"1(1+i.4)*"1 1'CARE'&="1 0)"0)[:}:}.);._1',',1!:1<'/tmp/0098_words.txt'
>./(#~((0=1|%:)*.0&<))10&#.^:([:*./0&~:) _1:`1:`2:`9:`6:@.([:+./"1(1+i.4)*"1 1'CARE'&="1 0)"0 L:0  ([:<[:}:}.);._1',',1!:1<'/tmp/0098_words.txt'
>./([:< (#~(1<:#))10#.^:([:*./0&~:)[:0:`1:`2:`9:`6:@.([:+./"1(1+i.4)*"1 1'CARE'&="1 0)"0[:}:}.);._1',',1!:1<'/tmp/0098_words.txt'
>./;(#~a:&~:)([:<[:(#~(1=#))10#.^:([:*./0&~:)[:0:`1:`2:`9:`6:@.([:+./"1(1+i.4)*"1 1'CARE'&="1 0)"0[:}:}.);._1',',1!:1<'/tmp/0098_words.txt'

{{
w=.0[y=.([:}:}.);._1',',y
for_q.y do.
'race'e.'care1'
end.
}}1!:1<'/tmp/0098_words.txt'
>./;(#~a:&~:)([:<[:(#~(1=#))10#.^:([:*./0&~:)[:0:`1:`2:`9:`6:@.([:+./"1(1+i.4)*"1 1'CARE'&="1 0)"0[:}:}.)


NB.pe096 fixme
{.^:3
 q=._90(3 3 3 3$])\"."0(#~e.&'0123456789')1!:1<'/tmp/p096_sudoku.txt'

NB.pe095 fixme
{{e=.5
for_w.200+i.5e4 do.
  if.1 p:w do.continue.end.
  z=.2[W=.(r=.{{if.0~:y do.+/(#~([:*./"1(0,y)&~:"1 0))([:~.[:;[:(*/"1)S:0 [: ((1+[:i.#) ([:<[{."_1]A.~#@:]([(]*i.@:%)&!-)[)"0 1 ])1,q:)y end.}}) w
  while.w~:W=.r W do.
    if.1e6<W do.goto_q.end.
    z=.z+1
  end.
  label_q.
end.
}}''

NB.pe090 fixme
NB. 1217
0 1 3 4 69|2!(10-5)
           2 5 7 8 96
  1 4 5 69|2!(10-4)
           2 3 5 7 8 96
2*20*12
2*30*20

NB.pe092
+/([:$:([:+/2^~[:"."0":))`(0:"0)`(1:"0)@.([:+./1 2*"(1 1)1 89&="1 0)"(0)1+i.1e7

NB.pe089 fixme
(#-[:+/[:([:#[:{{'e r'=.(#q=."."0":y);''
f=.{{if.4>m do.y=.y,(m#(0{x))elseif.4=m do.y=.y,(1 0{x)elseif.9>m do.y=.y,(1{x),((m-5)#(0{x))elseif.9=m do.y=.y,(0 2{x)end.}}
for_w.|.@i.e do.select.w case.3 do.r=.r,(((e-w+1){q)#'M')case.2 do.r=.'CDM'((e-w+1){q)f r case.1 do.r=.'XLC'((e-w+1){q)f r case.0 do.r=.'IVX'((e-w+1){q)f r end.end.r}}"(0) {{y=.(+/'I'E.y)+(1e1*+/'X'E.y)+(1e2*+/'C'E.y)+(1e3*+/'M'E.y)+(0:`_1:@.([:+./'IV'E.])y)+(0:`_1:@.([:+./'IX'E.])y)+(5e0*+/'V'E.y)+(5e1*+/'L'E.y)+(5e2*+/'D'E.y)+(0:`(_10"_)@.([:+./'XL'E.])y)+(0:`(_10"_)@.([:+./'XC'E.])y)+(0:`(_100"_)@.([:+./'CM'E.])y)+(0:`(_100"_)@.([:+./'CD'E.])(y=.y,'  '))}}"(1))S:0[: <;._1 LF,])1!:1<'/tmp/0089_roman.txt'

NB.pe083 fixme
{{c=.0 0
y
}}}.".;._2 LF,1!:1<'/tmp/0083_matrix.txt'

NB. THE WEEKLY CHALLENGE
NB.wc001.1
(]`('E'[[)@.('e'&=)"0)'Perl Weekly Challenge' NB. 1
(]`('E'"_)@.('e'&=)"0)'Perl Weekly Challenge' NB. 2
(]`(-&32)@.(101&=))&.(a.&i.)'Perl Weekly Challenge' NB. 3

NB.wc001.2
((":`f`b`((f=:'fizz'"_),b=:'buzz'"_))@.(#.@(0=3 5&|~))"0)>:i.15

NB.wc002.1 FIXME tooooo complicated, edge cases, yikes.
f=.{{
".NB. trivial, does most both positive and negative, but it doesn't explicitly say that's unwanted
{{  (])`(+:&.".)@.(0&<@".)"(0) &. > (a:&~:#])<;._1' ',y}}  '_001   002  3 4 _5' NB. 1.2 assuming, 1, string arguments since J doesn't do leading zeros, 2, space delimited numbers, 3, reals allowed
]`?@.('_'&=)
   (#~'_'&~:)
{{( (#~(#y)~:]) @ i.&('._123456789')) <;._1 ' ',y}}  '_001   002  3 4 _5' NB. ...?
NB. tooooo complicated, edge cases, yikes. FIXME

NB.wc002.2
(+/\])

NB.wc238.2 fuck me, this was more annoying than 148.1
{{if.0<#a=.~.(#~-.@~:)o=.(#*({{{:`([:$:([:*/"."0@":@{.),>:@{:)@.(9&<@{.)"1 y}}@|:@,:0:))y do.for_s.a do.o=.((+/:d&{)(d=.s I.@:-.@i.o)}])o end.end.y=.|.(\:o){y}}

NB.wc214.1
((((('G';'S';'B')"_(i.3){]),(":&.>@((-&4@#-i.@-&3@#){])))@(/:~;/))/:\:) NB. 1
(((((<"0'GSB')"_(i.3){]),(":&.>@((-&4@#-i.@-&3@#){])))@(/:~;/))/:\:) NB. 2

NB.wc214.2
(#~(],{:)@:-.@(2((=)+.(=<:))/\])) NB. 1 fixme

NB.wc215.1
([:+/-.@([:*./2</\/:)@>)'abc';'xyz';'tsu'

NB.wc215.2 fixme

NB.wc235.1
(1=[:+/0=2</\])

NB.wc235.2
(#$([:;[:(]`(,])@.(0&=))&.>;/)) NB. 1
(#$([:;(]`(,])@.(0&=)))) NB. 2 fixme
(#$([:,([:;(]`(,])@.(0&=)))"0)) NB. 3
(#$(([:>:0&=)#])) NB. 4
(#$(#~[:>:0&=)) NB. 5

NB.wc148.1
(#~((,/@([:*./"(1)_3((e.&2 4 6@{.),(1:`(e.&0 3 4 5 6@{~&1)@.(1:<#)),(1:`(e.&0@{~&2)@.(2:<#)))\])"."0@|.@":))"(0))i.1e2

NB.wc148.2 fixme

NB.wc238.1 fixme

NB.wc197.1
((#~0&~:),([:+/0&=)#0:`(''"_)@.(#=i:&0))

NB.wc197.2
((/:~@]`(\:~@])@.[)~(1:,(2(</)`(>/)\])))

NB.wc239.1
(-:&;) NB. assuming 2 lists of boxed strings

NB.wc239.2
((#~a:&~:)@:((#~([:*./'ALLOWED'e.~]))&.>))NB. 1 assuming list of boxed strings
'ALLOWED'((a:&~:#])@:((([:+./[e.~])#])&.>))NB. 2 assuming list of boxed strings

NB.wc236.1
0 0 0(((1 0 0+[)$:}.@])`(0:`((_1 1 0+[)$:}.@])@.(0<[:{.[))`(0:`((_3 0 1+[)$:}.@])`((_1 _1 1+[)$:}.@])@.((3<[:{.[)+.(2*[:*./0<0 1{[)))@.([:,[:>:[:I.5 10 20&=@])"_ _ 0)5 5 10 10 20 NB. 1 fuck me, this is annoying fixme
0 0 0(_1:`_2:`(((_3 0 1+[)$:}.@])@.((3<[:{.[)+.(2*[:*./0<0 1{[)))@.([:,[:>:[:I.5 10 20&=@])"_ 0)5 5 10 10 20 NB. 1 fuck me, this is annoying to get tacit fix
0 0 0{{ NB. 2 FUCK ME, this was annoying
for_q.y do.
  select.q
  case.5 do.
    x=.1 0 0+x
  case.10 do.
    if.(0<0&{)x do.
    x=._1 1 0+x
    else.0 return.
    end.
  case.20 do.
    if.(2<0&{)x do.
    x=._3 0 1+x
    elseif.([:*./0<0 1&{)x do.
    x=._1 _1 1+x
  end.
end.
1
}}5 5 10 10 20

NB.wc236.2

NB.wc237.1
[:>./[:+/"1]<"1 1i.@!@#A.i.@#C.]

NB.wc237.2 this is retarded
fixme fixme fixme fixme
{{'Q W E R'=.y NB. 1 year month weekdayOccurance weekday
assert.*./(7 5 12>:R,E,W),((0<]),([:(<.=>.)Q,])W,E,R) NB. (positive) integer; also, yes, fuck you, exit disgracefully
d=.(Q-1970)*365.2425+(W-1)*30.436875 NB. exact days to the first of desired month with unix epoch as reference
while.0<d do.
?????????????????????
31  1 3 5 7 8 10 12=
30  4 6 9 11
29  2 *. 1=[:4|y
28  2
D=.
R=([:7&|[:<.5-~365.2425 12 30.436875&#.)Q,W,D
}}

NB.wc240.1
'abc'((-:&:(0&(3!:12)))>@({.&.>@]))'ABC';'BCD';'CDE'

NB.wc240.2
{~

NB.wc241.1
NB. 1 this is going to be very explicit and annoying
{{for_q.y
({:@<;._1@q&,)
3<#
NB. 2
NB. NB. (3}.({.-~}.\))
NB. NB.     (   (3-~#)<\]) i:4
NB. (_3}.(}.^:(>:@i.@#)))i.10
NB. ([:,[:,.(i.@#)([:<}.)"0 _])i.10
NB. (_3}. [: (({.-~}.)&.>) [:,[:,.(i.@#) ([:<}.)"0 _])i.10
NB. ({.-~}.\) &. >   ??
NB. (     _3}.[:(({.-~}.)&.>)[:,[:,.(i.@#)([:<}.)"0 _]) q
NB. ([: ( ({.-~}.) &.>)  _3}.[:(({.-~}.)&.>)  [:,[:,.(i.@#) ([:<}.)"0 _]) q
NB. (     _3}.[:(({.-~}.)&.>)  [:,[:,.(i.@#) ([:<}.)"0 _]) q
NB. ([: (,:({.-~}.)&.>) _3}.[:(({.-~}.)&.>)  [:,[:,.(i.@#) ([:<}.)"0 _]) q
NB. ([: (,:q) _3}.[:(q=:({.-~}.)&.>)  [:,[:,.(i.@#) ([:<}.)"0 _]) 0 1 4 6 7 8
NB. ([:({.-~}.)&.>  [:,[:,.(i.@#) ([:<}.)"0 _]) 0 1 4 6 7 8
NB.    >(  _3}.[:(({.-~}.)&.>)  [:,[:,.(i.@#) ([:<}.)"0 _]) q
NB.          ([: (,:({.-~}.)&.>)  _3}.[:(({.-~}.)&.>)  [:,[:,.(i.@#)([:<}.)"0 _])   /:~ 0 10 20 15 3
NB. ;"1
NB.    (     _3}.[:(({.-~}.)&.>)          [:,[:,.(i.@#)([:<}.)"0 _]) /:~ 0 10 20 15 3
NB. {{
NB. q=.([:;"1[:,._3}.[:(({.-~}.)&.>)[:,[:,.(i.@#)([:<}.)"0 _])y
NB.    ( [:  ($#:[:(i.=&1),)          (="1 0*&2) )  _1 3 10 15 20
NB. }} /:~ 0 10 20 15 3
NB. (([:i.3-~#){])+
q ([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _])
q"1 ([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _])
({~([:(#~([:(*./"1)1</]))[:($#:[:(i.=&1),)(="1 0*&2)))
({~([:(#~([:*./"(1)1</]))[:($#:[:(i.=&1),)(="1 0*&2)))
( ( ([:~.[:(#~([:(+./"1)1</]))[:($#:[:(i.=&1),)(="1 0*&2)))  ([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _]) )w
({~((([:,[:~.[:(#~([:(+./"1)1</]))[:($#:[:(i.=&1),)(="1 0*&2)))([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _])))
({~(((2+[:~.[:(#~([:+./"(1)0</]))[:($#:[:(i.=&1),)(="1 0*&2)))([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _])))w
(I.([:+./"(1)0<]))c
(  ([:([:($#:[:(i.=&1),)(="0 1*&2)))([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _]))w
( [:  (([:($#:[:(i.=&1),)(="0 1*&2)))       ([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _])) 0
( [:  (([:($#:[:(1 i.~]),)(="0 1*&2)))       ([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _])) 0
( [:($#:[:(#~0~:])[:(i.@#*1&E.),)  (="0 1*&2)  ([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _])  )0 1 4 6 7 10
([:($#:[:(#~0~:])[:(i.@$*1&E.),)  (="0 1*&2)  ([:;"1[:,._3}.[:(({.-~}.)&.>)[:,.(i.@#)([:<}.)"0 _])  )0 1 4 6 7 10
([:($#:[:(#~0~:])[:(i.@$*1&E.),) [:(="0 1*&2) ([:;"1[:,.[:(({.-~}.)&.>)_3}.[:,.(i.@#)([:<}.)"0 _]) )0 1 4 6 7 10
{{
NB. for_q.([:,:(i.@#)([:<}.)"0 _])y do.
for_q.(([:;"1[:,.[:(({.-~}.)&.>)_3}.[:,.(i.@#)([:<}.)"0 _]))y do.
}}0 1 4 6 7 10

NB.wc241.2
(/:#@q:)

NB.wc242.1
((([:I.[:-.[e.]){[),:(([:I.[:-.]e.[){]))

NB.wc242.2
([:-.|."1)

NB.wc243.1
([:+/[:+/[:}:[:|:[:(],.(i.@#))+:<"0 1]) NB. 1 close, but too fiddly fixme
([:+/[:+/[:;((((+:@{.)<"0 1(}.))&.><\.)&.|.)) NB. 2

NB.wc243.2
([:+/[:([:+/[:<.{.%}.)"1[:(],.{.@|:)[:~.(/:/:)"1@(((i.3){])&.|:)@(i.@!@#A.i.@#C.])) NB. fixme totes not annoying; also, doesn't work on 7#7 because of ~.

NB.wc003.1
((i.5){(#~([:*./"1[:5&>:q:)))

NB.wc003.2
(i.!/i.)

NB.wc004.1
0j9":1p1

NB.wc004.2
TableOfEqualLengthWords(([:+./"1 e.)#[)ListOfLetters
(#~([:+./e.&ListOfLetters)@>)ListOfBoxedStrings

NB.wc005.1
NB. how about no

NB.wc005.2
{{w=.0 for_q.y do.w=.w,(([:+/[:;([:+./e.&(>q))&.>)y)end.({.\:}.w){y}}ListOfBoxedStrings

NB.wc006.1 totally not annoying
([:>[:([,',',])&.>/ [:((":@{.,',',":@{:)`":@.(1=#)`(":@{.,'-',":@{:)@.(2<#))&.>(([:-.0,(2(>:@[=])/\]))<;.1]))

NB.wc006.2 fixme precision loss on last 3
32j0":^(1p1*%:163)

NB.wc007.1
(#~(0=([:+/[:"."0":)|])"0)i.51

NB.wc007.2

NB.wc008.1
(i.5){(#~(=([:+/[:}:[:}.[:I.[:(=<.)(%i.@>:))"0))>:i.1e5 NB. brute forcing it is real fucking slow... fixme

NB.wc008.2
{{(],~(' '#~([:<.2%~((>./#@>y)-#))))@>y}}ListOfBoxedStrings

NB.wc009.1
{.(#~(5<:#@~.@":"0@*:))101+i.1e2 NB. yes, i gave up on trains, don't bully me

NB.wc009.2
NB. what?

NB.wc010.1
enc=:{{NB. 1 retarded roman numerals get the retard treatment, also, yes, least lines because legibility is for wimps
'e r'=.(#q=."."0":y);''
for_w.|.@i.e do.select.w case.3 do.r=.r,(((e-w+1){q)#'M')case.2 do.if.4>((e-w+1){q) do.r=.r,(((e-w+1){q)#'C')elseif.4=((e-w+1){q) do.r=.r,'CD'elseif.9>((e-w+1){q) do.r=.r,'D',((((e-w+1){q)-5)#'C')elseif.9=((e-w+1){q) do.r=.r,'CM'end.case.1 do.if.4>((e-w+1){q) do.r=.r,(((e-w+1){q)#'X')elseif.4=((e-w+1){q) do.r=.r,'XL'elseif.9>((e-w+1){q) do.r=.r,'L',((((e-w+1){q)-5)#'X')elseif.9=((e-w+1){q) do.r=.r,'XC'end.case.0 do.if.4>((e-w+1){q)do.r=.r,(((e-w+1){q)#'I')elseif.4=((e-w+1){q)do.r=.r,'IV'elseif.9>((e-w+1){q)do.r=.r,'V',((((e-w+1){q)-5)#'I')elseif.9=((e-w+1){q)do.r=.r,'IX'end.end.end.r}}"0
enc=:{{NB. 2 ever so slightly less retarded
f=.{{if.4>m do.y=.y,(m#(0{x))elseif.4=m do.y=.y,(1 0{x)elseif.9>m do.y=.y,(1{x),((m-5)#(0{x))elseif.9=m do.y=.y,(0 2{x)end.}}
for_w.|.@i.e do.select.w case.3 do.r=.r,(((e-w+1){q)#'M')case.2 do.r=.'CDM'((e-w+1){q)f r case.1 do.r=.'XLC'((e-w+1){q)f r case.0 do.r=.'IVX'((e-w+1){q)f r end.end.r}}"0
NB. sadly, enc^:_1 does not work, so we give it the good ol' explicitaroo
dec=:{{(+/'I'E.y)+(1e1*+/'X'E.y)+(1e2*+/'C'E.y)+(1e3*+/'M'E.y)+(0:`_1:@.([:+./'IV'E.])y)+(0:`_1:@.([:+./'IX'E.])y)+(5e0*+/'V'E.y)+(5e1*+/'L'E.y)+(5e2*+/'D'E.y)+(0:`(_10"_)@.([:+./'XL'E.])y)+(0:`(_10"_)@.([:+./'XC'E.])y)+(0:`(_100"_)@.([:+./'CM'E.])y)+(0:`(_100"_)@.([:+./'CD'E.])y=.y,'  ')}}"1 NB. no fail on single roman digit or null

NB.wc010.2 fixme fuck this so much
js=:{{
if.0=M=.x([:+/[:,((((#~0<:])i:x(([:<:[:<.[:-:[>.])&#)y)+"1 0 i.@#@[){[) ="1 0[)y do.0 return.end. NB. fixme gives false positives
'q1 q2'=:'FAREMVIEL';'FARMVILLE'
'FAREMVIEL'{{x(   ((((#~0<:])i:x(([:<:[:<.[:-:[>.])&#)y)+"1 0 i.@#@[) )  )y}}'FARMVILLE'
q1{{x(  ([:(#~(0<:])*.#>])&.>[:<"1((([:i:[:<:[:<.[:-:>.)&#)+"1 0 i.@#@[)){[  )y}}q2
q1{{x(  <"0@([:(#~(0<:])*.#>])&.>[:<"1((([:i:[:<:[:<.[:-:>.)&#)+"1 0 i.@#@[)){[  )y}}q2
q1{{
q=.x(  (<"0@([:(#~(0<:])*.(#x)>])&.>[:<"1((([:i:[:<:[:<.[:-:>.)&#)+"1 0 i.@#@[)){[)="1 0]  )y
'M T'=.(([:+/[:,[:>./[:>[:</.|:)q3);(+/,q3)
q2
????????????????????
3%~+/   (#x)+(#y)+(-&T%*:,)
 NB.    (  _(([:-#@$)<\#@$#i.@#)}] )i.3 3
 NB. (_(([:-[:#$)<\#@$#i.@#)}])i.3 3
NB. (=/]) * q
   (q1=/q2)
([:-.[:(=/])[:i.#)q1
   (([:-.[:(=/])[:i.#)q1) * (q1 =/ q2)
}} NB. 1
{{((M%#x)+(M%#y)+(M-(t=:(+/xm~:&(M&{.)ym)%2))%(M=:(xm=.(+./"1 e)#x)<.&#(ym=.(+./"2 (e=.(x=/y)*(((x>.&#y)%2)-1)>:|x-/&(i.@#)y))#y)))%3}} NB. 2 stolen from rosetta :3

NB.wc011.1
(_32-5*32%9)%((9%5)-5%9) NB. 1 arithmetic, more paper than computation
>@{.@p.0,(_32*(1+5%9)*45%56) NB. 2.1 same, but use the roots primitive
>@{:@p.(32*1+5%9),((-/%)9%5) NB. 2.2

NB.wc011.2
([:(=/])i.) NB. 1
{{x(1(x(|:@(([,])$i.@]))y)}([$])$0:)y}} NB. 2 x-dim y-len identity array

NB.wc012.1
{.(#~([:0&p:]))([:>:[:*/[:p:i.)"(0)i.10

NB.wc012.2
([:([:;'/',~&.>([:*./"(1)2=/\"1])#([:{.|:))([:|:[:/:~[:;"1[:([:<;._1'/',])&.>,.))ListOfBoxedStrings

NB.wc244.1
([:+/[:;[:(([:*:>./)*<./)"1&.>([:<"1[:(>:@i.([#:(-:(i.~~.))@#:#])i.@!)[:#>)]/.&.><)

NB.wc244.2
([:+/"1]>/])

NB.wc013.1 fixme
NB. nope

NB.wc013.2
F=:((]-(M@F@<:))`1:@.(0=]))"(0)M.
M=:((]-(F@M@<:))`0:@.(0=]))"(0)M.

NB.wc014.1 fixme
NB. retarded definition

NB.wc014.2 fixme

NB.wc015.1
((i.10){]#~(p:<(2%~(p:@<:+p:@>:)))"(0))>:i.1e2
((i.10){]#~(p:>(2%~(p:@<:+p:@>:)))"(0))>:i.1e2

NB.wc015.2
(($msg)$key)(a.{~[:+/"1[:|:97 0-~,:&(a.i.0&(3!:12)))msg

NB.wc016.1
(i.(>./));(([:*/[:-.}:)*{:)&.>([:<\1e2%~])>:i.1e2

NB.wc016.2 fixme
{{
assert.(('1'=0&{)+.('3'=0&{)+.('bc1'=(i.3)&{))y
assert.-.+./'OIl0'e.y
assert.((3(128!:6)])^:2((i.19){((i.25)&{)&.|.y))=((->:i.4){y) NB. 100 or 160 hash? also, bytes nots characters
assert.25<:$y
}}

NB.wc245.1
ListOfNumbers(<:@[{])ListOfBoxedStrings

NB.wc245.2
([:>./[:,[:;[:([:".[:(#~' '&~:)":)"1&.>([:(#~(0=3|+/))"1 i.@!@#A.i.@#C.])&.>@(#:@i.@(2&^)@#<@#"1 _]))

NB.wc246.1
?6#49

NB.wc246.2
([:*./[:(<.=>.)(([:%.2]\]{~([:i.2-~#))+/ .*(3}.])))

NB.wc200.1
0:`([:*./[:=/"(1)3(2-/\])\])@.(2<#)

NB.wc200.2
q0=:0 :0

| |
| |
| |

)
q1=:0 :0
  |
  |
  |
  |
  |
)
q2=:0 :0

  |

|

)
q3=:0 :0

  |
--|
  |

)
q4=:0 :0
| |
| |
--|
  |
  |
)
q5=:0 :0

|

  |

)
q6=:0 :0

|
|--
| |

)
q7=:0 :0

  |
  |
  |
  |
)
q8=:0 :0

| |
|-|
| |

)
q9=:0 :0

| |
--|
  |

)
'q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 '=:(5 3$(#~((10{a.)&~:)))&.>(q0;q1;q2;q3;q4;q5;q6;q7;q8;q9)
<"2((q0"_)`(q1"_)`(q2"_)`(q3"_)`(q4"_)`(q5"_)`(q6"_)`(q7"_)`(q8"_)`(q9"_)@."."0":)200

NB.wc201.1
(([:i.1+#)#~([:-.]e.~([:i.1+#)))

NB.wc201.2
#@;@(>:@i.,.&.>((<@;@(((-<.])#)(>:@i.@[([,.(>:{."1)#])&.>{.)]),])^:(<:@[(>.)0:)<@,:@i.@0:))

NB.wc202.1
([:+./3*./\(2|]))

NB.wc202.2 annoying much?
{{((''$I.+./"1 e E.q)+>:i.#(e=.>{./:~w=.(]<;.2~[:(*./"1)1 0="1 1])q=.{{]`(1 1 q}])@.(0<#q=.([:I.[:+./"(1)1 1&E."1 1)y)y}}(2(<,>:)/\])y)){(,{:)y}} NB. fixme doesn't capture whole valley due to cutting

NB.wc203.1
([:+/[:(([:+/}:)={:)"1[:,"(2)4({~4{{q=.((d=.y-x)$<i.0 0),<i.1 0 for.i.x do.q=.(i.>:d),.&.>,&.>/\.>:&.>q end.;q}}#)\]) NB. 1 fail
([:,"(2)4{{((4{{q=.((d=.y-x)$<i.0 0),<i.1 0 for.i.x do.q=.(i.>:d),.&.>,&.>/\.>:&.>q end.;q}}#){])y}}   \])  i.8 NB. 2 fail
([:+/[:;[:([:(([:+/}:)={:)"1({~(4 {{q=.((d=.y-x)$<i.0 0),<i.1 0 for.i.x do.q=.(i.>:d),.&.>,&.>/\.>:&.>q end.;q}}#)))&.>([:(#~a:&~:)[:,[:~."1(3)&}.&.|.<\.])) NB. 3

NB.wc203.2
NB. nope

NB.wc204.1
([:*./2<:/\])

NB.wc204.2
(r,c)$]

NB.wc205.1
(([:<:3<.#){\:~)

NB.wc205.2
([:>./[:22 b./"1 ~.{~(2{{q=.((d=.y-x)$<i.0 0),<i.1 0 for.i.x do.q=.(i.>:d),.&.>,&.>/\.>:&.>q end.;q}}#))

NB.wc206.1
([:<./(12*60)|[:-/"1[:({~2{{q=.((d=.y-x)$<i.0 0),<i.1 0 for.i.x do.q=.(i.>:d),.&.>,&.>/\.>:&.>q end.;q}}#)[:;(24 60#.[:".' '2}])&.>)ListOfBoxedStrings

NB.wc206.2
([:>./[:,[:(([:<./(i.2)&{)+([:<./(2+i.2)&{))"1(i.@!@#A.i.@#C.]))

NB.wc207.1
(#~((1=[:+/[:+./"1('qwertyuiop','asdfghjkl',:'zxcvbnm')e.])@(0&(3!:12))@>))ListOfBoxedStrings

NB.wc207.2
([:>./(#~(>:~([:+/"1(<:/])))))

NB.wc208.1 Fucking state, ffs. What a bane.
ListOfBoxedStrings{{w=.i.0 2 for_q.x(([:I.[e.]){])y do.w=.w,((q i.~y)+(q i.~x));q end.{:|:(#~[:(={.)[:({.&.|:)/:~)w}}ListOfBoxedStrings

NB.wc208.2
(([:I.[:-.~:),((~:~({.+i.@#))#({.+i.@#)))

NB.wc247.2
2&{{((''$((0{$#:[:I.[:(=~>./)[:,[:+/[:(=/])x<\])y))+i.x){y}}

NB.wc248.2
((2 2$1 1 2 2)([:+/,);._3])

NB.wc248.1
([:<./[:|([:I.=)-"0 1 i.@#@])

NB.wc249.1
{{assert.(([:*./0=2|[:+/"1~.=/]),(0=2|#))y
_2<\/:~y}}

NB.wc249.2
{{(w+i.-q)(I.Q)}(i.w)(I.W)}(#y)#0['q w'=.+/"1'Q W'=.'DI'="0 1 y=.y,'I'}}

NB.wc250.1
q=:]`_1:@.(_&=)@([:<./(#~i.@#=10&|))

NB.wc250.2
([:>./[:>((_".e.&'0123456789'#])`#@.([:*./e.&((([:,(i.26)+"1 0(,+&32))65){a.)))&.>)

NB.wc251.1
{{]`((([:>.2%~#){y)&+)@.(2|#y)([:+/([:i.[:<.2%~#){([:((#~e.&'0123456789')&.":)"1[:|:(,:|.)))y}}

NB.wc251.2
(([:,((<./)=])"1*.(((>./)=])"1&.|:))#,)

NB.wc252.1
([:+/2^~(#~(0=(1+[:i.#)|#)))

NB.wc252.2
{{(q&{.,(q+(0=2|y))&}.)i:q=.<.-:y}}

NB.wc253.1
'.'&cut L:0 NB. fixme do it without stdlib

NB.wc253.2
(/:+/"1)

NB.wc254.1
(0=1|^&1r3)

NB.wc254.2
{{((|.q{y)(q=.I.e.&'AEIOUaeiou'y)}])y}}

NB.wc255.1
{{'y x'=.x(((y;x)"_)`((x;y)"_)@.(>&#))y
if.1=+/w=.(x([:-.0<[:+/="0 1)y)do.(I.w){y else.w=.y(([:I.(([:+/="0 1)-([:+/(="0 1]))@])){])x end.}}

NB.wc255.2
{{(#~(<x)&~:){&zI.([:+./(="1 0(2{.\:~)))+/"1="0 1 z=.((' '&="0 1)<;._1])' '&,y}}

NB.wc256.1
(2%~[:+/[:,( ="0 1 |.L:0))

NB.wc256.2
{{y([:,[:|:,:)~(,&(((#y)-#x)#(0{a.)))x['y x'=.x(((y;x)"_)`((x;y)"_)@.(>&#))y}}

NB.wc017.1
{{if.0=x do.y+1 elseif.(0<x)*.0=y do.(<:x)q 1 elseif.(0<x)*.0<y do.(<:x)q(x q <:y)end.}}M.

NB.wc017.2
'^(\w+?://)?((\S+?)(?:(?::)(\S+?))?(?:@))?([0-9A-Za-z\.]+)(?::(\d+))?(/\S+?)*?(?:\?(\S+?))?(?:#(\S+?))?$' rxall 'jdbc://user:password@localhost:3306/pwc?profile=true#h1' NB. rx not exactly pcre or buggy

NB.wc018.1
{{(p x)([: > 0 { [: (\:(# S:0))  (([:(#~0&<)[:,[:I.="1 0){[) )(p=.{{r=.'' for_q.1+i.l=.#y do.for_w.i.q do.r=.r,<(l-q-1){.w|.y end.end.r}})y}}

NB.wc019.1
((1:`0:@.([:=/0 1&{),(2~:/\]))<;.1])

NB.wc021.1
{{+/%!i.y}}bigNum
((1+%)^])bigNum

NB.wc022.1
(i.10){([:p:$#:[:I.[:1&=,)@(="0 1(6&+))p:i.1e2

NB.wc257.1
([:+/]>~"0 1])

NB.wc257.2
{{(([:+./0~:,)*.([:([:*./1={&(,y))^:(0<#)[:I.0~:,)*.([:([:*./]e.(#{.(|.i.#y)"_))^:(0<#)[:I.([:*./0&=)"1)*.(([:([:*./2([:</[:I.1={&y)\(,(1+{:)))^:(0<#)[:I.2(1&=)/\])([:+./0~:,)"1)*.([:~:/[:,([:I.0~:,)"1))y}}

NB.wc258.1
([:+/(0=2|[:#":)"0)

NB.wc259.1
([:+./1<[:+/"1="0 1)

NB.wc259.2
(1+[:I.(-:"1 1[:~.(([:i.[:!#)A./:~)))

NB.wc261.1
(+/-([:+/[:"."0":))

NB.wc261.2
{{if.x e.y do.while.y e.~x=.+:x do.end.end.x}}

NB.wc262.1
(>/([:+/0&<)([:+/0&>))

NB.wc263.1
([:I.[=/:~@])

NB.wc265.1
{{(((1r3<:(#y)%~]))+/"1 q="0 1 y)([:<./#)q=.~.y}}

NB.wc266.2
**/

NB.wc268.1
([:''"_^:(1~:#)[:~.-&(/:~))

NB.wc268.2
([:,_2(],[)/\/:~)

NB.wc269.1
([:+./[:(0=[:2&#:(23 b.)/)"(1)2&([{."_1]A.~#@:]([(]*i.@:%)&!-)[))

NB.wc269.2
{{y=.2}.y[w=.1{y[q=.{.y while.0<#y do.if.q(>&{:)w do.q=.q,{.y else.w=.w,{.y end.y=.}.y end. q,w}}

NB.wc269.1
([:+/(|:~(<@i.@<:@#)))

NB.wc271.1
(0{[:I.[:(>./=])+/"1)

NB.wc271.2
(]/:([:+/"(1)2&((([:<:^:(1=2|])[:>:^:(0=[|])[:>.[^.])#[)#:])"0))

NB.wc272.1
('[.]'(#@[}.<@[;@,.])[:<;._1'.',])

NB.wc272.2
([:+/2([:|-/)\a.&i.)

NB.wc273.1
(([:#])%~([:+/=))

NB.wc273.2
{{0 if.+./y=.'b'=y do.*./1>:2-~/\I.y end.}}

NB.wc274.1
(' '(#@[}.<@[;@,.])[:(,.('a'#~&.>1+[:i.#))' 'cut])(' '(#@[}.<@[;@,.])[:(,&(1&}.,'ma',~{.)`(,&'ma')@.([:+./'aAeEiIoOuU'e.{.))L:0' 'cut]) NB.cut on multiple items for more than 1 sentences

NB.wc274.2
NB. fucked

NB.wc275.1 fixme
'T'([:+/[:;(([:*./[:-.e.)L:0 cut))'The joys of polyglottism' NB. fucked

NB.wc275.2
{{for_q.y do.if.'0123456789'e.~q do.y=.((".q)&+&.(a.&i.)l) q_index}y else.l=.q end.end.y}}

NB.wc276.1
(2%~[:+/0=24|[:+/"(1)2([{."_1]A.~#@:]([(]*i.@:%)&!-)[)])

NB.wc276.2
{{+/a=s[a=.>./s=.+/="0 1~y}}

NB.wc277.1
{{r=.0 for_q.y do.r=.r++./q=x end.r}}

NB.wc277.2
([:<.2%~[:+/[:(0<([:|-/)<<./)"1[:~.2&([{."_1]A.~#@:]([(]*i.@:%)&!-)[))

NB.wc278.1
require'regex' NB. cheating, I know!
(' '(#@[}.<@[;@,.])0{ [:/:~"1'\d+'&rxall,:~ '[A-Za-z]+'&rxall)

NB.wc278.2
NB. so in need f structural under; no one-liner
{{(y(([:-.e.)#[)x),x([:/:~(([:i.1+0{[:I.=){]))y
(/:~q{])(x([:i.1+0{[:I.=)y)}y
??????}}

NB.wc279.1
((1-~[){])

NB.wc279.2
'aeiou'(0=1|2%~[:+/e.~)

NB.wc280.1
((0{[:I.1=[:,[:-.~:){])

NB.wc280.2
([:+/[:'*'&=[:;0{"(1)_2]\'|'&cut)

NB.wc281.1
(1=2|[:-&(+/a.i.'a1')[:+/a.&i.)

NB.wc281.2
{{'q w'=.y[c=.[:~.(#~(2=[:+/[:+./[:+./('12345678',:'abcdefgh')&="1 0)"1)[d=.(,((|.&.|:)))>,{((,-)4);(,-)1
([:c[:|:[:;"2 d&+"1 0&.(a.&i.)"1)'f8'
r=.{{for_e.([:c[:|:[:;"2 d&+"1 0&.(a.&i.)"1)y do.echo    e;0
  while.w([:-.=){.e do.e=.0 1&+L:0 e end.{:e
  ([:/:~[:>{:"1)y}}

end.

}}
NB. 'g2';'a8'
NB. 4
NB. 'g2';'h2'
NB. 3
}}

NB.wc282.1
((3=[:+/"1[:="01"."0)#[:"."0~.)

NB.wc282.2

NB.wc283.2

NB.wc283.2

NB.wc284.1
('ABCDEFGHIJKLMNOPQRSTUVWXYZ'&e.</.0&(3!:12))'pPeERrLl'

NB.wc284.2
NB. ?

NB.wc285.1
 (1 5 10 25 50&p.)

NB.wc285.2
NB.wc286.1
NB.wc286.2
NB.wc287.1
NB.wc287.2

NB. ADVENT OF CODE
NB.aoc23.05.1
{{g=.0$~(1+[:([:>./,)S:0(>./,_4(0 2&{)\]);>./,_4(1 3&{)\])y=.".;0 2&{"1([:<;.1' '&,)"1 y=.}.];._2 LF,y
c=.<.{{,{X;Y=.(y(<./&{:)x)+i.Y[X=.(y(<./&{.)x)+i.X['X Y'=.((<:`>:@.(0&<:))"0)y-x}}>.
for_q._4]\ y do.'L R'=.((0 1)&{;(2 3)&{)q if.0=(([:~:/(0 2)&{) ([:|-) ([:~:/(1 3)&{))q do.continue.end.g=.(>:i{g)(i=.L c R)}g end.+/1<,g}}1!:1<'/path/to/input'

NB.aoc23.05.2
{{g=.0$~(1+[:([:>./,)S:0(>./,_4(0 2&{)\]);>./,_4(1 3&{)\])y=.".;0 2&{"1([:<;.1' '&,)"1 y=.}.];._2 LF,y
c=.<.{{,{X;Y=.(y(<./&{:)x)+i.Y[X=.(y(<./&{.)x)+i.X['X Y'=.((<:`>:@.(0&<:))"0)y-x}}>.
C=.[:<"1[:|:(([:i."0[:<:`>:@.(0&<:)"0-)+(<.&{.,<.&{:))
for_q._4]\ y do.if.0=-.*./(1r4p1*i.4)=|A=._3 o.(([:-/3 1&{)%([:-/2 0&{))q do.continue.end.'L R'=.((0 1)&{;(2 3)&{)q if.((1r2p1=|)+.0&=)A do.i=.L c R else.i=.L C R end.g=.(>:i{g)i}g end.+/1<,g}}1!:1<'/path/to/input'

NB.aoc23.01.1
{{q=.0 for_w.<;._1(10{a.),y do.q=.q+([:".(([:<./i.&'0123456789'),(#-(1+([:<./i.&'0123456789')@|.))){])>w end.q}}1!:1<'/path/to/input'

NB.aoc23.01.2
([:+/[:;[:([:+/[:10 1&*[:(#~0&<)[:,[:|:[:([:({.,:{:)(#~([:+./"(1)0&<)))&.|:((i.9)i.(>:i.9)*[:(((E.~&'one')+.(E.~&'1')),((E.~&'two')+.(E.~&'2')),((E.~&'three')+.(E.~&'3')),((E.~&'four')+.(E.~&'4')),((E.~&'five')+.(E.~&'5')),((E.~&'six')+.(E.~&'6')),((E.~&'seven')+.(E.~&'7')),((E.~&'eight')+.(E.~&'8')),:((E.~&'nine')+.(E.~&'9'))),))&.>[:}:[:<;._1(10{a.)&,)1!:1<'/path/to/input'

NB.aoc23.02.1
{{+/(>@{.#>@{:)(((*./)&.>),:([:<"0[:>:[:i.#))([:([:(]`([:*./(12 13 14)>:]))@.(a:~:<)[:+/[:>"1[:(<@{{(]`(([:([:{.(#~+./"1))&.|:(E.~&'r'),(E.~&'g'),:(E.~&'b'))*([:".(#~e.&'0123456789')))@.(a:~:<))(((q+1)&}.),((q=.i.&(32{a.)y)&{.))y}});._1','&,);._1 ';',])&.>{:&.|:}:([:<;._1':'&,);._1(10{a.),y}}1!:1<'/path/to/input'

NB.aoc23.02.2
{{+/;([:*/[:>./[:([:+/[:>[:(<@{{(]`(([:([:{.(#~+./"1))&.|:(E.~&'r'),(E.~&'g'),:(E.~&'b'))*([:".(#~e.&'0123456789')))@.(a:~:<))(((q+1)&}.),((q=.i.&(32{a.)y)&{.))y}});._1','&,);._1 ';',])&.>{:&.|:}:([:<;._1':'&,);._1(10{a.),y}}1!:1<'/path/to/input'

NB.aoc23.03.1
{{
P=.{{([:>[:{.[:({{(>z),.((z=.([:<"1$#:([:I.[:+./(](1+i.#y)E."0 1,)))y){y)}};])[:([:}:[:;[:(]`(0:&.>)@.(a:=]))[:]`(+/,#$0:)@.(a:~:<)&.>[:<;._1,~&0)"1[:(+./)&.|:[:x&="1 0((2#([:<.[:%:#))$])@((10{a.)&~:#]))y}}
'X z'=.((p=.(([:{(0&{;(1&{+i.@{~&2)))"1))'*=+/&#%-$@'&P y);0
for_q.Y=.p'0123456789'&P y do.
z=.z,(((#~a:~:,)X)([:+./[:;((([:*./1>:[:|-)&.>)/]))((#~a:&~:)q))
end.
'z c y'=.(}.z);0;(];._1(10{a.),y)
for_q.z#Y do.c=.c,".(#~('0123456789'e.~]))(((#~a:&~:)q){y)end.
+/c
}}1!:1<'/path/to/input'

NB.aoc23.03.2
{{
P=.{{([:>[:{.[:({{(>z),.((z=.([:<"1$#:([:I.[:+./(](1+i.#y)E."0 1,)))y){y)}};])[:([:}:[:;[:(]`(0:&.>)@.(a:=]))[:]`(+/,#$0:)@.(a:~:<)&.>[:<;._1,~&0)"1[:(+./)&.|:[:x&="1 0((2#([:<.[:%:#))$])@((10{a.)&~:#]))y}}
p=.(([:{(0&{;(1&{+i.@{~&2)))"1)
Y=.p'0123456789'&P y
X=.p(,'*')&P y
y=.];._1(10{a.),y
+/*/"1".{&y@(#~(<_)&~:)"1@#&Q"1(#~(2=+/"1)),"2 X(([:+./"1[:;"1((([:*./1>:[:|-)&.>)/])))"0 _ Q=.{{(<_)(([:<"1$#:[:I.[:(a:&=),)y)}y}}Y
}}1!:1<'/path/to/input'

NB.aoc23.04.1
+/<.(>@{.(2^(1-~[:+/e.))>@{:)"1}:([:<;._1[:1&}._1&".)"1];._1(10{a.),1!:1<'/path/to/input'

NB.aoc23.04.2
{{'r z'=.(1#~R=.#y=.}:([:<;._1[:1&}._1&".)"1];._1(10{a.),y);0 while.+./0<r do.for_q.I.r do.z=.z+1[r=.(r+((0#~q+1),(M#1),(0#~R-q+(M=.(>@{.([:+/e.)>@{:)q{y)+1))+((0#~q),_1,(0#~R-q+1)))end.end.z}}1!:1<'/path/to/input'

NB.aoc23.06.1
*/([:+/([:*/"1[:(,.|.)[:i.[:>:{.)>{:)"1}.|:}:_".];._1(10{a.),1!:1<'/path/to/input'

NB.aoc23.06.2
*/([:+/([:*/"1[:(,.|.)[:i.[:>:{.)>{:)"1}:,".(#~e.&'-0123456789');._1(10{a.),1!:1<'/path/to/input'

NB.aoc23.08.1
{{
s=.0
t=._1&|.('R'=[:>{.)y=.}:<;._1(10{a.),y
'q l r'=.|:([:>"1([:(-.&a:)([:-.e.&'ABCDEFGHIJKLMNOPQRSTUVWXYZ')<;._2])&.>)(2&}.)y
p=.q i.c=.'AAA'
while.-.c-:&,'ZZZ'do.
p=.q i.c=.p{l"_`(r"_)@.{.t=.1&|.t
s=.s+1
end.
s
}}1!:1<'/path/to/input'

NB.aoc23.08.2 fixme
{{
s=.0
t=._1&|.('R'=[:>{.)y=.}:<;._1(10{a.),y
'q l r'=.|:([:>"1([:(-.&a:)([:-.e.&'ABCDEFGHIJKLMNOPQRSTUVWXYZ')<;._2])&.>)(2&}.)y
c=.((p=.I.'A'={:"1 q){])q
while.([:+./'Z'~:{:"1)c do.
p=.q i.[c=.p{l"_`(r"_)@.{.t=.1&|.t
s=.s+1
end.
s
}}1!:1<'/root/dcs/j/iaoc2308'

NB.aoc23.07.1 fixme
q=:1!:1<'/root/dcs/j/iaoc2307'
w=:0 :0
32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483
)

r=.{{
select.q=.>./w=.+/'23456789TJQKA'&="1 0 y
 fcase.5 do.
  case.4 do.(2+q)*1+w i:q NB. k4
  case.3 do.
    if.2=([:1&{\:~)y do. NB. fh
      5^~1+w i:q
    else. NB. k3
      4^~1+w i:q
    end.
  case.2 do.
    if.+/2=w do. NB. p2
      3^~1+w i:q
    else. NB. p1
      2^~1+w i:q
    end.
  case.1 do. NB. hc
      1^~1+w i:q
end.
}}

{{
NB. R rank
NB. b bet
NB. y hand
'R b'=.(>@{. ,. ".@>@{:) &. |: ( ( ( r ) &.> @ {.) ,: {:) &. |: Y=.}:([:<;._1(32{a.)&,);._1(10{a.),y
for_w.~.R do.
NB. ( [: (/:((5##)#.'23456789TJQKA'&i.)) [: >"1 {.&.|:)
NB. {{y=.( ( ( ( (<_) ([:I. w  = ]) } ]) @ {.),:{:) &. |:) y}}q2
NB. echo y=.( ( (<"1([: (/: ( (5 # #) #. '23456789TJQKA'&i.) ) ) ) i { y) (i =. I. w = R) } ]) y
NB. echo y=.( ( (<"1([: (/: '23456789TJQKA'&i.) ) ) i { y) (i =. I. w = R) } ]) y


NB. echo y=.(((     [:(/:'23456789TJQKA'&i.)i&{)y)(i=.I.w=R)}])y
i=.I.w=R
([:(/:'23456789TJQKA'&i.)i&{)y
b=.((     [:(/:'23456789TJQKA'&i.)i&{)y) (i) } b
((i{b)+(i.#i))
echo y=.(((     [:(/:'23456789TJQKA'&i.)i&{)y)(i=.I.w=R)}])y


end.
(<"1 y),.(<"1 b)
}}q

NB.  load 'files'

NB. NB. Probably pre-loaded ...sorry if I've missed any
NB. NB. each
NB. NB. &.>
NB. NB. dlb
NB. NB. 1&(128!:11)
NB. NB. cut
NB. NB. ' '&$: :([: -.&a: <;._2@,~)

NB. NB. The 5-card example
NB. ex1 =: {{)n
NB. 32T3K 765
NB. T55J5 684
NB. KK677 28
NB. KTJJT 220
NB. QQQJA 483
NB. }}

NB. data =: fread'~user/aoc2307.txt'

NB. NB. parse hands from script (ex1) or file
NB. NB. saving hands & bids as globals - allows testing ideas - could have delivered them as results
NB. read1 =: {{ 0 read1 y
NB. :
NB. 'hands bids' =: |:>' 'cut each dtb each LF cut y
NB. bids =: ,". bids
NB. if. x do.
NB. hands =: x {. hands
NB. bids =: x {. bids
NB. end.
NB. #hands
NB. }}
NB. NB. define card values in required order
NB. labels =: 'AKQJT98765432'

NB. NB. Take preamble's examples of 6 different types of hand as paradigms of patterns
NB. paradigms =: ;:'AAAAA AA8AA 23332 TTT98 23432 A23A4 23456'
NB. NB. paradigms as numerical array,
NB. [ntypes =: /:~@:(_5{.#/.~)"1 >paradigms
NB. 0 0 0 0 5
NB. 0 0 0 1 4
NB. 0 0 0 2 3
NB. 0 0 1 1 3
NB. 0 0 1 2 2
NB. 0 1 1 1 2
NB. 1 1 1 1 1
NB. gettype =: ntypes i. /:~@:(_5{.#/.~)"1
NB. NB. gettype > paradigms
NB. NB. 0 1 2 3 4 5 6

NB. NB. Do the example
NB. NB. read1 ex1
NB. NB. 5
NB. NB. hands
NB. NB. 32T3K
NB. NB. T55J5
NB. NB. KK677
NB. NB. KTJJT
NB. NB. QQQJA
NB. NB. gettype hands
NB. NB. 5 3 4 4 3


NB. NB. get numerical reps of hands
NB. NB. labels i. hands
NB. NB. 11 12 4 11 1
NB. NB. 4 9 9 3 9
NB. NB. 1 1 8 7 7
NB. NB. 1 4 3 3 4
NB. NB. 2 2 2 3 0

NB. NB. we can sort these values
NB. NB. \: labels i. hands
NB. NB. 0 1 4 3 2

NB. NB. But we actually need to sort hands within types
NB. NB. (gettype ,. labels&i.) hands
NB. NB. 5 11 12 4 11 1
NB. NB. 3 4 9 9 3 9
NB. NB. 4 1 1 8 7 7
NB. NB. 4 1 4 3 3 4
NB. NB. 3 2 2 2 3 0

NB. NB. so the sort order is now
NB. NB. \: (gettype ,. labels&i.) hands
NB. NB. 0 3 2 1 4

NB. NB. and the ranks (in origin 1) are:
NB. NB. >:/:\: (gettype ,. labels&i.) hands
NB. NB. 1 4 3 2 5
NB. NB. Is it just chance that in the example, ranks = 1 + the sort order?!

NB. read1 ex1
NB. doranks =: {{ 0 doranks y NB. defaults at all hands, but can do the first few for testing purposes
NB. :
NB. read1 y   NB. could localise hands & bids by delivering them here
NB. types =. gettype hands
NB. ranks =. >:/:\:types,.labels i. hands
NB. bids +/ . * ranks
NB. }}

NB. NB. doranks ex1
NB. NB. 6440
NB. NB. doranks data
NB. NB. 253603890
NB. NB. That's the right answer! You are one gold star closer to restoring snow operations.

NB. NB. END

NB.aoc23.09.1
{{w=.0 for_q.i.<:#y=._&".;._1(10{a.),y do.w=.+/({:Q),w,(([:-1+[:+/[:0&={:){"1])(([:|.[:i.#)|."0 1])((0{[:I.([:*./0&=)"1){.])((2-~/\])^:(1+i.#Q)Q=.q{y)end.w}}1!:1<'/path/to/input'

NB.aoc23.09.2
{{w=.0 for_q.i.<:#y=._&".;._1(10{a.),y do.w=.+/w,{{w=.(#y)#0 for_q.([:i.&.<:#)y do.w=.((q{y)-(q-1){w)q}w end.{:w}}|.,&0({.Q)&,{."1((0{[:I.([:*./0&=)"1){.])((2-~/\])^:(1+i.#Q)Q=.q{y)end.w}}q=.1!:1<'/path/to/input'

NB.aoc23.15.1
{{o=.0 for_q.([:<;._1','&,)}:y do.o=.o+{{w=.0 for_q.(a.&i.)y do.w=.(256|17*w&+)q end.w}}>q end.o}}1!:1<'/path/to/input'
NB. 0([`((256|(17*[)+a.i.0{])$:}.@]) @.(0<#@]))'HASH'
NB. 0([`( (256|[+17*a.i.0{]) $: (}.@]) ) @.(0<#@]))'HASH'

NB.aoc23.15.2 fixme
{{
for_q.([:<;._1','&,)}:y do.
l=.I.'0123456789'e.>q
if.'='e.>q do.
echo <;._1'='&,>q
else.
echo <;._1'-'&,>q
end.
NB. ??????????????
end.''
}}'rn=1,cm-,qp=3,cm=2,qp-,pc=4,ot=9,ab=5,pc-,pc=6,ot=7'

NB.aoc23.13.1
{{z=.0 for_g.([:>"1 LF&cut)L:0(2#LF)<{{((-.&a:)(0<{:(+_1&|.)^:(i.#x)(x E.y))u;._2 y),{:(-.&a:)(0<{:(+_1&|.)^:(i.#x)(x E.y))u;._1 y}}y do.'X Y'=.$g=.>g for_r.|.{{(-.&a:)(#~(((0={.)+.((<:y)={:))*.(0=2|#)))L:0,{{r=.''for_q.1+i.l=.#y do.for_w.i.q do.r=.r,<(l-q-1){.w|.y end.end.r}}i.y}}X do.r=.>r if.r([:*./[:,(([:|.-:@#@[{.[){])=((-:@#@[}.[){]))g do.z=.z+1e2*1+0{({~([:(,~<:)[:-:#))r continue.end.end.for_r.|.{{(-.&a:)(#~(((0={.)+.((<:y)={:))*.(0=2|#)))L:0,{{r=.''for_q.1+i.l=.#y do.for_w.i.q do.r=.r,<(l-q-1){.w|.y end.end.r}}i.y}}Y do.r=.>r if.r([:*./[:,(([:|.-:@#@[{.[){])=((-:@#@[}.[){]))|:g do.z=.z+1+0{({~([:(,~<:)[:-:#))r continue.end.end.end.z}}1!:1<'/path/to/input'

NB.aoc23.13.2
{{z=.0 for_g.([:>"1 LF&cut)L:0(2#LF)<{{((-.&a:)(0<{:(+_1&|.)^:(i.#x)(x E.y))u;._2 y),{:(-.&a:)(0<{:(+_1&|.)^:(i.#x)(x E.y))u;._1 y}}y do.'X Y'=.$g=.>g for_r.|.{{(-.&a:) (#~(((0={.)+.((<:y)={:))*.(0=2|#)))L:0,{{r=.''for_q.1+i.l=.#y do.for_w.i.q do.r=.r,<(l-q-1){.w|.y end.end.r}}i.y}}X do.r=.>r if.r([:(+/=([:<:#))[:,(([:|.-:@#@[{.[){])=((-:@#@[}.[){]))g do.z=.z+1e2*1+0{({~([:(,~<:)[:-:#))r continue.end.end.for_r.|.{{(-.&a:)(#~(((0={.)+.((<:y)={:))*.(0=2|#)))L:0,{{r=.''for_q.1+i.l=.#y do.for_w.i.q do.r=.r,<(l-q-1){.w|.y end.end.r}}i.y}}Y do.r=.>r if.r([:(+/=([:<:#))[:,(([:|.-:@#@[{.[){])=((-:@#@[}.[){]))|:g do.z=.z+1+0{({~([:(,~<:)[:-:#))r continue.end.end.end.z}}1!:1<'/path/to/input'

NB.aoc23.21.1
{{i=.($#:[:I.[:'.'&=,)g=.'.'(s=.,($#:[:I.[:'S'&=,)g)}g=.}:];._1 LF&,y
{.$([:(#~e.&i"1)[:~.((1 0&+),(-&1 0),(0 1&+),:(-&0 1))"1)^:63~.((1 0&+)"1,(-&1 0)"1,(0 1&+)"1,:(-&0 1)"1)s}}1!:1<'/path/to/input'

NB.aoc23.21.2 fixme
NB. 1
{{i=.<"1($#:[:I.[:'.'&=,)g=.'.'(s=.<,($#:[:I.[:'S'&=,)g)}g=.}:];._1 LF&,y
p=.([:(#~e.&i)[:,((1 0&+);(-&1 0);(0 1&+);(-&0 1))S:0)s
'l s'=.0;$g
while.26501365>l=.l+1 do.p=.([:(#~([: e.&i s&|L:0))[:~.[:,((1 0&+);(-&0 1);(0 1&+);(-&0 1))S:0)p end.$p}}1!:1<'/path/to/input'
NB. 2
{{i=.<"1($#:[:I.[:'.'&=,)g=.'.'(s=.<,($#:[:I.[:'S'&=,)g)}g=.}:];._1 LF&,y
z=.$g
$(([:(#~([: e.&i z&|L:0))[:~.[:,((1 0&+);(-&1 0);(0 1&+);(-&0 1))S:0))^:(26501365-1)([:(#~e.&i)[:,((1 0&+);(-&0 1);(0 1&+);(-&0 1))S:0)s
}}1!:1<'/root/dcs/j/iaoc2321'
NB. 3
{{i=.($#:[:I.[:'.'&=,)g=.'.'(s=.,($#:[:I.[:'S'&=,)g)}g=.}:];._1 LF&,y
z=.$g
{.$([:(#~([:e.&i z&|)"1)[:~.((1 0&+)"1,(-&1 0)"1,(0 1&+)"1,(-&0 1)"1))^:100 ~.((1 0&+)"1,(-&1 0)"1,(0 1&+)"1,:(-&0 1)"1)s
}}1!:1<'/root/dcs/j/iaoc2321'

NB.aoc23.14.1
{{g=.|:|.}:];._1 LF&,y for_q.i.#g do.g=.(]`}.@.((#g)<#);('.'([:I.'e'=])}'O'(([:i.[:+/'e'=]){([:|.[:i.[:#]))}'e'([:I.'O'=])}])L:0<`([:('#'&=<;.1])'#'&,)@.('#'&e.)q{g)q}g end.+/1+0{"1($#:[:I.'O'=,)|:g}}1!:1<'/path/to/input' NB.1
{{+/1+0{"1($#:[:I.'O'=,)|:([:]`}.@.((#g)<#)"1[:;[:('.'([:I.'e'=])}'O'(([:i.[:+/'e'=]){([:|.[:i.[:#]))}'e'([:I.'O'=])}])L:0<`([:('#'&=<;.1])'#'&,)@.('#'&e.))"1 g=.|:|.}:];._1 LF&,y}}1!:1<'/path/to/input' NB. 2

NB.aoc23.14.2 fixme
{{
g=.|:|.}:];._1 LF&,y
z=._1
while.1000000000>z=.z+1 do.
for_q.i.#g do.
g=.(]`}.@.((#g)<#);('.'([:I.'q'=])}'O'(([:i.[:+/'q'=]){([:|.[:i.[:#]))}'q'([:I.'O'=])}])L:0<`([:('#'&=<;.1])'#'&,)@.('#'&e.)q{g)q}g
end.
g=.|:|.g
end.
echo +/1+0{"1($#:[:I.'O'=,)|:g
NB. }}1!:1<'/root/dcs/j/iaoc2314'
}}0 :0
O....#....
O.OO#....#
.....##...
OO.#O....O
.O.....O#.
O.#..O.#.#
..O..#O..O
.......O..
#....###..
#OO..#....
)

NB. 250-day execution
{{'z w'=._1;#g=.}:];._1 LF&,y
NB. +/1+0{"1($#:[:I.'O'=,)|:([:([:]`}.@.(w<#)"1[:;[:('.'([:I.'e'=])}'O'(([:i.[:+/'e'=]){([:|.[:i.[:#]))}'e'([:I.'O'=])}])L:0<`([:('#'&=<;.1])'#'&,)@.('#'&e.))"1[:|:|.)^:4000000000 g
NB. +/1+0{"1($#:[:I.'O'=,)|:4000000000{{([:|:|.)^:(1+4|x) ([:([:]`}.@.(10<#)"1[:;[:('.'([:I.'e'=])}'O'(([:i.[:+/'e'=]){([:|.[:i.[:#]))}'e'([:I.'O'=])}])L:0<`([:('#'&=<;.1])'#'&,)@.('#'&e.))"1[:|:|.)^:x y}} g
NB. +/1+0{"1($#:[:I.'O'=,)|:([:([:]`}.@.(w<#)"1[:;[:('.'([:I.'e'=])}'O'(([:i.[:+/'e'=]){([:|.[:i.[:#]))}'e'([:I.'O'=])}])L:0([:('#'&=<;.1])'#'&,))"1[:|:|.)^:100 g
+/1+0{"1($#:[:I.'O'=,)|:([:(w{.&.|."1[:;[:('.'([:I.'e'=])}'O'(([:i.[:+/'e'=]){([:|.[:i.[:#]))}'e'([:I.'O'=])}])L:0([:('#'&=<;.1])'#'&,))"1[:|:|.)^:1e3 g NB. halved time?
}}1!:1<'/root/dcs/j/iaoc2314'


NB.aoc23.18.1 fixme
require'regex'
{{
g=.'#'(<c=.0 0)}'.'$~s=.2 1{+/d2=.((([:]"1&.|:'UDLR'="0 1[:;{.)*"1 1([:".S:0{:))&.|:)d1=.0 1&{&.|:(((3%~#),3:)$])(LF,' ')<{{(+./x="0 1 y)u;._2 y}}y
for_q.d3=.((0 2&{-~1 3&{)&.|:)d2 do.g=.'#'(<z=.c+"1 1([:|:{{|.^:(0>y)(**1+i.)y}}^:(0&~:)"0)q)}g
c=.{:z end.w=.0
for_q.g do.w=.w++/#S:0'(^|(?<=\.))(#+\.*#+)($|(?=\.))'rxall q end.w
NB. too low
NB. 45445
}}1!:1<'/root/dcs/j/iaoc2318'

NB.aoc23.05.1
{{r=.0[maps=.,.(_3<\])L:0".L:0}.y[seeds=.,".>{.y=.,.}.(#~ (e.&('0123456789 ')))L:0':'cut(' '([:I.LF&=)@]}])y for_seed.seeds do.for_map.maps do.map=.,:^:_1>>map if.+./z=.map (( (1&{ + {:)@[ >: ])*.(1&{@[ <: ]))"1 seed do.seed=.(seed-1&{Z)+{.Z=.,:^:_1 z#map end.end.r=.seed,r end.<./}:r }}1!:1<'/path/to/input'

NB.aoc23.05.2
NB. 1 outta ram
{{r=.0[maps=.,.(_3<\])L:0".L:0}.y[seeds=.([:;[:(i.@>:@{:+{.)L:(0)_2<\]),".>{.y=.,.}.(#~ (e.&('0123456789 ')))L:0':'cut(' '([:I.LF&=)@]}])y for_seed.([:;[:(i.@>:@{:+{.)L:(0)_2<\])seeds do.for_map.maps do.map=.,:^:_1>>map if.+./z=.map (( (1&{ + {:)@[ >: ])*.(1&{@[ <: ]))"1 seed do.seed=.(seed-1&{Z)+{.Z=.,:^:_1 z#map end.end.r=.seed,r end.<./}:r}}1!:1<'/path/to/input'
NB. 2
{{r=._[maps=.,.(_3<\])L:0".L:0}.y[seeds=.,".>{.y=.,.}.(#~e.&('0123456789 '))L:0':'cut(' '([:I.LF&=)@]}])y for_pair._2<\seeds do.seed=.q['q w'=.>pair whilst.(q+w)>seed do.s=.seed for_map.maps do.if.+./z=.(map=.,:^:_1>>map)(((1&{+{:)@[>:])*.(1&{@[<:]))"1 s do.s=.(s-1&{Z)+{.Z=.,:^:_1 z#map end.end.seed=.1+seed[r=.s<.r end.end.x:r}}1!:1<'/root/dcs/j/iaoc2305'
NB. 3
{{r=._[maps=.,.(_3<\])L:0".L:0}.y[seeds=.,".>{.y=.,.}.(#~e.&('0123456789 '))L:0':'cut(' '([:I.LF&=)@]}])y
test=.{{for_map.x do.if.+./z=.(map=.,:^:_1>>map)(((1&{+{:)@[>:])*.(1&{@[<:]))"1 y do.y=.(y-1&{Z)+{.Z=.,:^:_1 z#map end.end.}}
for_pair._2<\seeds do.seed=.{.'q w'=.>pair whilst.(q+w)>seed do.seed=.1+seed[r=.r<.maps test seed end.end.x:r}}1!:1<'/root/dcs/j/iaoc2305'

NB.aoc23.11.1
fucked problem statement

NB.aoc21.01.1
(+/@(2({.<{:)\]))}:".;._2 LF,1!:1<'/path/to/input'

NB.aoc21.01.2
(+/@(2({.<{:)\]@3(+/)\]))}:".;._2 LF,1!:1<'/path/to/input'

NB.aoc21.02.1
{{'D W'=.0[q=.{."1 q[w=.". w['q w'=.|:0 1&{&.|:}.([:(' '&=<;._1])' '&,)"1 ];._2 LF,y for_e.q do.select.e case.'f' do.D=.D+e_index{w case.'u' do.W=.W+e_index{w case.'d' do.W=.W-e_index{w end.D*W}}1!:1<'/path/to/input'

NB.aoc21.02.2
{{'a D W'=.0[q=.{."1 q[w=.". w['q w'=.|:0 1&{&.|:}.([:(' '&=<;._1])' '&,)"1 ];._2 LF,y for_e.q do.select.e case.'f'do.W=.W-a*z[D=.D+z=.e_index{w case.'u'do.a=.a+e_index{w case.'d'do.a=.a-e_index{w end.end.D*W}}1!:1<'/path/to/input'

NB.aoc21.03.1
*/;2&#.L:0(;-.)0>(>.2%~#q)-(+/q=.}.,"2"."0 ];._2 LF,1!:1<'/path/to/input')

NB.aoc21.03.2
{{y=.1[c=.0[q=.Q=.}.,"2"."0 ];._2 LF,y while.do.q=.(#~((z=.(w=.c{+/q)>:-:#q)=c&{"1))q if.1=#q do.y=.y*2#.,q break.end.c=.>:c end.q=.Q[c=.0 while.do.q=.(#~((z=.-.(w=.c{+/q)>:-:#q)=c&{"1))q if.1=#q do.y=.y*2#.,q break.end.c=.>:c end.}}1!:1<'/path/to/input'

NB.aoc21.04.1
{{B=.}.@}:"2(([:".;._1 ]) )S:0 y=.}.y[b=.".-.&LF>{.y=.(((2#LF)&E.)<;.1])LF,LF,y for_q.b do.B=.(_ z}])B[z=.([:<"1$#:[:I.q=,)B if.0<#w=.($#:[:I.,)(5#_)-:"1 1(],|:"2)B do.w=.{.({:,~(#B)|{.),w break.end.end.q*+/,(0(([:<"1$#:[:I._=,)w{B)}])w{B}}1!:1<'/path/to/input'

NB.aoc21.04.2
{{r=.''[c=.i.#B=.}.@}:"2(([:".;._1 ]) )S:0 y=.}.y[b=.".-.&LF>{.y=.(((2#LF)&E.)<;.1])LF,LF,y for_q.b do.B=._ z}B[z=.([:<"1$#:[:I.q=,)B[A=.(c-.r){B if.0<#z=.(#B)&|([:{."1$#:[:I.,)(5#_)-:"1 1 (],|:"2)B do.A=.B{~c-.r=.~.r,z if.100=$r do.break.end.end.end.(+/,(0([:I._=])@] } ]),({:r){B)*q}}1!:1<'/root/dcs/j/iaoc2104'

NB.aoc21.05.1
NB.aoc21.05.2
solved, but deleted solutions before copying *shrug*

NB.aoc21.06.1
NB. borked, this is from somethere else, but idunno wherefrom
{{w=._[y=.,}.".;._2 LF,y for_q.i.>:>./y do.w=.w<.([:+/[:|q-~])y end.w }}1!:1<'/path/to/input'

NB.aoc21.06.2 fixme
256{{'f z y'=.'';_1;,".}.];._2 LF,y
while.x>z=.>:z do.
echo z NB. too much RAM used; borked after ~170
y=.<:y[f=.<:f
if.0<I=.#i=.I.0=y do.f=.f,I#9[y=.7 i}y end.
if.0<I=.#i=.I.0=f do.y=.y,I#7[f=.9 i}f end.
end.#y,(#~9&~:)f end.#y,(#~9&~:)f}}1!:1<'/path/to/input'

NB.aoc21.07.1
{{V=.{:"1(2&}.)L:0 ([:<;.1'|',])S:0 y[r=.0[y=.,}.<;._2 LF,y for_q.V do.for_w.([:<;._1])' ',;q do.select.#>w case.7 do.r=.>:r case.4 do.r=.>:r case.3 do.r=.>:r case.2 do.r=.>:r end.end.end.r}}1!:1<'/root/dcs/j/iaoc2108'

NB.aoc21.07.2

NB.aoc21.08.1
{{r=.0[y=.,}.<;._2 LF,y for_words.{:"1(2&}.)L:0 ([:<;.1'|',])S:0 y do.for_word.([:<;._1])' ',;words do.select.#word=.>word case.7 do.r=.>:r case.4 do.r=.>:r case.3 do.r=.>:r case.2 do.r=.>:r end.end.end.r}}1!:1<'/path/to/input'

NB.aoc21.08.2 fixme very suboptimal
{{'digits zero one two three four five six seven eight nine r'=._1;'';'';'';'';'';'';'';'';'';'';0[y=.,}.<;._2 LF,y
for_words.,.<"1' '(#@[}.<@[;@,.])"1' | '&{{-.&a:((1 e}w)[e=.,(i.#x)+"(1 0)I.w=.x E.q)<;._1(q=.x,y)}}S:0 y do.
  while.0<+/_1=digits do.
    digits=._1#~4
    label_q.
    for_word.14{.<;._1' ',;words do.
      select.#word=.,;word
      case.7 do.if.word_index>9 do.digits=.8(word_index-10)}digits end.eight=.word
      case.4 do.if.word_index>9 do.digits=.4(word_index-10)}digits end.four=.word
      case.3 do.if.word_index>9 do.digits=.7(word_index-10)}digits end.seven=.word
      case.2 do.if.word_index>9 do.digits=.1(word_index-10)}digits end.one=.word
      case.5 do.
            if.(five&-:+.six&(5=[:+/e.)+.two&(3=[:+/e.))word do.if.word_index>9 do.digits=.5(word_index-10)}digits end.five=.word
        elseif.(two&-:+.nine&(4=[:+/e.)+.five&(3=[:+/e.)+.four&(2=[:+/e.))word do.if.word_index>9 do.digits=.2(word_index-10)}digits end.two=.word
        elseif.(three&-:+.five&(4=[:+/e.)+.two&(4=[:+/e.)+.seven&(3=[:+/e.)+.one&(2=[:+/e.))word do.if.word_index>9 do.digits=.3(word_index-10)}digits end.three=.word
        end.
      case.6 do.
            if.(six&-:+.seven&(2=[:+/e.)+.one&(1=[:+/e.))word do.if.word_index>9 do.digits=.6(word_index-10)}digits end.six=.word
        elseif.(nine&-:+.three&(5=[:+/e.)+.four&(4=[:+/e.))word do.if.word_index>9 do.digits=.9(word_index-10)}digits end.nine=.word
        else.if.word_index>9 do.digits=.0(word_index-10)}digits end.zero=.word
        end.
      end.
    end.
    if.0<+/_1=digits do.goto_q.end.
  end.
  r=.r+number=.10#.;digits
  'digits zero one two three four five six seven eight nine'=._1;'';'';'';'';'';'';'';'';'';''
end.
r
}}1!:1<'/root/dcs/j/iaoc2108'

NB.aoc21.09.1
{{+/1+({~([:<"1[:($#:[:I.,) (([:</2{.]),(3([:*./(1)&{<(0 2)&{)\]),([:>/_2{.]))"1{{(u*.u&.v)y}}|:)){{([:,"(1+~+/1=$y)(|:~([:I.1=$)))y}}(}."."0;._2 LF,y)}}1!:1<'/path/to/input'

NB.aoc21.09.2
?


NB. arbitrary length, square sudoku solver sudoku
NB. intersection
is=:([-.-.)
NB. creates verbs and nouns for solving (y y)-shaped sudokus
c=:{{)m
  NB. integer, greater 1, scalar, finite
  assert.([:*./(>.=<.),(2&<:),(''-:$),(_&~:))y
  NB. presentation verb
  a=:((2#y^2)$,)f.
  NB. missing numbers of boxed >1-dim
  mn=:((1+i.y^2)&-.@;"2@:(((1=#@>)"0#])"1))f.
  NB. auxiliary noun
  Q=:i.y
  NB. get a cell's corresponding faces', rows', and columns' indicies, boxed, in 3 4 shape
  frc=:3 :'((q;Q;e;Q),(q;w;Q;Q),:(Q;Q;e;r))"_''q w e r''=.y'f.
  NB. hypercube indices
  i=:([:($#:[:I.[:1:"0,)0$~4#])y
  NB. replace all 0s, empty cells, with could-be numbers
  NB. rz=:(i & (  (]) ` (([: < [: is/ ([: mn ([: <"1 [: frc [) { ]) ) (<@[) } ]) @. ( 0 = >@] )"0 @ ( (< @ [) { ] ) )"1 _) NB. fixme
  NB. rz=:{{for_q.i do.y=.(([:<[:is/([:mn(<"1 frc q){]))(<q)}])"_^:(0=[:>(<q){])y end.}} NB. more time and more space, ffs
  rz=:{{    for_q.i do.if.0=>(<q){y do.y=.(<is/(mn(<"1 frc q){y))(<q)}y end.end.}}f.
  NB. renew a grid's could-be numbers
  rg=:{{    for_q.i do.if.1<#>(<q){y do.e=.is/(mn(<"1 frc q){y)if.1=#e do.y=.rg(<e)(<q)}y else.y=.(<e)(<q)}y end.end.end.}}f.M.
  NB. if empty (0-containing), amend with the intersection of the missing numbers of its fcrs; elif possibilities (could-be numbers), for each its fcrs, amend w/ its one unique possibility, having removed self, if unique, else, treat as if empty fixme
  it=:{{)m
    NB. return if solved
    if.((^&4>:{:Q)=([:#;))y do.y return.end.
    for_q.i do.
      if.1<#w=.>(<q){y do.
        if.1=#e=.,(>)`((is&(,@;))/)@.(1<#)([:(a:&~:#])<"1@(w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y do.
          NB. |domain error in solv, executing dyad (<00;0 1 2;2;0 1 2),(<00;00;0 1 2;0 1 2),<0 1 2;0 1 2;2...}
          NB. |   y=.rg(<e)(<q)}((-.&e&.>)F{y)    F}y
          try.
            y=.rg(<e)(<q)}((-.&e&.>)F{y)F}y NB. fixme exclude solved cell from fcr to forgo 2. amend?
          catch.
            y
          end.
        else.
          NB. todo check if one possibilities is unique, and, if so, use it
          NB. todo if x possibilitis in any one fcr, of length n have n-1 duplicates, exclude from pool
          NB. if.1=#e=.is/(mn F{y)do.y=.rg(<e)(<q)}((-.&e&.>)F{y)F}y elseif.1<#e do.y=.rg(<e)(<q)}y end.
          y=.(<is/(mn F{y))(<q)}y
          NB. y
          NB. return.
        end.
      end.
    end.
  }}f.
  solv=:(it^:_@rg@rz)f.
  ''
}}f.
c 3
(([: < a),([: < [: a solv))eu1
(([: < a),([: < [: a solv))eu2
(([: < a),([: < [: a solv))hu NB. fail