Recent correspondence alerted me to the existence of an
existing standard J function that I ought to use in place of a
version I wrote.  However, on reflection, I thought of a case
where the two are not equivalent:

  ('AA';'B') stringreplace 'AAA'
BA
  ('AA';'B') replace 'AAA'
BB

The latter simultaneously replaces both instances of "AA"
(the instance starting at position 0 and the one at position 1)
with "B"; the former is apparently replacing serially so doesn't
see the second, overlapping occurrence of "AA".

Does anyone have a thought to which behavior is "correct"
or at least better?

--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to