Hello,

I made my first application on J.
I was surprised that it works faster than K:

pip =: 256 #. x:@:".;._2@:,&'.'
ips =: pip"1 (_1&}.;._2 (1!:1<'ips.txt'))
iprs =: |:pip;._1 "1 (','&,)"1 (_1&}.;._2 (1!:1<'ipr.txt'))
i =: /:{.iprs
l =: i{{.iprs
r =: i{{:iprs
m =: 0,(>./ @: {.&r)"0 (1+i.#l)
f =: <: m {~ I.~&l
6!:2 'f"1 ips'

But I suppose that it could be better:
1) It uses x:, but IP address could fill int, I found that J does not
support unsigned int (K also).
But unfortunately, I cannot find the way in J how to convert 4 numbers
into signed int i J.

2) How is it possible to change m =: 0,(>./ @: {.&r)"0 (1+i.#l)
without right brackets? I expected something like ... "0 @: 1 + i.#l,
but it does not work. I think that "0 +&1 i.#l is not best solution.

3) ips =: pip"1 (_1&}.;._2 (1!:1<'ips.txt')) is very slow, in pip
function, is it possible to make it faster?

4) I cannot find in VOC is I. binary search or something like that?

Thank you,

-- 
Regards,
  Alexander.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to