Consider all code on the webpage as GPL'd. See here
Lisp
supacond: This is in the spirit of lisp's built-in
cond macro, but the supacond macro expands into the creation
of a scond object. The main data structure of the scond is
a list of sc objects, where an sc is a pair of closures (one
for the predicate and one for the consequent expressions).
Each sc also has a count associated with it. Every time
a given sc's predicate returns a non-nil value, not only is
it's consequent set of expressions executed, but it's count
is incremented as well. After a specified number of
iterations, the list of scs is sorted based on these counts
such that those predicates that returned true more often
will be tested first. A short paper regarding these objects
and their implications can be
found here. NOTE: I wrote this
draft before I realised what supacond really was, before I
knew how it ought to be classified. Recently, I was leafing
through "Machine Learning" by Tom M. Mitchell. The first
sentence reads, "The field of machine learning is concerned
with the question of how to construct computer programs that
automatically improve with experience". It appears that
supacond falls under this category.
Here's the code
You might use it in the following way:
;; initialize
(setf my-scond (supacond ((> foo baz)
(do-something))
((< raz mataz)
(do-something-else))
.
.
.))
;; later you could execute it as such
(scond-eval my-scond)