<html><head></head><body><div>Understood. Thanks for the explanation.</div><div><br></div><div>Volker</div><div><br></div><div>Am Freitag, dem 24.02.2023 um 11:41 +1300 schrieb Richard O'Keefe:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Mercury's treatment of variables beginning with underscore</div><div class="gmail_default" style="font-family:monospace,monospace">follows Prolog closely.</div><div class="gmail_default" style="font-family:monospace,monospace">"_" all by itself is a "wild card" with each occurrence</div><div class="gmail_default" style="font-family:monospace,monospace">standing for a different variable.</div><div class="gmail_default" style="font-family:monospace,monospace">A variable that does not begin with underscore is expected</div><div class="gmail_default" style="font-family:monospace,monospace">to occur at least twice and a 'singleton variable' warning</div><div class="gmail_default" style="font-family:monospace,monospace">will be issued if this is not so.</div><div class="gmail_default" style="font-family:monospace,monospace">A variable (other than the wild card) that begins with an</div><div class="gmail_default" style="font-family:monospace,monospace">underscore is expected to occur exactly once and a warning</div><div class="gmail_default" style="font-family:monospace,monospace">will be issued if such a variable is repeated.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Historically it was important to be able to begin</div><div class="gmail_default" style="font-family:monospace,monospace">a variable with an underscore to mark it as a variable</div><div class="gmail_default" style="font-family:monospace,monospace">if you were using a terminal with a single case of</div><div class="gmail_default" style="font-family:monospace,monospace">letters.  Code like</div><div class="gmail_default" style="font-family:monospace,monospace">+append(_X, [_X,.._]).</div><div class="gmail_default" style="font-family:monospace,monospace">+append(_X, [_,.._L])-append(_X, _L).</div><div class="gmail_default" style="font-family:monospace,monospace">was not unusual.  To this day, if you are writing in a</div><div class="gmail_default" style="font-family:monospace,monospace">script that does not make a case distinction (such as</div><div class="gmail_default" style="font-family:monospace,monospace">Chinese or Japanese) you need to be able to prefix a</div><div class="gmail_default" style="font-family:monospace,monospace">word in your language with an underscore to make it a</div><div class="gmail_default" style="font-family:monospace,monospace">variable WITHOUT turning it into a wildcard.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace"></div></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 24 Feb 2023 at 07:19, Volker Wysk <<a href="mailto:post@volker-wysk.de">post@volker-wysk.de</a>> wrote:<br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>Am Freitag, dem 24.02.2023 um 02:15 +1100 schrieb Zoltan Somogyi:<br>> A variable token consisting of single underscore is treated specially:<br>> each instance of @samp{_} denotes a distinct variable.<br>> <br>> It does NOT say that *every* variable that starts with an underscore denotes<br>> a distinct variable. <br></div><div><br>Hmm... I thought it does. Maybe it's like that in Prolog.<br></div><div><br>Cheers,<br>Volker<br>_______________________________________________<br>users mailing list<br></div><div><a href="mailto:users@lists.mercurylang.org" target="_blank">users@lists.mercurylang.org</a><br></div><div><a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a><br></div></blockquote></div></blockquote><div><br></div><div><span></span></div></body></html>