[plt-scheme] Re: DrScheme: Reference to undefined identifier: require
Zane:
Your answer was right on, and I was able to figure out the details.
Life seems a bit easier when using module, require and provide. I
picked R5RS when I began, because DrScheme says it's "no frills", and
I'm a no frills kind of guy. Following your recommendation broke a
couple things, but nothing that could not be fixed in 5 minutes.
This is how things ended up:
In ch-2.scm:
(module ch-2 mzscheme
; - A collection of super-clever solutions to problems in my
textbook
(provide $FUNCTION_NAMES))
In ch-2-tests.scm:
(module ch-2-tests mzscheme
(require "ch-2.scm")
(require "dp-test-framework.scm")
; - The test suite for my impressive solutions.
)
In dp-test-framework.scm:
(module dp-test-framework mzscheme
;a pretty cute way to run tests and aggregate the results
(provide $A_COUPLE_FUNCTIONS))
Based on what you see above, do I understand module, require and
provide? Is this a good way to work with Scheme? Do you have any
pointers for a newbie? I look forward to hearing your response.
Thanks for your help so far.
Sincerely,
Daniel
On Aug 3, 7:58 pm, Zane Shelby <zaneshe... at gmail.com> wrote:
> Hey Daniel!
>
> The problem is 'require' isn't part of the R5RS language, so when you
> try to use it in that language you're going to get an error. You could
> use load, but that has slightly different behavior.
>
> Is there particular reason why you'd like to use r5rs? If not, I'd
> recommend you use PLT Scheme by selecting 'module' from the pulldown
> and putting '#lang scheme' at the top of your file.
>
> Hope that helps,
> Zane
>
>
>
> On Mon, Aug 3, 2009 at 12:09 PM, Daniel<phelps... at gmail.com> wrote:
> > Hello Everybody:
> > I am new to Scheme, so please be patient with me. I have 2 files:
> > ch2.scm and schemeTests.scm. I would like to include schemeTests.scm
> > in the ch2.scm file.
>
> > According to the documentation, the include procedure "inlines the
> > syntax in the file designated by path-spec in place of the include
> > expression." http://docs.plt-scheme.org/reference/include.html This
> > behavior is what I need. However, I am having some trouble.
> > Hopefully, this short interactive session can tell you something.
>
> > Welcome to DrScheme, version 4.2.1 [3m].
> > Language: R5RS; memory limit: 128 megabytes.
> >> (require scheme/include)
> > . . reference to undefined identifier: require
> >> (include "schemeTests.scm")
> > . . reference to undefined identifier: include
> >> #lang scheme
> > . . reference to undefined identifier: module
>
> > If I place a call to (require scheme/include) in my source file, I
> > receive the same error. However, if I change the language from R5RS
> > to advanced student custom, I get no complaints about 'require', but
> > it breaks some of my previously existing code. What am I doing
> > wrong? Your help and consideration is appreciated.
>
> > Sincerely,
> > Daniel
> > _________________________________________________
> > For list-related administrative tasks:
> > http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme