【发布时间】:2019-03-11 18:09:37
【问题描述】:
谁能简要解释 Oz 编程语言中 String 和 Atom 类型之间的区别?我发现缺少文档。
【问题讨论】:
-
如果我没记错的话
sting是一个包含字符的列表,而atom是一个空记录(有标签但没有组件的记录)。
谁能简要解释 Oz 编程语言中 String 和 Atom 类型之间的区别?我发现缺少文档。
【问题讨论】:
sting是一个包含字符的列表,而atom是一个空记录(有标签但没有组件的记录)。
据此,原子是一种记录。与其他类型的记录不同,原子没有内部结构。字符串只是列表的语法糖,因此将具有列表的所有其他属性,例如以Head|Tail 表示,以nil 结尾,等等。
你可以尝试这两个例子来加深你的理解:
{Browse 'hello'==hello} % prints true, neither is a string
{Browse "hello"==[104 101 108 108 111]} % prints true, equivalent representations of the same string
{Browse 'hello'=="hello"} % prints false
【讨论】: