Stephen Taylor describes a simple anagram puzzle on page 99 of the current edition of Vector; http://www.vector.org.uk/archive/v241/v241.pdf and provides a solution in Dyalog using d-fns.
While looking for a J equivalent I ended up using the form 1 : 0 to construct a solution. I had not realised until then just how good 1 : 0 is at composing tacit programs. The following example produces deltb, a tacit verb that deletes leading and trailing blanks. deltb=: [: 1 : 0 a=.' ' ~: ] NB. non-blanks b=. +./\ NB. true after first 1 (deletes leading ) c=. b &.|. NB. true until last 1 (delete trailing) d=. b *. c NB. delete leading and trailing e=. [: d a NB. put it together (#~ e)f. NB. hook that modifies Copy ) 5!:5<'deltb' #~ ([: (+./\ *. +./\&.|.) ' ' ~: ]) Regards David ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
