Juri Linkov writes: >>> What does the following return? >>> >>> (let ((bar "bar")) >>> (helm-aand bar >>> (replace-regexp-in-string "b" "f" it) >>> (replace-regexp-in-string "f" "o" it))) >>> >>> If it returns "oar" then it applies replacements sequentially, >>> and we have no problem with such implementations. >> >> Yes, it does, thought you wanted something easy to read (and write), it >> was the initial question isn't it? > > General-purpose threading like you proposed is a nice feature. > But is supports only sequential replacements. > >>> But we need an alternative version that performs simultaneous >>> replacements and returns "far". >> >> So I don't understand what you want to achieve. > > Most of replacements are intended to be simultaneous. > But in practice most of simultaneous replacements > could be performed using sequential replacement > because often the result of every replacement step > doesn't contain matches for the next replacement step. > > But sometimes simultaneous replacement is required. > For example, > > (let ((bar "<&")) > (helm-aand bar > (replace-regexp-in-string "<" "<" it) > (replace-regexp-in-string "&" "&" it))) > > will do the wrong thing (and will return "&lt;&" instead of the > intended "<&") because these replacements should be performed > simultaneously. I see what you mean now, thanks for explanations. -- Thierry