Stencil: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Remove closing pre HTML tags that were within the source tags and displaying, which looks unintended.) |
||
Line 26: | Line 26: | ||
In the following example, each neighbourhood is immediately [[ravel]]led and [[sum]]med: | In the following example, each neighbourhood is immediately [[ravel]]led and [[sum]]med: | ||
<source lang=apl> | <source lang=apl> | ||
{+/,⍵}⌺3 3⊢3 3⍴⍳9 | {+/,⍵}⌺3 3⊢3 3⍴⍳9 | ||
12 21 16 27 45 33 24 39 28 | 12 21 16 27 45 33 24 39 28 | ||
</source> | </source> | ||
Line 42: | Line 42: | ||
life ← {3=s-⍵∧4=s←{+/,⍵}⌺3 3⊢⍵} | life ← {3=s-⍵∧4=s←{+/,⍵}⌺3 3⊢⍵} | ||
{'.⍠'[⍵]}¨ (⍳8) {life⍣⍺⊢⍵}¨ ⊂glider | {'.⍠'[⍵]}¨ (⍳8) {life⍣⍺⊢⍵}¨ ⊂glider | ||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ | ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ | ||
│..⍠..│.⍠...│..⍠..│.....│.....│.....│.....│.....│ | │..⍠..│.⍠...│..⍠..│.....│.....│.....│.....│.....│ |