Re: Couple of questions about sequences
- Posted by jaygade Aug 12, 2014
- 1387 views
For item 1, I would say that it's the programmer's responsibility to ensure that he passes a string sequence where a string sequence is expected.
If you really want to record type metadata, you could create a custom type where the first element is a type indicator (constant or enum) and a utility function to iterate over a sequence to verify whether or not it is a string.
You would then have to wrap your function calls to send just the string portion after verifying that it is the correct type.
In my experience, the main error in a sequence not being a string isn't that it contains atom or integer data instead of characters, but rather that it consists of subsequences instead of characters. The interpreter will often catch that as a runtime error.