With Dan Bron's correction to the non-general (*=), this
development works quite nicely:
(as usual with my copy & paste, I'm forcing some line
throws, but Thunderbird might still play up)...

  (#^:_1"1 0~ =@/:)'a b d'   NB. default space fill

a b d

  (#^:_1"1 0~ =@/:)1 2 3 4  NB. works with numeric vector too

1 0 0 0
0 2 0 0
0 0 3 0
0 0 0 4

  (#!.'*'^:_1"1 0~ =@/:)'a b d'  NB. other fill, but preserve input blanks

a****
* ***
**b**
*** *
****d

  (#!.'*'^:_1"1 0~ =@/:)1 2 3 4  NB.  but it's horses for courses now!

|domain error
|       (#!.'*'^:_1"1 0~=@/:)1 2 3 4

Mike



Ken Chakahwata wrote:
I am looking at the various expressions contributed to date to see which
ones are general enough to handle a character vector right argument.

enjoy
ken

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Raul Miller
Sent: 12 October 2008 18:35
To: Programming forum
Subject: Re: [Jprogramming] diagonal arrays

On Sun, Oct 12, 2008 at 11:15 AM, Dan Bron <[EMAIL PROTECTED]> wrote:
          (*=@/:)2 7 9 2

Nice.

I had been bothered by my earlier expression (* [EMAIL PROTECTED]@#) -- the 
[EMAIL PROTECTED] was only
needed to ensure that values in each position were unique, and /: does that
nicely.

Thanks,

------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.173 / Virus Database: 270.8.0/1721 - Release Date: 12/10/2008 12:00


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

Reply via email to