I have the following verb t and wonder if anyone would like to show how it
could be more elegantly defined (using the Power conjunction?) I would
enjoy learning your result.

The intent of t is to alternatively subtract 1 or 2 from a positive number
showing the intermediate results of say n=20 subtractions.


   e =. -&2
   o =. -&1

   t =. monad define
n =. 20
while. n =. n - 1 do.
if. 2|n do. smoutput y =. e y
else. smoutput y =. o y
end.
end.
)
   t 100
98
97
95
94
92
91
89
88
86
85
83
82
80
79
77
76
74
73
71


-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to