[racket] Best practices for installing and using R6RS libraries with Racket on Windows
My cheatsheet:
http://www.wisdomandwonder.com/link/2028/how-pltcollects-works-in-plt-scheme
On Thu, Jan 19, 2012 at 4:50 PM, Imran Rafique <imran at rafique.org> wrote:
> Responding to the 2nd part (raco -link)
>
> Both $PLTCOLLECTS & `raco -link` persist across different racket
> installations (ie: they're independent of how and when you compiled &
> installed racket itself), but it seems that collections directories added by
> `raco -link` take precedence over $PLTCOLLECTS.
>
> Eg:
> # contents = /foo/imran/prelude.rkt
> export PLTCOLLECTS="/foo:"
>
> # contents = /foo2/prelude.rkt
> raco -link -n imran /foo2
>
> Then, (require imran/prelude) *NEVER* looks in $PLTCOLLECTS. Even if the
> copy in /foo2/prelude.rkt is a badly formed module, and
> /foo/imran/prelude.rkt is correct.
>
> At least, thats what I discovered last night after installing from git :)
>
> --
> Regards,
> Imran Rafique
>
>
> On 19 January 2012 13:40, Eduardo Cavazos <wayo.cavazos at gmail.com> wrote:
>>
>> Hello,
>>
>> I've been testing out my MPL libraries with Racket 5.2 on Windows 7.
>>
>> I generally use R6RS implementations and libraries. Thus, I tend to keep
>> my library directories in "~/scheme" on Linux or "c:\users\myhomedir\scheme"
>> on Windows. MPL has two dependencies (surfage and dharmalab; mentioned in
>> the README) that should also be present in the library collection.
>>
>> So to "install" MPL for Racket on Windows, I simply modified my
>> PLTCOLLECTS environment variable. At first I simply defined it as:
>>
>> c:\users\dharmatech\scheme
>>
>> However, having only that directory in PLTCOLLECTS caused major problems
>> for DrRacket.
>>
>> My next step was to check the result of:
>>
>> (get-collects-search-dirs)
>>
>> and include those paths in PLTCOLLECTS as well. That seemed to do the
>> trick. So my PLTCOLLECTS variable now looks like:
>>
>> C:\Users\dharmatech\AppData\Roaming\Racket\5.2\collects;C:\Program Files
>> (x86)\R
>> acket\collects;c:\users\dharmatech\scheme
>>
>> I'd like to provide some basic instructions in the README for getting
>> started in a Windows environment with Racket and MPL. Should I suggest that
>> the PLTCOLLECTS variable be modified as I've done above?
>>
>> Section 6.1.3 of the Racket guide recommends using 'raco link' to install
>> collections. Would this somehow be better than the PLTCOLLECTS approach? The
>> drawback to this is that it appears that the user would have to 'raco link'
>> all three library collections (i.e. surfage, dharmalab, mpl).
>>
>> Once installed, MPL appears to function properly. The test suite passes
>> when I run:
>>
>> c:\Program Files (x86)\Racket>plt-r6rs
>> c:\Users\dharmatech\scheme\mpl\test.sps
>>
>> I recently added an '(mpl all)' library which exports commonly used
>> procedures and macros. So to get a REPL up an running, in a DrRacket
>> definitions window add:
>>
>> #!r6rs
>>
>> (import (mpl rnrs-sans)
>> (mpl all))
>>
>> hit "Run" and the MPL procedures/macros should available in the
>> interactions window.
>>
>> I normally write my Scheme code as R6RS libraries, not as Racket modules
>> and I don't have much experience with the latter. It'd be nice if Racket
>> module authors could import MPL libraries into their normal racket modules.
>> Of course, MPL exports procedures that conflict naming-wise with traditional
>> procedures like +, -, *, /, sin, cos, etc. How should I handle this in
>> Racket modules? As a first attempt at mixing Racket and MPL I tried:
>>
>> #lang racket
>>
>> (require (lib "mpl/sum-product-power.sls"))
>>
>> When I multiply 'x' times 'x' I get:
>>
>> > (* 'x 'x)
>> (mcons '^ (mcons 'x (mcons 2 '())))
>>
>> In Petite Chez Scheme I get:
>>
>> > (* 'x 'x)
>> (^ x 2)
>>
>> I guess the 'mcons' stuff is due to the mutable/immutable pairs difference
>> between R6RS and default racket.
>>
>> In R6RS, as shown above, I usually do '(import (mpl rnrs-sans) (mpl
>> all))'. The library '(mpl rnrs-sans)' is equivalent to '(rnrs)' except for
>> procedures which conflict name-wise with MPL procedures. Would you recommend
>> setting up something similar for Racket so that the user can do:
>>
>> #lang racket-sans
>>
>> (require (lib "mpl/all.sls"))
>>
>> Thanks for any hints and tips!
>>
>> The MPL github project page is at:
>>
>> https://github.com/dharmatech/mpl
>>
>> Ed
>> ____________________
>> Racket Users list:
>> http://lists.racket-lang.org/users
>
>
>
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
--
http://www.wisdomandwonder.com/
ACM, AMA, COG, IEEE