Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • $\begingroup$ The last bit, forcing evaluation on the rhs of a rule, is interesting. There isn't much wiggle room, if any. The condition must be inside the block expression, not outside, so the documentation of Condition is little help understanding the trick. It must be RuleDelayed and not Rule, which is a bit easier to understand; you want the trick evaluated after substitution, not before. So it looks like you're getting a RuleDelayed that's going to eval a Condition; the Block incidentally forces one more round of evaluation before the test of the Condition -- something along these lines. $\endgroup$ Commented Aug 8, 2012 at 13:02
  • $\begingroup$ @Reb.Cabin Trace will reveal the "implementation coincidence" that these expressions invoke RuleCondition in a manner useful to this context. See also the brief discussion here. $\endgroup$ Commented Aug 8, 2012 at 13:36
  • $\begingroup$ Are the brackets on f necessary? You could do the same with y:=x. $\endgroup$ Commented Apr 20, 2015 at 11:55
  • 3
    $\begingroup$ @episanty The brackets are not strictly necessary but, following common convention, their presence gives the reader a clue that f is a potentially non-determinstic computation rather than a simple value. $\endgroup$ Commented Apr 20, 2015 at 14:27
  • $\begingroup$ It seems that InheritedBlock has been made a resource function with some added error messages since 2019 (after this answer was made). The possible issues section might also be interested to look at. The function is here $\endgroup$ Commented Nov 4, 2022 at 20:39