Percolation/Site percolation/J: Difference between revisions

Content added Content deleted
m (flesh out examples a bit)
mNo edit summary
Line 10: Line 10:
<code>groups</code> uses a sum fold on successive prefixes to identify regions of contiguous bits.
<code>groups</code> uses a sum fold on successive prefixes to identify regions of contiguous bits.


<lang j> 1 1 1 0 0 1 1 0 1 0 1 1 0 1 1
<lang j> 2 0 2 0 1 0 1 0 0 1 1 1 1 1 0
1 1 1 0 0 1 1 0 1 0 1 1 0 1 1
2 0 2 0 1 0 1 0 0 1 1 1 1 1 0
2 </\ 0, 1 1 1 0 0 1 1 0 1 0 1 1 0 1 1
* 2 0 2 0 1 0 1 0 0 1 1 1 1 1 0
1 0 0 0 0 1 0 0 1 0 1 0 0 1 0
1 0 1 0 1 0 1 0 0 1 1 1 1 1 0
+/\ 2 </\ 0, 1 1 1 0 0 1 1 0 1 0 1 1 0 1 1
(0, *) 2 0 2 0 1 0 1 0 0 1 1 1 1 1 0
1 1 1 1 1 2 2 2 3 3 4 4 4 5 5</lang>
0 1 0 1 0 1 0 1 0 0 1 1 1 1 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.
<code>ooze</code> propagates 2s from its right argument to adjacent groups of non-zero locations in its left argument.