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

Reply via email to