[plt-scheme] Require and a path
>Thank you for your kind help.
>
>I did read the document before asking. If I could have figured it out I would not have asked.
>
>Why does:
>
>(require (file (build-path "Dev" "CodeGen" "string-utils.scm")))
>
>Not work then?
>
>since (build-path ... creates a path string -- "Dev\\CodeGen\\string-utils.scm"
In PLT Scheme, there are two build-in datatype: string, and path. Read Section 11.3.1
of the Language Manual for details.
In (file path-string), the "path-string" should be a string instead of a path. For
example,
(require (file "/home/string-utils.scm"))
Or, if you really want to use 'build-path,
(require (file (path->string?(build-path (current-directory) "CodeGen" "string-utils.scm"))))
>
>Alex
>
>> -----Original Message-----
>> From: Zhu Chongkai [mailto:mathematica at citiz.net]
>> Sent: Monday, April 04, 2005 9:45 PM
>> To: Alex Peake
>> Cc: plt-scheme
>> Subject: Re: [plt-scheme] Require and a path
>>
>> >I have expressions like:
>> >
>> >(require "string-utils.scm")
>> >
>> >Is there a way to use a full or relative path here? I have tried
>> >(require (build-path 'up "string-utils.scm")) and (require (file
>> >(build-path 'up "string-utils.scm"))) etc.
>> >but it all fails with "bad module path ..."
>> >
>> >
>> >Thanks,
>> >
>> >Alex
>> >
>>
>> The <PLT MzScheme: Language Manual> tells every thing. Since
>> you asked, I repeat them here. But you should read the
>> document before asking.
>>
>> section 5.2
>> >
>> >(require require-spec ...)
>> >
>> >require-spec is one of
>> > module-name
>> > ...
>> >
>> section 5.4
>> >
>> >module-name is one of
>> >
>> >unix-relative-path-string
>> >(file path-string)
>> >(lib filename-string collection-string ...) (planet . datum) path
>>
>>
>> The (file path-string) is just what you want.
>>
>>
>> Zhu Chongkai
>> http://www.neilvandyke.org/mrmathematica/
>>
Zhu Chongkai
http://www.neilvandyke.org/mrmathematica/