Question: Further Operations on Cartesian Lists. We refer to Example. Define the following operations on Cartesian lists: (1) length of a list: The number of (zero,

Further Operations on Cartesian Lists. We refer to Example. Define the following operations on Cartesian lists: (1) length of a list: The number of (zero, one or more) elements that it contains. (2) index set (inds) of a list: The set of indices, from 1 to and including the length of the list. If the list is empty then the index set is the empty set. (3) element set (elems) of a list: The set of distinct elements of the list. If the list is empty then the element set is the empty set.

Further Operations on Cartesian Lists. We refer to Example. Define the following

operations on Cartesian lists: (1) length of a list: The number of

Example 4.2 A Simple Language of Cartesian Lists: Consider and ) to be delimiters of list expressions, that is.(a,b,c) designates the list of elements a, b and c, and in that order: a being the first list element, b being the second and c being the third element. Now consider using just pairs of Cartesians to designate lists: (token,token) () ((a) ,token)-?a) ((a),((b),token)) - (a,b) ((a),((b),((c),token))) (a,b,c) That is, (token,token) designates the empty list, and (a), ) designates the list whose first element is a and whose tail is the Cartesian list l. Does this work? Well, only if the pairs obey, for example, this restricted syntax: ::= (token,token) | ( , ) A is any set (i.e., type) of, for example, atomic (non-Cartesian) values With this language of Cartesian lists, how do we express concatenation, (a,b,c)^ ?d,e)= ?a,b,c,d,e) ? ^: (token ,token) ^((a),1) ((a),1) , of two lists: Well, let us try: : ((a),e)(token,token) E ((a),t) Example 4.2 A Simple Language of Cartesian Lists: Consider and ) to be delimiters of list expressions, that is.(a,b,c) designates the list of elements a, b and c, and in that order: a being the first list element, b being the second and c being the third element. Now consider using just pairs of Cartesians to designate lists: (token,token) () ((a) ,token)-?a) ((a),((b),token)) - (a,b) ((a),((b),((c),token))) (a,b,c) That is, (token,token) designates the empty list, and (a), ) designates the list whose first element is a and whose tail is the Cartesian list l. Does this work? Well, only if the pairs obey, for example, this restricted syntax: ::= (token,token) | ( , ) A is any set (i.e., type) of, for example, atomic (non-Cartesian) values With this language of Cartesian lists, how do we express concatenation, (a,b,c)^ ?d,e)= ?a,b,c,d,e) ? ^: (token ,token) ^((a),1) ((a),1) , of two lists: Well, let us try: : ((a),e)(token,token) E ((a),t)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!