Ambrus posted several solutions that do not use Amend. Here's another, using
Copy:
vb=: #!.'0'~ [:(-. + 0j1&*) ' '&=
In writing this I discovered that I needed to use [: instead of @ or @: in
order to make the fork monadic. I tend to think of them as interchangeable
(rank aside) but, situated like this in a dyadic verb, they're not.
--
Tracy B. Harms
A good programming language is a conceptual universe
for thinking about programming.
Alan Perlis
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm