*`(1 0 #~ ,)/ is great.  

Not as nice as yours but it helped me improve my answer where I needed to put
a '#' down the centre of my input matrix:

  ]Data=: 0,.~ ".every (8 16 3{ ;:);._2 freads'14.txt'
 7 124 19 0
15  28  3 0
 9 164 19 0
 9 158 19 0
 7  82 13 0
 6 145 25 0
 3  38 14 0
16  37  3 0
 6 143 25 0
   
]Seconds=: (2503 $ ,`#`,/)"1 Data


On 14 Dec 2015, at 23:58, Henry Rich wrote:

> My version:
>
> NB. Read in data, convert to numeric
>
> sfr =: 0&".@> sfr (3 8 16&{)@;:;._2 wd 'clippaste'
>
> NB. Calculate distances
>
>> ./ (0&{ * (_,1&{) ([ #. <.) 2503 #:~ (0,+/@(1 2&{)))"1 sfr
>
>
> NB. Part 2. Total rewrite required
>
>> ./ +/"1 (="1 >./) +/\"1 (2503 $ *`(1 0 #~ ,)/)"1 sfr
>
>
>
> Henry Rich
>
>
>
> On 12/14/2015 6:45 AM, Ryan Eckbo wrote:
>> I don't understand what Y is, could you explain that?
>>
>> On 14 Dec 2015, at 17:10, 'Pascal Jasmin' via Programming wrote:
>>
>>> in =. ". leaf (3 8 _2 { ;:)"1 a =. > cutLF wdclippaste ''
>>> Y =: (&({::))(@:])
>>>
>>> part1 :
>>>
>>>> ./ {:"1 +/\@(2503 $ (0 #~  2 Y) ,~ 1 Y # 0 Y)"1 in
>>> 2:
>>>
>>>> ./ (] +/@(="1 1) >./) +/\@(2503 $ (0 #~  2 Y) ,~ 1 Y # 0 Y)"1 in
>>> ----------------------------------------------------------------------
>>> 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