Shen 和 curried S 表情

Shen and curried S-expressions

Shen 中的函数是单值函数还是可变函数? (+ 1 2 3)在申shorthand是为了(+ 1 (+ 2 3))?我很好奇 Shen 中的柯里化,以及它如何与 S 表达式一起工作。

编辑 在我玩过 REPL 之后,我相信函数是单函数的。模式匹配给我留下了深刻的印象,但是如果我用两个以上的操作数调用它,我无法理解如何编写一个表现得像 + 的函数。

函数不是可变的,但一些宏是可变的。

(0-) (and true true true)
true

(1-) (macroexpand [and true true true])
[and true [and true true]]

(2-) (macroexpand [+ 1 2 3])
[+ 1 [+ 2 3]]

参见 defmacro 创建新的:

http://www.shenlanguage.org/learn-shen/macros.html