emacs-devel
[Top][All Lists]
Advanced

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

Re: Improve `replace-regexp-in-string' ergonomics?


From: Juri Linkov
Subject: Re: Improve `replace-regexp-in-string' ergonomics?
Date: Tue, 12 Oct 2021 22:16:31 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> What about providing a simple anaphoric `and`?
>
>     (let ((bar "bar"))
>       (helm-aand bar
>                  (replace-regexp-in-string "b" "f" it)
>                  (replace-regexp-in-string "a" "o" it)
>                  (replace-regexp-in-string "r" "o" it)))
>     =>"foo"

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.

But we need an alternative version that performs simultaneous
replacements and returns "far".



reply via email to

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