procedure replace(s1, s2, s3) #: string replacement local result, i result := "" i := *s2 if i = 0 then fail # would loop on empty string s1 ? { while result ||:= tab(find(s2)) do { result ||:= s3 move(i) } return result || tab(0) } end