Actually, your second phrase is not faster, due to
magic tricks in the implementation of ({.,#)/.~
http://www.jsoftware.com/help/release/dist.htm
For example:
ts=: 6!:2 , 7!:2...@]
x=: 1e6 ?...@$ 1e5
ts '({.,#)/.~ x'
0.0336093 1.57402e6
ts '(~. ,. #/.~) x'
0.0644375 2.0983e6
----- Original Message -----
From: Raul Miller <[email protected]>
Date: Friday, August 13, 2010 12:45
Subject: Re: [Jprogramming] Jems
To: Programming forum <[email protected]>
> On Fri, Aug 13, 2010 at 3:31 PM, R.E. Boss
> <[email protected]> wrote:
> > ({.,#)/.~ 10 40 10 10 20 30 40
> > 10 3
> > 40 2
> > 20 1
> > 30 1
>
> Or (faster):
> (~.,. #/.~) 10 40 10 10 20 30 40
> 10 3
> 40 2
> 20 1
> 30 1
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm