Hi,
With the svn version 719,
8 ¯8⋆÷3
2 0.0
but with the release version 1.5,
8 ¯8⋆÷3
2 1J1.732050808
Best,
Xiao-Yong
An other way to do that, written some time ago:
⎕cr 'Replace'
z←Line Replace patterns;f;t;P;pos
⍝
⍝ Check what is effectively `Line`
⍝
→((≡Line)≥2)/Enclosed ⍝ Line is an Enclose of things
→(2=⍴⍴Line)/Matrix⍝ Line is a Matrix
⍝
⍝ Do the job, single vector source,
replace←{(⍴v)↓∊(⊂v),¨(↑⍴u)↓¨(+\u⍷a)⊂a←u,⍺⊣(u v)←⍵}
Jay.
On 12 April 2016 at 11:39, Elias Mårtenson wrote:
> I had a need to to replace substrings with a replacement, and I'm having a
> hard time coming up with an concise solution. What I need to do is this:
>
> 'foobartestfootest' replace
I had a need to to replace substrings with a replacement, and I'm having a
hard time coming up with an concise solution. What I need to do is this:
'foobartestfootest' replace 'foo' 'xy'
Should yield:
'xybartestxytest'
Any suggestions?
Regards,
Elias