Slide 14
Slide 14 text
Concatenation: Descriptive Def
Definition. The concatenation of two lists, = 1
, 2
, … ,
and
= 1
, 2
, … ,
is 1
, 2
, … ,
, 1
, 2
, … ,
.
How can we define this constructively?
14
Suggestion: Define p+q ::= Prepend(p,q)
Why does not work: then first(p+q) would be p not 1
Another reason this is not a good idea to define concatenation:
We might define Lists of “restricted objects” (e.g. integers) in which case
Prepend(e,q) only accepts “e” to be in restricted form (not including lists)