On Tue, Mar 16, 2010 at 2:22 PM, Dan Bron <[email protected]> wrote:
> Thanks Raul, I need to study your /\ solution more when I get home.
That was not actually a solution but a hint at how
a solution might be generated.
If I actually wanted a solution I might have said something
like:
replace=: +/\1 2 4 12 1 0#0.02*i.-6
bound=: 0.06+0.05*i.#replace
rescale=: replace {~ bound I. ]
> My question wasn't really how to solve the RC task, but how
> to solve a family of related tasks using I. . In those cases
> handling y < {. x (for x ascending, and analogously for descending)
> is an explicit requirement. Also being able to determine which interval
> (left or right) values of x are considered to fall into is an explicit
> requirement.
If I understand your terminology properly, y is always on x
or left of x. The exceptional case is analogous to i. (except
that with I. you know that, for the exceptional case, y had to
be larger than the largest value in x).
That said, you might be reaching towards "guard values" --
values explicitly introduced to deal with important edge
conditions.
> Is I. inherently biased towards either the left or the right (for y which
> are either members of x or out-of-bounds), or is that just
> the matter of selecting the appropriate grade for x (or, less
> desirably, appropriate reversals for arguments)?
I am not sure I understand your question, but selecting
appropriate values for x and y seems like a good idea.
That said, I. is "biased towards the left side of x"
because values in x match things which "fit on
their left", and I. is "biased towards the right side
of x" because non-matches (values which are too
large) get indices to the right of that value in x.
But I feel that this kind of thinking belongs in the
application domain and not in the domain of the
interpreter.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm