e signals error if the left argument has an
item larger than the largest item in the right:

   1e9 2e9 e P
|index error: e
|   1000000000 2000000000     e P

I wonder if the interpreter should look for
sorted y in x e. y as a special case.



----- Original Message -----
From: John Randall <[email protected]>
Date: Wednesday, May 20, 2009 13:56
Subject: [Jprogramming] Membership using interval index
To: Programming forum <[email protected]>

> I have been trying to write a version of e. for sorted arrays, using
> I. , since it appears to offer performance benefits.  My 
> attempt is
> the verb e below:
> 
> e=:[ = ] {~ I.~
> 
> time=:6!:2
> P=:i.&.(p:^:_1) 1e6
> 
>    10 time '(i.1000) e P'
> 0.0001042
>    10 time '(i.1000) e. P'
> 0.0069257
> 
> Is this a sensible approach, or are there better ways to do it?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to