If you look at the definition of stringreplace, the first line is
   txt=. ,y

So it's working with ,r

Another way to work around this problem would be to use stringreplace"1

(Though, personally, I prefer rplc over stringreplace, because that
leaves more room for other stuff on my lines. Also, need to make sure
that the before and after args for the replace are the same length.)

   r=: _7 ]\ 0 >. i.&.(+&5) 32
   (":r) rplc"1 ' 0';'  '
                   1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

(Need a monospaced font, here...)

Oh, and the documentation for 8!:2 is linked from Appendix A of J's
dictionary: http://www.jsoftware.com/help/dictionary/xmain.htm

Thanks,

-- 
Raul



On Thu, Sep 28, 2017 at 7:42 AM, Rudolf Sykora <[email protected]> wrote:
> On 27 September 2017 at 19:13, 'Mike Day' via Programming
> <[email protected]> wrote:
>>    ($$rplc & (' 0';'  ')) @: ": a
>
> Yes. (I guess the @: is unnecessary here, right?)
>
> I actually had tried something similar first:
>
> (' 0';' ') stringreplace ":r
>
> which, however, yielded
>
> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 
> 31
>
> I didn't (and still don't) understand why I got a single line, and
> decided to ask for help then...
> I see (if I understand) you put the shape back in with $$...
> so in my case it would be
> ($$ (' 0';' ')& stringreplace) ":r
>
> Thanks
> Ruda
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to