[Jprogramming] Insert verb
Ric Sherlock
tikkanz at gmail.com
Wed Jan 20 11:44:23 UTC 2021
{{ }} digraphs were introduced in j902
https://code.jsoftware.com/wiki/System/ReleaseNotes/J902
See
https://code.jsoftware.com/wiki/Vocabulary/DirectDefinition
On Wed, 20 Jan 2021, 22:32 Arnab Chakraborty, <damdemi at gmail.com> wrote:
> I could not find any doc on {{ and }} as Raul has used. Any pointer?
>
> On Tue, 19 Jan 2021, 22:26 Raul Miller, <rauldmiller at gmail.com> wrote:
>
> > insertbefore=:{{
> > 'a b'=. y
> > (x{.b),a,x}.b
> > }}
> >
> > insertafter=: {{ (x+1) insertbefore y }}
> >
> > 2 insertafter "1 [ 10;"1 n
> > 0 1 2 10 3 4
> > 5 6 7 10 8 9
> >
> > FYI,
> >
> > --
> > Raul
> >
> > On Tue, Jan 19, 2021 at 11:51 AM Skip Cave <skip at caveconsulting.com>
> > wrote:
> > >
> > > How does one design a verb that inserts specific elements into a vector
> > or
> > > matrix?
> > >
> > > For example, an "insertafter" verb would take one left argument, which
> is
> > > the index of the array that the element is to be inserted after. The
> > right
> > > argument would be two boxed nouns. The first boxed noun is the set to
> be
> > > inserted. The second boxed noun is the destination of the insertion.
> > >
> > > 2 insertafter 10;1 2 3 4 5
> > >
> > > 1 2 3 10 4 5
> > > 2 insertafter 10 11;1 2 3 4 5
> > > 1 2 3 10 11 4 5
> > >
> > > Also may need insertbefore:
> > > 2 insertbefore 10;1 2 3 4 5
> > >
> > > 1 2 10 3 4 5
> > > 2 insertbefore 10 11;1 2 3 4 5
> > > 1 2 10 11 3 4 5
> > >
> > > Higher ranks?
> > >
> > > ]n=.2 5$i.10
> > >
> > > 0 1 2 3 4
> > >
> > > 5 6 7 8 9
> > >
> > > 2 insertafter "1 [ 10;n
> > >
> > > 0 1 2 10 3 4
> > >
> > > 5 6 7 10 8 9
> > >
> > >
> > > What would the code for insertbefore verb look like?
> > >
> > >
> > > Skip Cave
> > > Cave Consulting LLC
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list