[Jprogramming] in function which beats the benchmark
Don Guinn
donguinn at gmail.com
Tue Dec 6 13:38:08 UTC 2016
J has a verb "member" (e.) which gives true for if the item of the left
argument is an item in the right argument.
1 3 2 5 6 e. 4 2 1 3
1 1 1 0 0
Is that what you are looking for?
On Tue, Dec 6, 2016 at 5:11 AM, 'Jon Hough' via Programming <
programming at jsoftware.com> wrote:
> Hi, Welcome to the J forums.
>
> I would like to help, but I don't understand what you are asking. Perhaps
> others will understand better.
>
> By *in*, do you mean the "Member in" verb? http://code.jsoftware.com/
> wiki/Vocabulary/edot
>
> On my pretty old spec 32-bit machine:
>
> a =: ? #~ 10000000 NB. 10 million random ints
> b =: 1000}. ? #~ 10000000 NB. (10 million - 1000) random ints
>
> timespacex ' a e. b'
> 0.210506 3.35551e7
>
> I get 211 milliseconds.
>
> --------------------------------------------
> On Tue, 12/6/16, Abi <analyst.tech.jobs at gmail.com> wrote:
>
> Subject: [Jprogramming] in function which beats the benchmark
> To: programming at jsoftware.com
> Date: Tuesday, December 6, 2016, 6:45 PM
>
> Hi,
> I am new to J. Can someone implement the *in* function.
> I have tried various ways but cannot get to beat the
> benchmark of ~130 ms.
>
> list1: 0 til 10MM
> list2 : 1M till 10MM
>
> list2 *in* list1
>
> The line above shows the in operator.
>
> Thanks.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list