I was about to send something when we had to go out for a bit...

My best so far is
    ((] #~ 1 = I.)~ (0 _1 + ])) ~
assuming I've copied it correctly...

Mike

Please reply to mike_liz....@tiscali.co.uk.      
Sent from my iPad

> On 24 Sep 2017, at 18:45, Skip Cave <s...@caveconsulting.com> wrote:
> 
> Marshall,
> 
> Wow! that is neat! I hadn't really understood dyadic I. but this forced me
> to   try to understand it:
> 
>    8 100 (]#~1=I.) 2 10 45 300
> 
> 10 45
> 
>    8 100 I. 2 10 45 300
> 
> 0 1 1 2
> 
>    1 = 8 100 I. 2 10 45 300
> 
> 0 1 1 0
> 
>    (1 = 8 100 I. 2 10 45 300) # 2 10 45 300
> 
> 10 45
> 
>    8 100 I. 2 10 45 300
> 
> 0 1 1 2
> 
>    1 8 100 I. 2 10 45 300
> 
> 1 2 2 3
> 
>    1 8 100 I. 2 10 45 300 450
> 
> 1 2 2 3 3
> 
>    1 8 100 350 I. 2 10 45 300 450
> 
> 1 2 2 3 4
> 
>    1 8 100 350 I. 300 2 45 10 450
> 
> 3 1 2 2 4
> 
> So now I'm getting a feel for I. Reading the terse Vocabulary description
> of dyadic I. didn't help much in making the I. functionality clear, at
> least for me. The NuVoc description wasn't much more helpful, but the
> examples after the description in Nuvoc cleared things up considerably.
> 
> Also, the dissect tool was very helpful in figuring out how J parsed the
> whole dyadic verb. Who is the author of the dissect tool? That's a great
> help in learning J.
> 
> Skip
> 
> Skip Cave
> Cave Consulting LLC
> 
> On Sun, Sep 24, 2017 at 3:14 AM, Marshall Lochbaum <mwlochb...@gmail.com>
> wrote:
> 
>> Try
>> 
>> rng =: ] #~ 1=I.
>> 
>> it's about half as fast because I. is not very well-optimized.
>> 
>> Marshall
>> 
>>> On Sun, Sep 24, 2017 at 02:29:31AM -0500, Skip Cave wrote:
>>> Here's a function I came up with to select numbers in a vector which are
>>> within some range.
>>> 
>>> Find all the numbers between 10 & 100 in a set of random numbers from 0
>> to
>>> 200:
>>> 
>>> 
>>>        rng =. 4 : '((({.x)</y)*.(({:x)>/y))#y'
>>> 
>>> 
>>>      10 100 rng ?50$200
>>> 
>>> 89 91 32 85 84 27 31 20 28 66 96 93 22 85 39 97 82 35 90 67 34 35 67 95
>> 50
>>> 
>>> 
>>> Between 120 & 180:
>>> 
>>> 
>>>        120 180 rng ?50$200
>>> 
>>> 148 163 133 165 150 178 121 146 161 179
>>> 
>>> 
>>> Is there a more concise/efficient way to select numbers in a range?
>>> 
>>> Skip Cave
>>> Cave Consulting LLC
>>> ----------------------------------------------------------------------
>>> 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