Percolation/Site percolation/J: Difference between revisions
m
no edit summary
m (flesh out examples a bit) |
mNo edit summary |
||
Line 10:
<code>groups</code> uses a sum fold on successive prefixes to identify regions of contiguous bits.
<lang j>
* 2
1 0
(2 </\ 0, *) 2 0 2 0 1 0 1 0 0 1 1 1 1 1 0
1 0 1 0 1 0 1 0 0 1 0 0 0 0 0
([: +/\ 2 </\ 0, *) 2 0 2 0 1 0 1 0 0 1 1 1 1 1 0
1 1 2 2 3 3 4 4 4 5 5 5 5 5 5</lang>
<code>ooze</code> propagates 2s from its right argument to adjacent groups of non-zero locations in its left argument.
|