Re: [stack] ck: array operations in joy

sa@dfa.com — 2003-05-16 21:06:44

> {[`a`b`c] [a b +] [a c +] *}

doh!

that should have been:

{[`a`b`c]a b + a c + *}

and i've improved the life code a bit by adding a method for padding
the universe with zeros:

[2 [0 , +:] do] `edge def \ glue 0 to top, left;
[[|:] map |:] `mirror def \ t -> b, l -> r;
[2 [edge mirror] do] `pad def \ pad around matrix;

e.g.

matrix 10 pad do

wraps matrix in ten layers of 0.

, is concat, +: is tolerant transpose, |: is reverse.