Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: Rosetta Code: Zig-zag matrix Date: Sun, 11 Sep 2016 22:05:46 -0700 Organization: A noiseless patient Spider Lines: 37 Message-ID: <87oa3thfmd.fsf@jester.gateway.pace.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="590ea01354cf4bcbcd857d7ebbd88128"; logging-data="20285"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yhgmKunzRDXda9gwFGYS5" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:qCs17MSzvUaA6/qQSxbMgIM6Yn4= sha1:dFGvn8qL7H2B27Wu9vZIPXMXxts= Xref: csiph.com comp.lang.forth:50871 "WJ" writes: > 0 1 5 6 14 15 27 28 44 45 65 66 > 2 4 7 13 16 26 29 43 46 64 67 88 > 3 8 12 17 25 30 42 47 63 68 87 89 > 9 11 18 24 31 41 48 62 69 86 90 107 > 10 19 23 32 40 49 61 70 85 91 106 108 > 20 22 33 39 50 60 71 84 92 105 109 122 > 21 34 38 51 59 72 83 93 104 110 121 123 > 35 37 52 58 73 82 94 103 111 120 124 133 > 36 53 57 74 81 95 102 112 119 125 132 134 > 54 56 75 80 96 101 113 118 126 131 135 140 > 55 76 79 97 100 114 117 127 130 136 139 141 > 77 78 98 99 115 116 128 129 137 138 142 143 12 constant n n n * 1- constant km : t ( x y -- n ) + dup 1+ * 2/ ; : reflect ( x y -- x y ) negate swap negate n 1- tuck + -rot + ; : av ( x y -- n ) 2dup t -rot 2dup + 1 and if nip else drop then + ; : bv ( x y -- n ) reflect av km swap - ; : v ( x y -- n ) 2dup + n >= if bv else av then ; : go cr n 0 do n 0 do i j v . loop cr loop ; go 0 1 5 6 14 15 27 28 44 45 65 66 2 4 7 13 16 26 29 43 46 64 67 88 3 8 12 17 25 30 42 47 63 68 87 89 9 11 18 24 31 41 48 62 69 86 90 107 10 19 23 32 40 49 61 70 85 91 106 108 20 22 33 39 50 60 71 84 92 105 109 122 21 34 38 51 59 72 83 93 104 110 121 123 35 37 52 58 73 82 94 103 111 120 124 133 36 53 57 74 81 95 102 112 119 125 132 134 54 56 75 80 96 101 113 118 126 131 135 140 55 76 79 97 100 114 117 127 130 136 139 141 77 78 98 99 115 116 128 129 137 138 142 143 ok