Jump to content

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> 12 10 12 0 1 0 1 10 0 1 01 1 1 0 1 10
12 10 12 0 1 0 1 10 0 1 01 1 1 0 1 10
* 2 </\0 2 0, 1 10 1 0 0 1 1 0 1 0 1 1 0 1 1
1 0 01 0 1 0 1 0 0 1 01 1 0 01 1 0
+/\(0, *) 2 </\0 2 0, 1 10 1 0 0 1 1 0 1 0 1 1 0 1 1
10 1 10 1 0 1 20 21 20 30 31 41 41 41 51 5</lang>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.
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.