Working Directories

The portable REDUCE source code does not support the concept of a working directory (nor does Standard Lisp), but actual Lisp implementations normally do, albeit in slightly different ways. This document outlines the support provided by PSL and CSL from REDUCE algebraic mode. PSL support is described in the PSL Users Manual [ HTML | PDF ]. Other Lisps can be expected to provide broadly similar support. Working directory is abbreviated to WD and the WD to be selected is indicated by dir below.

Initial WD on Microsoft Windows

When invoked from the Windows Start menu, both PSL and CSL REDUCE have their initial WD set to the user's Documents folder. When CSL REDUCE is invoked using the command redcsl the initial WD is also set to the user's Documents folder by default, for consistency, but if redcsl is called with first argument -nocd then the WD is preserved, i.e. the initial WD for REDUCE is the current WD of the shell or other application that invoked it. When PSL REDUCE is invoked using the command redpsl the WD is always preserved, i.e. it is the current WD of the shell or other application that invoked it.

The behaviour on Cygwin is the same as on other Unix-like platforms; see below.

Initial WD on Unix-like Platforms

When invoked from the desktop, both PSL and CSL REDUCE have their initial WD set to the user's home directory, i.e. the value of the environment variable HOME. When invoked using the command redpsl or redcsl the WD is preserved, i.e. it is the current WD of the shell or other application that invoked REDUCE.

Discovering and Changing the WD

What PSL REDUCE CSL REDUCE GUI CSL REDUCE CLI
Get pwd(); returns string Click on Read... or Save... in the File menu. Windows: system "cd"$
Unix-like: system "pwd"$
outputs to terminal
Set cd "dir"; Select using Read... or Save... in the File menu, or
lisp chdir "dir";
lisp chdir "dir";