On Mon, Apr 27, 2009 at 2:13 PM, Brian Schott <[email protected]> wrote:
> I did notice one other feature that trap has, but not trap17: the four
> numbers may not be whole numbers. But that is a requirement I did not
> mention at first. I am sorry. In most cases integers will be fine.

Here's another approach:

trap=: (1 :0)
   'a b c d'=. m
   s=. % _1 1 * _2 -/\ m
   z=. - 0 3 { m
   [: <./ 1 <. 0 >. s * z +/ ]
)

   2 6 8 10 trap i. 11
0 0 0 0.25 0.5 0.75 1 1 1 0.5 0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to