Icon Examples
- iconsample.icn
is a list of some short examples of code all in one file.
- queen.icn
is the n-queens problem done using reverable assignment
- queenG.icn
is the above n-queens problem done as a recursive generator. Note the transformations
necessary. In particular note that a suspend is used for all returns.
That means when the generator is suspended while looking at column n
it then returns to a suspend for the calling routine that is at column n-1
which then returns to a suspend for the calling routine that is at column n-2
... Without a suspend for all returns the suspend deep in the recursion will
not suspend to the initial call of the recursive generator.
- queenG2.icn
This is the same as the recursive generator but now there is not every in the
generator. The suspend is driven only by the initial call in an every which
asks all the routines below to suspend. This is like the stars example in
class. At this point the entire search for the solution to the n-queens
problem has been reduced to a recursively invoked suspend statement.