I invoke the ko rule...<p>Situational Cycle: a move sequence that starts and ends at the same position such that at the end of that cycle it is the same player's turn as it was at the start. If cycles are allowed without restrictions on them, it is possible for a game to go on indefinitely. [1]<p>The 'ko' situation is the most common cycle that occurs in the game of go.<p>Ko: a situation where two alternating single stone captures would repeat the original board position. The alternating captures could repeat indefinitely, preventing the game from ending. The ko rule resolves the situation. [2]<p>----<p>[1]: <a href="http://senseis.xmp.net/?Cycle" rel="nofollow">http://senseis.xmp.net/?Cycle</a><p>[2]: <a href="http://senseis.xmp.net/?Ko" rel="nofollow">http://senseis.xmp.net/?Ko</a>
A closure is also a poor man's class (sort of).<p>I've often wished that C# let me implement interfaces with anonymous classes. Since it doesn't, I get around it by creating AdHoc classes for interfaces that I use a lot.<p>For instance, if I have an interface Foo defined as:<p><pre><code> interface Foo
{
string Bar(int x);
}
</code></pre>
then I also create a corresponding class called AdHocFoo defined like so:<p><pre><code> class AdHocFoo : Foo
{
Func<int, string> _bar;
public AdHocFoo(Func<int, string> bar)
{
_bar = bar;
}
public string Bar(int x)
{
return _bar(x);
}
}
</code></pre>
I've written a little program that creates these AdHoc class definitions from interfaces.
"so closures can be, and are, used to implement very effective objects with multiple methods"<p>I don't really believe this to be efficient. The linked text by Kiselyov implements the dispatch via Scheme's (case ...) expression. Efficient dynamic dispatch means one indirection through a vtable, so one load instruction more compared to a normal function call. Which compilers for functional languages can perform this optimization?<p>Since we are talking about Scheme here, we could compare the dispatch to dynamic languages like Python or Ruby, where the dispatch means looking up a string in a hashmap. I'm willing to believe that Scheme's case can keep up with that.
I wish that _why didn't leave potion behind. One of the coolest thing about potion is that everything is a function. For example, if you have an integer named a that has a value of one, the a() will return 1. I hadn't seen that in any other language. Are there other languages with this feature?