On Sun, Dec 26, 2010 at 8:51 PM, PackRat <pack...@anet.com> wrote:
> I'm just learning about the .e primitive, and I was wondering how I do
> a match when a close (but not exact) match is involved.  In other
> words, how do I do the equivalent of this:
>
>   ( a +/- b )  .e  y

I think you mean e. instead of .e

> where the value of b might be, say, 5 or 8 or 12 or whatever (not some
> near-zero tolerance factor).

If we assume that b is a single positive number and that a and y are rank 1:

   ~:/((/:~y) (-,:+)b) I."1 a

That said, note that this is testing for values contained in the interval
[y-b,y+b) and if you want [y-b,y+b] you could use:
   (a.e.y-b)+.~:/((/:~y) (-,:+)b) I."1 a

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to