Dr. Racket and R5RS Scheme: (current-directory) is not working

Viewed 177

I am trying to use R5RS, in Dr.Racket. I want to know the directory in which I am working and would like to change the directory. When I try in R5S5, I get the following error:

Welcome to DrRacket, version 6.12 [3m].
Language: R5RS; memory limit: 128 MB.
> (current-directory)
. . current-directory: undefined;
 cannot reference undefined identifier
> 

However, running the same thing in Racket, I am getting the directory.

Welcome to DrRacket, version 6.12 [3m].
Language: racket, with debugging; memory limit: 128 MB.
> (current-directory)
#<path:/home/shree/>
> 

I am not able to find what is the corresponding primitive for current-directory in R5RS.

1 Answers

You can require stuff from Racket:

#lang r5rs

(#%require (only racket/base current-directory))
(display (current-directory))
Related