Are you aware of http://www.jsoftware.com/help/dictionary/d202v.htm ?
R.E. Boss (Add your info to http://www.jsoftware.com/jwiki/Community/Demographics ) > -----Original Message----- > From: [email protected] [mailto:programming- > [email protected]] On Behalf Of Pascal Jasmin > Sent: zaterdag 16 november 2013 21:32 > To: [email protected] > Subject: [Jprogramming] repeatuntil and repeat while tacit definitions > possible? > > 2 conjunctions with monad only versions shown for simplicity > > repeatuntil =: 2 : 'for_i. y do. if. v"_ s =. u i do. s break. end. end.' > > repeatwhile =: 2 : 0 > out =. i.0 > for_i. y do. if. v"_ s =. u i do. out break. else. out =. out , s end. end. > ) > > +: repeatuntil (6 < ]) 2 1 3 2 4 5 2 > 8 > +: repeatwhile (6 < ]) 2 1 3 2 4 5 2 > 4 2 6 4 > > both short circuit based on finding an exit condition. I'd be surprised that a > tacit version is possible, but maybe through scan '/' and ^: ? > > I understand that the example is silly overkill, but the main application is for > repeatuntil is searching in many locations sorted by the likelihood of finding it > in a location. > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
