[racket] redefining primitives?

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Tue Jan 18 11:04:32 EST 2011

(composed in my mail buffer, so it might not compile)

#lang racket/load

(module student racket
  (require lang/htdp-intermediate)
  (define (my+ x y) (+ x y))
  (provide (rename-out [my+ +])
              (except-out (all-from-out lang/htdp-intermediate) + list)))

(module test 'student
  ;; both of these will error
  (+ 1 2 4)
  list)

For more information, see:
  http://docs.racket-lang.org/guide/languages.html

On Tue, Jan 18, 2011 at 10:57 AM, Todd O'Bryan <toddobryan at gmail.com> wrote:
> Is it possible to redefine primitives, like +, and then provide them
> to another module?
>
> If so, can you also undefine primitives? Like if I wanted to make a
> student language where + only accepted two arguments and the list
> function was unavailable, how could I do that?
>
> Todd
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.