If (implies a b ... z) is equivalent to (implies a (implies b ... z)), then it is also equivalent to (implies (and a b ...) z). In which case, the 1-ary case should be clear: just return z. In truth, it is not really necessary to have n-ary implies if you're willing to nest the (and ...) explicitly. Given that Scheme/Racket n-ary operators tend to have the "..." last, with occasional exceptions like list* and apply, restricting implies to 2 arguments might avoid cases where (implies a b c d e) is confusing to read. (implies (and a b c d) e) is clearer.<br>
<br clear="all">Carl Eastlund<br>
<br><div class="gmail_quote">On Sun, Feb 19, 2012 at 8:16 PM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Sun, Feb 19, 2012 at 7:10 PM, Neil Toronto <<a href="mailto:neil.toronto@gmail.com">neil.toronto@gmail.com</a>> wrote:<br>
> On 02/19/2012 06:05 AM, Robby Findler wrote:<br>
>><br>
>> On Sun, Feb 19, 2012 at 12:30 AM, Gary Baumgartner<<a href="mailto:gfb@cs.toronto.edu">gfb@cs.toronto.edu</a>><br>
>> wrote:<br>
>>><br>
>>> On a more productive note: in Racket code I define and use 'implies' a<br>
>>> lot,<br>
>>> often conjoined, for predicates. It's mainly of declarative value, which<br>
>>> is<br>
>>> perhaps why it's uncommon in implementation despite how common it is in<br>
>>> specification. And for boolean expressions in general I also use<br>
>>> 'neither'.<br>
>>> Are these something that others [would] use and so could be added to<br>
>>> Racket's<br>
>>> library?<br>
>><br>
>><br>
>> Seems to me adding implies, nand, and nor to racket/bool is a good idea.<br>
>><br>
>> Let me know if you disagree (and if you disagree after I've already<br>
>> committed, it is a simple thing to drop the commit or change it).<br>
><br>
><br>
> I've occasionally written my own `implies', but never make it shortcut like<br>
> `and' and `or'. Speaking of which, would it handle more than two arguments?<br>
> One? Zero? What kind of associativity would be appropriate?<br>
<br>
</div></div>The version I checked in shortcuts in an implication-appropriate way<br>
(if the first argument is #f). I think the convention (due to<br>
functions and currying) is pretty well established that it associates<br>
to the right. So that's what the version I checked in does for the 3+<br>
argument case. I didn't see something reasonable for the 0 or 2-ary<br>
case so it doesn't handle them.<br>
<br>
> Bwahaha.<br>
<br>
:)<br>
<br>
I'm still pondering those questions for xor. :)<br>
<span class="HOEnZb"><font color="#888888"><br>
Robby<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></blockquote></div><br>