Mozart-Oz difference between String and Atom

621 views Asked by At

Could anyone provide a concise explanation of the difference between String and Atom types in the Oz programming language? I found the documentation lacking.

1

There are 1 answers

0
prash On BEST ANSWER

This is the type hierarchy shown in the CTM book. The type hierarchy

According to this, an atom is a kind of record. Unlike other kinds of records, atoms do not have an internal structure. A string is just syntactic sugar for a list, and as such, will have all the other properties of a list, such as getting represented in terms of Head|Tail, terminated by nil, etc.

You can play around with these two examples to further your understanding:

{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