使用相对路径加载文件
Load file with relative path
用chezscheme加载当前目录下的文件all-codes
(load "ch4-mceval.scm")
但是,如果将目录更改为父目录并尝试:
(load "all-codes/ch4-mceval.scm")
加载异常:all-codes/ch4-mceval.scm 失败:没有这样的文件或目录:
我的目录显示为
$ tree -L 2
.
├── 00.elisp-SICP.org
├── 00.preface.org
├── 01.building-abstrations-with-procedures.org
├── 02.building-abstrations-with-data.org
├── 03.modularity-objects-and-states.org
├── 04.metalinguistic-abstration.org
├── 05.computing-with-register-machines.org
├── all-codes
│ ├── ch1.scm
│ ├── ch2.scm
│ ├── ch2support.scm
│ ├── ch2tests.scm
│ ├── ch3.scm
如何从 'all-codes' 加载当前级别的 scm 代码?
您似乎应该使用文件的绝对路径或使用 source-directories
重新定义在通过加载加载文件时搜索源文件或目标文件的目录集。
更多信息:
procedure: (load path) ... The parameter source-directories
(Section
12.5) determines the set of directories searched for source files not identified by absolute path names.
(来源http://cisco.github.io/ChezScheme/csug9.5/system.html#./system:h4)
这里
global parameter: source-directories
... determines the set of directories searched for source or object
files when a file is loaded via load
, load-library
, load-program
,
include
, visit
, or revisit
, when a syntax error occurs, or when a
source file is opened in the interactive inspector.
The default value is the list (".")...
(来源http://cisco.github.io/ChezScheme/csug9.5/system.html#g114)
用chezscheme加载当前目录下的文件all-codes
(load "ch4-mceval.scm")
但是,如果将目录更改为父目录并尝试:
(load "all-codes/ch4-mceval.scm")
加载异常:all-codes/ch4-mceval.scm 失败:没有这样的文件或目录:
我的目录显示为
$ tree -L 2
.
├── 00.elisp-SICP.org
├── 00.preface.org
├── 01.building-abstrations-with-procedures.org
├── 02.building-abstrations-with-data.org
├── 03.modularity-objects-and-states.org
├── 04.metalinguistic-abstration.org
├── 05.computing-with-register-machines.org
├── all-codes
│ ├── ch1.scm
│ ├── ch2.scm
│ ├── ch2support.scm
│ ├── ch2tests.scm
│ ├── ch3.scm
如何从 'all-codes' 加载当前级别的 scm 代码?
您似乎应该使用文件的绝对路径或使用 source-directories
重新定义在通过加载加载文件时搜索源文件或目标文件的目录集。
更多信息:
procedure: (load path) ... The parameter
source-directories
(Section 12.5) determines the set of directories searched for source files not identified by absolute path names.
(来源http://cisco.github.io/ChezScheme/csug9.5/system.html#./system:h4)
这里
global parameter: source-directories
... determines the set of directories searched for source or object files when a file is loaded via
load
,load-library
,load-program
,include
,visit
, orrevisit
, when a syntax error occurs, or when a source file is opened in the interactive inspector.The default value is the list (".")...
(来源http://cisco.github.io/ChezScheme/csug9.5/system.html#g114)