Exercise 7
Each of (a)–(c) is a member of one of the sets given in (i)–(iii). Say which item comes from which set.Sets: (i) SetOfSeqOfChar. (ii) SeqOfSetOfChar. (iii) SeqOfSeqOfChar.
- (a) {“error1”, “error2”, “error3”}.
- (b) [“error1”, “error2”, “error3”].
- (c) [{‘e’,‘1’}, {‘T’}, {‘q’,‘w’,‘e’,‘r’,‘t’,‘y’}].
Answer
Solution
- (a) This is a set, as shown by the outer curly brackets. Each member of this set is a string, that is, a sequence of characters. So (a) is a set of sequences of characters. It is a member of SetOfSeqOfChar.
- (b) This is a sequence, as shown by the outer square brackets. It is a sequence of strings. So (b) is a sequence of sequences of characters. It comes from SeqOfSeqOfChar.
- (c) This is again a sequence. Each member of this sequence is a set of characters. So (c) comes from SeqOfSetOfChar.
Exercise 8
Let Mix be the disjoint union Int Char. What is the length of the following sequence from SeqOfMix?[555, ‘5’, ‘5’, ‘5’, 11, 1].
No comments:
Post a Comment