Skip to content

Instantly share code, notes, and snippets.

@ndpar
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndpar/4d43820195e8410e7f6d to your computer and use it in GitHub Desktop.
Save ndpar/4d43820195e8410e7f6d to your computer and use it in GitHub Desktop.
How to redefine procedure in Racket.
(define-syntax-rule
(redefine (f args ...) body ...)
(set! f (λ (args ...) body ...)))
(define (double x)
(+ x x))
(redefine (double x)
(* 2 x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment