On Mon, Aug 4, 2008 at 6:11 PM, Matthew Brand <[EMAIL PROTECTED]> wrote:
> As an example, I want to replace the spaces in a date with '0'.

In this case, you don't even have to use amend.  Just use something like this.

   d =: ' 5\ 3\2004' NB. btw, why the backslashes instead of slashes?
is that some national spelling?
   (' '&= {"0 1 ,.&'0') d
05\03\2004
   (' '&= { ,&'0')"0 d
05\03\2004

In fact, you could also use item amend instead of index like this, but
I keep forgetting how that works.  Looking up in the dictionary gets
me this.

   (' '&=@:])`(,:&'0')} d
05\03\2004

Then there's a somewhat strange solution of using power.

   '0'"_^:(' '&=)"0 d
05\03\2004

You could even use agenda similarly to this, but using agenda when
just indexing also works seems like a waste even though it's often
easier to write.

   '0'"[EMAIL PROTECTED](' '&~:)"0 d
05\03\2004

Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to