Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,34 @@
!YS-v0
defn main(n=10):
gprint:
zig-zag: n
defn gprint(grid):
f =: (" %$(grid.$.$.digits().#)d" * grid.#)
each line grid:
say: format(f line*)
defn zig-zag(n):
take-from n:
map \(_1 _2) cycle([reverse a]):
partitions _ range(n:sqr):
concat (1 .. n): (n.-- .. -1)
defn take-from(n colls):
lazy-seq:
when-let s seq(colls):
first-n rest-n =: split-at(n s)
cons map(first first-n):
take-from n:
concat _ rest-n:
filter seq:
map rest: first-n
defn partitions(sizes coll):
lazy-seq:
when-let n sizes.0:
when-let s seq(coll):
cons take(n coll):
partitions next(sizes):
drop n: coll