[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-apl] Substring replacement in APL
From: |
Jay Foad |
Subject: |
Re: [Bug-apl] Substring replacement in APL |
Date: |
Tue, 12 Apr 2016 12:18:12 +0100 |
replace←{(⍴v)↓∊(⊂v),¨(↑⍴u)↓¨(+\u⍷a)⊂a←u,⍺⊣(u v)←⍵}
Jay.
On 12 April 2016 at 11:39, Elias Mårtenson <address@hidden> 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 'foo' 'xy'
>
> Should yield:
>
> 'xybartestxytest'
>
> Any suggestions?
>
> Regards,
> Elias