<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Good points... and I am now about two-thirds the way of refactoring all such code to use that style, I have only found a single case so far where the predicate is trivially small and thus deemed exempt, this one:<div class=""><br class=""></div><div class=""><div class=""><font face="Courier" style="font-size: 14px;" class="">  % Convert list of ps() strings to plain strings.</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">    %</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">to_strings(In) = Out :-</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">    list.map((pred(ps(_, S)::in, S::out) is det), In, Out).</font></div></div><div class=""><br class=""></div><div class="">where</div><div class=""><div class=""><br class=""></div><div class=""><font face="Courier" style="font-size: 14px;" class="">    % A positioned string.</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">    % The position is the lexxer offset of the string in the source buffer.</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">    %</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">:- type ps</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">    --->    ps(</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">                psloc::location,</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">                psbody::string</font></div><div class=""><font face="Courier" style="font-size: 14px;" class="">            ).</font></div></div><div class=""><br class=""></div><div class="">Thanks, and as I was performing the clean up, I did notice the decrease of the indent level, given my recent question about that I could but not smile to myself with a small amount of chagrin.</div><div class="">Sean.</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 5 Mar 2022, at 20:18, Zoltan Somogyi <<a href="mailto:zoltan.somogyi@runbox.com" class="">zoltan.somogyi@runbox.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">2022-03-06 00:10 GMT+11:00 "Sean Charles (emacstheviking)" <</span><a href="mailto:objitsu@gmail.com" style="font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">objitsu@gmail.com</a><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">>:</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Hi,<br class=""><br class="">Having recently seen the `errors.m` contribution to the Mercury extras folder, and more reading if compiler and mmc-doc source code, I often see this style:<br class=""><br class="">P = (pred (...) .......<br class="">     ),<br class="">     list.take_while(P, ....<br class="">or   list.foldl(P, ...<br class=""><br class="">and I wondered is it a style matter or is the compiler able to do more if I define the predicate first ? I ask as my code for my transpiler rarely does this, mainly because of my past experience with other languages where you just throw the code inline:<br class=""><br class="">   list.take(<br class=""><span class="Apple-tab-span" style="white-space: pre;">    </span>(pred(...)<br class="">       ),<br class=""><span class="Apple-tab-span" style="white-space: pre;">  </span>..args..<br class="">   )<br class=""><br class="">is there a preferred style and if so, what was the basis for that decision ?<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">I tend to use the first style for three reasons.</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">- It gives a name to the lambda, and this name is useful documentation</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""> to readers of the code. This is by a significant margin the most important</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""> reason.</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">- It clearly separates the code of the lambda from the other arguments</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""> of the call.</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">- It reduces the indentation level of the code of the lambda by one.</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">If the code of the lambda is really short and obvious, such as</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">"func(X) = yes(X)", then none of these reasons apply, and in such cases,</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">I would probably use the second style.</span><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: CourierNewPSMT; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Zoltan.</span></div></blockquote></div><br class=""></div></body></html>