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?)
Asked
Active
Viewed 157 times
0

Derek Mahar
- 27,608
- 43
- 124
- 174
2 Answers
2
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?)
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

Alexey Romanov
- 167,066
- 35
- 309
- 487
2
Here is a possible implementation of the List.is
function mentioned by Alexey in his answer.
fun {IsList Xs}
case Xs of nil then true
[] _|Xr then {IsList Xr}
else false
end
end

francoisr
- 4,407
- 1
- 28
- 48