Fluxus in DrScheme

DrScheme is a “integrated development environment” for Scheme, and it comes as part of PLT scheme, so you will have it installed if you are using fluxus.

34_drscheme.pngYou can use it instead of the built in fluxus scratchpad editor for writing scheme scripts. Reasons to want to do this include:

  • The ability to profile and debug scheme code
  • Better editing environment than the fluxus scratchpad editor will ever provide
  • Makes fluxus useful in more ways (with the addition of widgets, multiple views etc)

I use it a lot for writing larger scheme scripts. All you need to do is add the following line to the top of your fluxus script:

(require fluxus-[version]/drflux)

Where [version] is the current version number without the dot, eg “017”.

Load the script into DrScheme and press F5 to run it – a new window should pop up, displaying your graphics as normal. Rerunning the script in DrScheme should update the graphics window automatically.

DrScheme in OS X

If you put the fluxus binary application to /Applications, you need to include the resources folder of the fluxus.app to the collects path, so DrScheme finds the fluxus modules. because they depend on the dynamic libraries and frameworks included in the application, you also need to set the dynamic library path. something like this from terminal:

export PLTCOLLECTS=/Applications/PLT\ Scheme\ v4.2.5/collects/:/Applications/Fluxus.app/Contents/Resources/collects/
export DYLD_LIBRARY_PATH=/Applications/Fluxus.app/Contents/Frameworks/

then load DrScheme:

open /Applications/PLT\ Scheme\ v4.2.5/DrScheme.app/

a simple test script should work now:

#lang scheme
(require fluxus-[version]/drflux)

Where [version] is the current version number without the dot, eg “017”.

Known issues

Some commands are known to crash DrScheme, (show-fps) should not be used. Hardware shading probably won’t work. Also DrScheme requires a lot of memory, which can cause problems.