listhaskellscalaroz

How can an Oz program tell the difference between a list and a non-list?


How can an Oz program tell the difference between a value which is of type List and one which is a non-list such as simple scalar value 1 or string 'Hello'? (Like Haskell, does Oz treat a string as a list of characters?)


Solution

  • How can an Oz program tell the difference between a value which is of type List and one which is a non-list such as simple scalar value 1 or string 'Hello'?

    List.is.

    (Like Haskell, does Oz treat a string as a list of characters?)

    That's explained on the page you linked:

    Further notational variant is allowed for lists whose elements correspond to character codes. Lists written in this notation are called strings

    See also

    This chapter describes modules for handling data encoding textual information. Characters are encoded as integers. Strings are lists of characters. Virtual Strings are atoms, strings, byte strings, integers, and floats closed under virtual concatenation encoded by tuples with label '#'.