[racket] require error

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Oct 18 11:28:30 EDT 2011

A few minutes ago, Marco Morazan wrote:
> Here is my experiment:
> 
> green.rkt:
> (module green eopl
>   (provide numfuncts)
>   (provide dummy)
>   (define numfuncts -1)
>   (define dummy 10))
> 
> File1.rkt:
> #lang eopl
> (require racket/vector)
> (require "green.rkt")
> 
> (define numfs numfuncts)
> (define (crazy x) (* dummy x))
> (define (f x) (build-vector 10 (lambda (i) (* i x))))
> 
> Throws the following error: expand: unbound identifier in module in:
> build-vector

`build-vector' is in the core `racket/base'.  To require just it in
the `eopl' language, you need to use the "raw" require forms, because
it's based on mzscheme:

  #lang eopl
  (require (only racket/base build-vector))
  (require "green.rkt")
  ...


> File2.rkt:
> #lang eopl
> (require racket/base)
> (require "green.rkt")
> 
> (define numfs numfuncts)
> (define (crazy x) (* dummy x))
> (define (f x) (build-vector 10 (lambda (i) (* i x))))
> 
> Throws the following error: #%module-begin: bad syntax in:
> (#%module-begin (#%require racket/base) (#%require "green.rkt")
> (define-values (numfs) numfuncts) (define-values (crazy) (lambda (x)
> (#%app * dummy x))) (define-values (f) (lambda (x) (#%app build-vector
> (quote 10) (lambda (i) (#%app * i x))))))

(This is not a good idea because of the above, but in any case I tried
it and still don't see that error.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.