<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><font class="Apple-style-span" face="Consolas"><br>On 30 Sep 2010, at 17:57, Jack Repenning wrote:<br><br></font><blockquote type="cite"><font class="Apple-style-span" face="Consolas">While reading through the docs (OK, while waiting for my car-pool to arrive ;-), I stumbled upon the function map-query-replace-regexp, which is just like query-replace-regexp except that it takes a list of replacement values, and rotates among them. That's all straightforward and comprehensible and everything, except I can't for the life of me imagine *why* one would actually want to do this. And it doesn't seem to be used anywhere in the standard lisp libraries.<br><br>So, just curious: can anyone suggest a use for this curiously specific function?</font></blockquote><font class="Apple-style-span" face="Consolas"><br></font><div><font class="Apple-style-span" face="Consolas">This goes back to a typical lisp programming pattern, familiar to the older among us who did a lot of lisp programming in their youth :-)</font></div><div><font class="Apple-style-span" face="Consolas">Basically, lisp was used a lot to build functionalities on the fly, something like "a program which has an output another program which is then executed". A "mapping" of a function f onto a set of arguments A is a typical meta-construct in this paradigm: it concatenates (depending on the output type) the results of applying f to each a<span class="Apple-style-span" style="font-size: 9px; ">i</span>∈A: something like map(f,A) = concat(f(a<font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px;">1</span></font>), ..., f(a<font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px;">n</span></font>)). Sometimes, f has a side effect, or f has only a side effect (namely the output is empty); this is the case of </font><span class="Apple-style-span" style="font-family: Consolas; ">map-query-replace-regexp (in emacs see also, e.g., map-y-or-n-p).</span></div><div><span class="Apple-style-span" style="font-family: Consolas; ">cheers</span></div><div><span class="Apple-style-span" style="font-family: Consolas; ">--e.</span></div><div><font class="Apple-style-span" face="Consolas"><br></font></div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Tahoma; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Tahoma; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="font-size: 12px; ">Enrico Franconi                  - <a href="mailto:franconi@inf.unibz.it">franconi@inf.unibz.it</a></div><div style="font-size: 12px; ">Free University of Bozen-Bolzano - <a href="http://www.inf.unibz.it/~franconi/">http://www.inf.unibz.it/~franconi/</a></div><div style="font-size: 12px; ">Faculty of Computer Science      - Phone: (+39) 0471-016-120</div><div style="font-size: 12px; ">I-39100 Bozen-Bolzano BZ, Italy  - Fax:   (+39) 0471-016-009</div></div></span></div></span></div></span></span>
</div>
<br><div><br></div></body></html>