Clojerl 项目教程
clojerlClojure for the Erlang VM (unofficial)项目地址:https://gitcode.com/gh_mirrors/cl/clojerl
1. 项目的目录结构及介绍
Clojerl 项目的目录结构如下:
clojerl/
├── bin/
│ ├── clje
│ └── clje.bat
├── doc/
│ ├── README.md
│ └── ...
├── src/
│ ├── clojerl/
│ │ ├── core.clj
│ │ └── ...
│ └── ...
├── test/
│ ├── clojerl/
│ │ ├── core_test.clj
│ │ └── ...
│ └── ...
├── Makefile
├── rebar.config
└── ...
目录结构介绍
- bin/: 包含项目的启动脚本,
clje
和clje.bat
分别用于 Unix 和 Windows 系统。 - doc/: 包含项目的文档文件,如
README.md
。 - src/: 包含项目的源代码,主要以 Clojure 文件为主。
- test/: 包含项目的测试代码,用于测试
src/
目录下的代码。 - Makefile: 项目的构建文件,用于编译和启动项目。
- rebar.config: Erlang 项目的配置文件,用于配置项目的依赖和构建选项。
2. 项目的启动文件介绍
启动文件
- bin/clje: Unix 系统下的启动脚本,用于启动 Clojerl 的 REPL 或执行 Clojure 脚本。
- bin/clje.bat: Windows 系统下的启动脚本,功能与
clje
相同。
启动方式
-
Unix 系统:
./bin/clje
-
Windows 系统:
bin\clje.bat
启动后,会进入 Clojerl 的 REPL 环境,提示符为 clje user=>
。
3. 项目的配置文件介绍
rebar.config
rebar.config
是 Erlang 项目的配置文件,用于配置项目的依赖、编译选项等。以下是一个示例配置:
{deps, [
{clojerl, "0.6.0"}
]}.
{plugins, [
{rebar3_clojerl, "0.1.0"}
]}.
{profiles, [
{test, [
{deps, [
{test_check, "0.1.0"}
]}
]}
]}.
Makefile
Makefile
是项目的构建文件,用于编译和启动项目。以下是一个示例 Makefile
:
all: compile
compile:
rebar3 compile
repl:
rebar3 clojerl repl
test:
rebar3 eunit
通过 make
命令可以执行不同的任务,如编译项目 (make compile
)、启动 REPL (make repl
) 或运行测试 (make test
)。
以上是 Clojerl 项目的目录结构、启动文件和配置文件的介绍。希望这些信息能帮助你更好地理解和使用 Clojerl 项目。
clojerlClojure for the Erlang VM (unofficial)项目地址:https://gitcode.com/gh_mirrors/cl/clojerl