I like your <;._2 ,&a: <;._2 y expression for splitting on the blank line. That's something I wish I had thought of.
Thanks, -- Raul On Tue, Jan 4, 2022 at 2:42 AM Stefan Baumann <[email protected]> wrote: > > Represented the paper as a binary matrix, but didn't use Fold for the > folds. Instead - with the folds along the x and y axis being defined as fx > and fy resp. - the folding sequence is constructed from the axes a and > folds f as one sentence and then executed with ". > > rd=: 3 : 0 > d=: ".&> 0&{:: y=. <;._2 ,&a: <;._2 y NB. Dots > a=: ; 2{"1 y=. ;:&> 1&{:: y NB. Axes to fold along > f=: ".&> {:"1 y NB. Fold positions > ) > rd 0 : 0 > 6,10 > 0,14 > 9,10 > 0,3 > 10,4 > 4,11 > 6,0 > 6,12 > 4,1 > 0,13 > 10,12 > 3,4 > 3,0 > 8,4 > 1,10 > 2,14 > 8,10 > 9,0 > > fold along y=7 > fold along x=5 > ) > 7 5 > p=: |: 1 (;/d)} $&0 >: >./d NB. The paper as a binary matrix > fy=: {. +. |.@({.~ -)~ NB. Fold along y > fx=: fy&.|: NB. Fold along x > +/, ". (":@{.f),' f', ' p',~ {.a NB. (*) > 17 > _ * -. ". ' p',~ (, ' '&,)/ |. (":@,.f),. ' f',"1 ,.a NB. (**) > 0 0 0 0 0 > 0 _ _ _ 0 > 0 _ _ _ 0 > 0 _ _ _ 0 > 0 0 0 0 0 > _ _ _ _ _ > _ _ _ _ _ > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
