类型函数的 Shen 教程示例无法编译
Shen tutorial example for typed function does not compile
我刚刚发现了 Shen 语言,所以我将它作为 SBCL 构建安装在我的 debian linux 下,并开始学习 Shen in 15 minutes 教程。
我做到了这一点,你打开类型检查,使用
Shen, copyright (C) 2010-2015 Mark Tarver
www.shenlanguage.org, Shen 22.2
running under Common Lisp, implementation: SBCL
port 3.0.3 ported by Mark Tarver, Robert Koeninger and Bruno Deferrari
(tc +)
(define total
(list number) --> number
[] -> 0
[X | Y] -> (+ X (total Y)))
在 repl 中输入上述序列或将其存储到 .shen
文件中,然后 (load "in15min.shen")
产生意外的结果:
[list number] is not a legitimate constructor
无论如何尝试对其进行评估,我得到一个 type error
作为输出。
所以我的问题是:
- 教程是否已过时且语法已更改?
- 还是我做错了什么?
样式 sheet 的渲染错过了 {}s。
(define total
{(list number) --> number}
[] -> 0
[X | Y] -> (+ X (total Y)))
是对的。
马克
我刚刚发现了 Shen 语言,所以我将它作为 SBCL 构建安装在我的 debian linux 下,并开始学习 Shen in 15 minutes 教程。
我做到了这一点,你打开类型检查,使用
Shen, copyright (C) 2010-2015 Mark Tarver
www.shenlanguage.org, Shen 22.2
running under Common Lisp, implementation: SBCL
port 3.0.3 ported by Mark Tarver, Robert Koeninger and Bruno Deferrari
(tc +)
(define total
(list number) --> number
[] -> 0
[X | Y] -> (+ X (total Y)))
在 repl 中输入上述序列或将其存储到 .shen
文件中,然后 (load "in15min.shen")
产生意外的结果:
[list number] is not a legitimate constructor
无论如何尝试对其进行评估,我得到一个 type error
作为输出。
所以我的问题是:
- 教程是否已过时且语法已更改?
- 还是我做错了什么?
样式 sheet 的渲染错过了 {}s。
(define total
{(list number) --> number}
[] -> 0
[X | Y] -> (+ X (total Y)))
是对的。
马克