Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Students also viewed these Databases questions

Question

d. How will lack of trust be handled?

Answered: 1 week ago

Question

Are the rules readily available?

Answered: 1 week ago