Function Table

last modified: June 20, 2007

A Function Table Is an AssociativeArray that has a key of type symbol and a value of type function. in scheme you can do this

(define (foo x y)
        ((assq x <foo>) y))
(define <foo> (list (cons 'foo (lambda (x) (+ x x)))
                        (cons 'bar (lambda (y) (* y y)))))

Function tables can be used like Extensible Case Statements where the key is the case and the function is the code.


Loading...