Raul Miller already made the key point, to wit:
> is rank zero. In other words, it does not do the filling.
Instead, the fill happens after > has completed its work.
That is, the mechanism that does the filling is not
the monad > . This mechanism is responsible
for the fill in disparate verbs and does not come
under the purview of !. .
i."0 ] 3 4 4 5
_3 _5 _4 {."_1 'abc'
> 2 3; 4 5 6 7
----- Original Message -----
From: "Mark D. Niemiec" <[email protected]>
Date: Wednesday, May 20, 2009 19:19
Subject: Re: [Jprogramming] >!.
To: [email protected]
> Viktor Cerovski <[email protected]> wrote:
> > It just occurred to me that > should probably allow
> specification of the
> > fill via !.
> > in the similar manner as , does.
>
> The dyad > already accepts a fit for comparison tolerance.
> There are several verbs in which the monad and dyad accept the
> same kinds of
> fit values (for example, #: and {.). There are none in which the
> monad and
> dyad accept different types of values (such as fill and
> comparison tolerance),
> and it may be inconvenient for the interpreter to do so.
>
> There is nothing in the dictionary that would forbid this from
> being allowed in
> the future, although !. would need to be changed to yielding
> verbs with empty
> domains, rather than immediately reporting a domain error, much
> as ^: does now
> (again, something that the dictionary is silent about).
>
> For example:
> >!.0 NB. Ambivalent: fill-with-0 or exactly-
> less-than
> >!.42 NB. Monad-only: fill-with-42
>
> However, it is possible to accomplish what you want without such
> a mechanism:
>
> openfit =: 1 : '$$>@:(,!.m&.>/)@:(,:&.>)@:,'
> > ;:'a mixed list'
> a
> mixed
> list
> '*' openfit ;:'a mixed list'
> a****
> mixed
> list*
>
> Or, if you prefer a dyadic verb (which is more amenable to
> tacit, rank, etc.):
> openfit =: 4 : '($$>@:(,!.x&.>/)@:(,:&.>)@:,)y'
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm