[racket] Dynamically Bind Functions

From: Cristian Esquivias (cristian.esquivias at gmail.com)
Date: Fri Dec 21 21:41:09 EST 2012

I'm trying to replace a function with another using parameterize.

For example, when I try:

(define (add2 n)
  (add1 (add1 n)))

(parameterize ([add1 (λ [n] (+ n 2))])
  (add2 2))

I get an error:

 parameterize: contract violation
  expected: parameter?
  received: #<procedure:add1>

How do I re-bind functions in Racket?

- Cristian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121221/02c529cf/attachment.html>

Posted on the users mailing list.