返回字符串中的第一个表或第一个原子
(read [string])
read 函数分析字符串,并将字符串中的第一个“词”转换为对应的数据类型并返回。
参数
string
字符串。string 参数不能在表或字符串外包含空格。
返回值
read 函数将其参数转换成相应的数据类型后返回。如果未指定参数,read 返回 nil。
如果字符串中包含由空格、换行符、制表符或括号等 LISP 分隔符分开的多个词,则只返回其中的第一个词。
示例
命令: (read "hello")
HELLO
命令: (read "hello there")
HELLO
命令: (read "\"Hi Y’all\"")
"Hi Y'all"
命令: (read "(a b c)")
(A B C)
命令: (read "(a b c) (d)")
(A B C)
命令: (read "1.2300")
1.23
命令: (read "87")
87
命令: (read "87 3.2")
87
明经通道 版权所有 未经许可 不得传播 | 评论 |