bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-apl] Not a bug, need help coding search&replace on a vector


From: Fred Weigel
Subject: [Bug-apl] Not a bug, need help coding search&replace on a vector
Date: Tue, 21 Jun 2016 15:01:45 -0400

An alternative (from hans-peter sorge from this list, april 13, 2016).
Careful though, this does have some edge conditions which will bite:
 ⍝replace <old> with <new> (<o> is 2 elements) in string <s>
 ⍝.k text-editing
 ⍝.n hans-peter sorge
 ⍝.t 2016.4.13.0.0.0
 ⍝.v 1.0 / 13apr16
 r←((0=⍴z)/a),z←∊((e×⍴v)↑¨⊂v),¨((⍴u)×e←+/¨(1+p)⊂p)↓¨(1++\p←u⍷a)⊂a←s⊣(u
v)←o
∇






reply via email to

[Prev in Thread] Current Thread [Next in Thread]