A synthesis just occurred to me. This is unrelated to the "more ambitious"
proposal I mentioned earlier, but still solves the
problem.
I wrote (0):
> perhaps the raze of the result of affixing a fill element
> within each box, as in:
>
> <;._1 :. ([: ; ({.~ -@:>:@:#)&.>)
> <;._2 :. ([: ; ({.~ >:@:#)&.>)
Then elaborated (1):
> Maybe, in line with other uses of !. to specify fill, a
> new fit could be defined, such that:
>
> <;._2!.n ^:_1 <==> [: ; ,&n&.>
But worried (ibid):
> the phrase suggested above might have to be expressed as
> <;._2^:_1!.n [...] If that's the case, I'm less
> enthused about the idea
However, we could extend the proposal thus:
<;._2!.n <==> <;._2@:(,&n) :. ([: ; ,&n&.>)
(similarly for <;._1!.n and equivalences apply to monads only. Perhaps
initially only for vector arguments.)
That is, the fit WOULD apply to the nominal verb: it would specify the fret.
It would also apply to the obverse as laid out in
my previous message.
Advantages:
(A) Concise.
(B) Solves a common problem.
(B.i) No worrying about losing the shard.
(C) Backwards compatible
(D) Centralized, easily optimized. In particular, in
<;._2 y,n the catenation (and attendant copying
of y ) need not be performed.
(E) Could easily provide for other optimizations
which would support a large body of extant and
likey future code. In particular, f&.>&.(<;._2!.n)
could be optimized for well-behaved f (the
initial definitionof "well behaved" might be
"doesn't change the type or shape of its
argument")
For example:
dtb&.>&.(<;._2!.LF) NB. dtb from lines
(though this is "poorly behaved" because it
changes the shape of its argument).
(F) In the spirit of !.
(G) In the spirit of ^:_1
Drawbacks (in addition to those associated with every backwards-compatible
change to the language):
(A) <;._2 sans fit couldn't have an inverse, or,
if it did, it would be inconsistent with the
definition and inverse of fitted cut.
(B) Every !. reduces the consistency of J; they
should be used sparingly, if at all.
-Dan
(0) http://www.jsoftware.com/pipermail/programming/2007-October/008564.html
(1) http://www.jsoftware.com/pipermail/programming/2007-October/008569.html
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm