<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 18 Aug 2011, at 17:50, David Matthews wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On 18/08/2011 17:02, Alex Merry wrote:<br><blockquote type="cite">On 18/08/11 16:08, Ramana Kumar wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">what about evaluating f?<br></blockquote></blockquote><blockquote type="cite">So the order of evaluation of (f x y) is<br></blockquote><blockquote type="cite">f<br></blockquote><blockquote type="cite">x<br></blockquote><blockquote type="cite">(f x)<br></blockquote><blockquote type="cite">y<br></blockquote><blockquote type="cite">((f x) y)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">This seems like a natural evaluation order for an eager functional<br></blockquote><blockquote type="cite">language.<br></blockquote><br>I have always understood that the Definition of Standard ML (rule 100) requires this order. The syntax of an application is<br>exp ::= atexp<br> exp atexp<br> ...<br>and the semantics first evaluates the exp to b, then the atexp to v and then applies b to v.<br></div></blockquote></div><br><div>I think it's rule 101 not 100 (which is the rule for assignment). But read in conjunction with the state and exception conventions that are given before the rules, you are definitely right about this. I think I would be horrified if the call of cond below raised Div rather than CondFailed:</div><div><br></div><div>exception CondFailed;</div><div>val (cond: ('a -> bool) -> 'a -> ('a -> 'b) -> 'b) = fn test => fn v => (</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if<span class="Apple-tab-span" style="white-space:pre">        </span>test v</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>then<span class="Apple-tab-span" style="white-space:pre">        </span>fn f => f v</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>else<span class="Apple-tab-span" style="white-space:pre">        </span>raise CondFailed</div><div>);</div><div>cond (fn v => v <> 0) 0 (raise Div);</div><div><br></div><div>Regards,</div><div><br></div><div>Rob.</div><div><br></div></body></html>