Or, dyadic:

f=.4 : 'a$,y,.(a=.2$$y)$x'

   0 f 2 3 5 7
2 0 0 0
0 3 0 0
0 0 5 0
0 0 0 7
   '-' f 'juytr'
j----
-u---
--y--
---t-
----r

Björn Helgason wrote:
>       f=: 3 : 0
> ((#y),(#y))$ y ((1+#y)* i. #y) } ,((#y),(#y))$ ' '
> )
>    f 'abcdef'
> a
>  b
>   c
>    d
>     e
>      f
>
>
> 2008/10/12 Ken Chakahwata <[EMAIL PROTECTED]>
>
>   
>> 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,
>>
>> --
>> Raul
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>     
>
>
>
>   
> ------------------------------------------------------------------------
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to