f=: [ <@,:"1 -@#@[ ]\ ] Louis
> On 17 Jan 2017, at 18:09, Mark Allen <[email protected]> wrote: > > I have the following line of J: > > > _3 (<@:('key'&,:)\) 'arbitrary_string' > > ┌───┬───┬───┬───┬───┬───┐ > > │key│key│key│key│key│key│ > > │arb│itr│ary│_st│rin│g │ > > └───┴───┴───┴───┴───┴───┘ > > > I would like to define it entirely tacitly, i.e. I want a verb *f *such > that > > > 'abc' f\ 'arbitrary_string' > > ┌───┬───┬───┬───┬───┬───┐ > > │key│key│key│key│key│key│ > > │arb│itr│ary│_st│rin│g │ > > └───┴───┴───┴───┴───┴───┘ > > > and similarly. > > > 'key2' f\ 'another_arbitrary_string' > > ┌────┬────┬────┬────┬────┬────┐ > > │key2│key2│key2│key2│key2│key2│ > > │anot│her_│arbi│trar│y_st│ring│ > > └────┴────┴────┴────┴────┴────┘ > > > This can be done easily enough in a piecemeal fashion by first boxing the > infixes of the RHS and then laminating the LHS with each of the infixes, > i.e. > > > 'abc' ([ ,:&.:>"(1 0) (<\~ -@:#)~) 'arbitrary_string' > > ┌───┬───┬───┬───┬───┬───┐ > > │abc│abc│abc│abc│abc│abc│ > > │arb│itr│ary│_st│rin│g │ > > └───┴───┴───┴───┴───┴───┘ > > > however, after the special gerund form of amend: > > > x (v0`v1`v2) } y <--> (x v0 y) (x v1 y) } (x v2 y) > > > I'd expect that there was some equivalent way of writing my verb f above, > e.g. something like > > > 'abc' (-@:#@:[ ` <@:,: ` ])\ 'arbitrary_string' > > > Is there any such way? > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
