or (-~ 1!:2&2)/ 1 2 1 2 100 100 98 97 95 94
----- Original Message ----- From: David Lambert <[email protected]> To: programming <[email protected]> Cc: Sent: Monday, July 13, 2015 7:17 PM Subject: Re: [Jprogramming] Powerize a while. Tossing insert into the pot of stone soup: ((-~ {.) , ])/1 2 1 2 100 NB. ,.@:|.@:(expression) 94 95 97 98 100 > Date: Mon, 13 Jul 2015 12:39:46 -0400 > From: Brian Schott<[email protected]> > To: Programming forum<[email protected]> > Subject: [Jprogramming] Powerize a while. > Message-ID: > <caedwnsteyhchg694xmephwd8khit-yjavckrbc25jipy_q+...@mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
