Racket博士和R5RS计划:当前目录不起作用

问题描述

我试图在Dr.Racket中使用R5RS。我想知道我正在使用的目录,并想更改目录。当我尝试使用R5S5时,出现以下错误

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

但是,在Racket中运行相同的东西,我正在获取目录。

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

我无法在 R5RS 中找到current-directory的对应原语。

解决方法

您可以要求球拍提供一些东西

#lang r5rs

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