(defun refinable(f) " ;; Examples: (refinable (lambda(x) (sin (/ x 2pi)))) (xgobips_simple \"p1.ps\" (rseq -3 3 1000) (refinable (lambda(x) (if (> x .25) 1 0)))) (xgobips_simple \"p2.ps\" (rseq -3 3 1000) (refinable (lambda(x) (if (> x .5) 1 0)))) (xgobips_simple \"p3.ps\" (rseq -3 3 1000) (refinable (lambda(x) (if (> x .75) 1 0)))) (xgobips_simple \"p4.ps\" (rseq -pi pi 1000) (refinable (lambda(x) (sin (* x 2pi))))) (xgobips_simple \"p5.ps\" (rseq -pi pi 1000) (refinable (lambda(x) (sin (* x 4pi))))) (xgobips_simple \"p6.ps\" (rseq -pi pi 1000) (refinable (lambda(x) (- 1 (cos (* x 4pi)))))) (xgobips_simple \"p7.ps\" (rseq -3 4 1000) (refinable (lambda(x) (+ 1 (* 4 (- 1 x) x))))) " (let* ( ) (lambda(x) (cond ((and (>= x 0) (< x 1)) (funcall f x) ) ((>= x 1) (- (funcall f (/ x 2)) (funcall f (- x 1))) ) ((< x 0) (- (funcall f (/ (+ x 1) 2)) (funcall f (+ x 1))) ) (t (error "You should not see this: refinable.lsp")) ) ) ) ) (try-out refinable)