模块:module / require / export

inline 模块与文件模块:出口声明、限定名访问,以及未出口名字的边界。

inline 模块:出口 + 顶层定义;限定名访问。

(module arith (export double inc)
  (defun double [x] (* 2 x))
  (defun inc [x] (+ x 1)))
[(arith/double 21) (arith/inc 20)]

未出口的名字不可限定访问;(module-exports (quote arith)) 查出口。

(module hidden (export ok)
  (defun ok [] :yes)
  (defun secret [] :no))
(hidden/ok)

文件模块(需文件宿主):文件名 = 模块名,顶层 def,(export ...) 声明出口。

(require :std.pipeline)
(pipeline/map inc [1 2 3])