Examples


> (load "/projects/cs394p/mix.lsp")
> (mix 'x '((x . 4)))
4
> (mix '(if (>  x 2) 'more 'less) '((x . 4)))
'MORE

(defun power (x n)
  (if (= n 0)
      1
      (if (evenp n)
          (square (power x (/ n 2)))
          (* x (power x (- n 1)))) ) )

> (fnmix 'power '(x 3))
(* X (SQUARE X))

> (specialize 'power '(x 3) 'cube)
> (fndef 'cube)
(LAMBDA (X) (* X (SQUARE X)))
>  (cube 4)
64

> (fnmix 'power '(x 22))
(SQUARE (* X (SQUARE (* X (SQUARE (SQUARE X))))))

Contents    Page-10    Prev    Next    Page+10    Index