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: Thierry Volpiatto
Subject: Re: Improve `replace-regexp-in-string' ergonomics?
Date: Tue, 12 Oct 2021 20:44:23 +0000

Juri Linkov <juri@linkov.net> writes:

>> 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.

Yes, it does, thought you wanted something easy to read (and write), it
was the initial question isn't it?

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

So I don't understand what you want to achieve.

-- 
Thierry

Attachment: signature.asc
Description: PGP signature


reply via email to

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