I am not sure what a "boolean list for the first number" is, but:
(~: {. >:@}:@, ]) 4 5 6 7 8 11 12 16 17 19 21 1 0 0 0 0 1 0 1 0 1 1 (~: {. >:@}:@, ]) 0$0 The pattern learned in APL in ancient days, is: instead of doing (}.y) f (}:y) , do y f }:blah,y for some suitable blah. ----- Original Message ----- From: bill lam <bbill....@gmail.com> Date: Sunday, April 26, 2009 22:40 Subject: [Jprogramming] first stone To: JProgramming <programming@jsoftware.com> > I try to find the boolean list for the first number in an strictly > increasing integer list. eg. > > 1, ( >:@}: ~: }.) 4 5 6 7 8 11 12 16 17 19 21 > 1 0 0 0 0 1 0 1 0 1 1 > > but it does not handle the corner case where the list is empty > > 1, ( >:@}: ~: }.) 0$0 > 1 > > I want it to return an empty list instead. Any idea? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm