I often find myself joining strings with x/y

The most recent example was:
('http://real-chart.finance.yahoo.com/table.csv?s=' ,
]@,&'&a=10&b=2&c=1993&d=00&e=6&f=2016&g=d&ignore=.csv') 'TICKER'

I think it would be handy to have a simple verb that can take a box of
strings / indices and merge it with a box of inputs

Something like:

('hello ';0;0;0) applyTemplate ('a';'b')

Would result in

hello aaa

('hello ';0;' hello';1) applyTemplate ('a';'b')

would be:

hello a hello b

I struggled with this for about 25 minutes to make it tacit and gave
up. Any takers?

(I thought about using printf but figured it was too heavy)


applyTemplate =: 4 : 0
str=.''
for_p. x do.
str=.str,(( y {::~ ]) :: ] ) (>p)
end.
)

('hello ';0;' hello ';1) applyTemplate ('a';'b')
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to