Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Conway's Game of Life in Q:

    life:{3=a-x*4=a:2(sum -1 0 1 rotate\:,’/)/x}


By comparison in APL:

  life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}


  life←{≢⍸⍵}⌺3 3∊¨3+0,¨⊢
https://youtu.be/3FjYly2G_QI?t=565


I think I've nearly convinced Arthur to include an equivalent to "stencil" in k7. Fingers crossed!


K's approach of arrays of arrays would preclude an efficient 2d stencil operation wouldn't it?




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: