Sections 4.1 and 4.2 Flashcards

1
Q

Structured types in Miranda define one or more ____.

A

constructors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A generic type in Miranda is a ____ type in Haskell.

A

polymorphic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A type-forming operator in Miranda is a ____ in Haskell.

A

type constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Lists and tuples can be translated to values of ____ types.

A

structured

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A structured type with exactly one constructor is a ___ type.

A

product type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A structured type with two or more constructors is a ____ type.

A

sum type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True or false: Structured types are also known as algebraic data types.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or false: The ordering of equations in a function definition can matter when patterns are involved.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Constant patterns can be expressed as ____.

A

guards

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Name the three constructs added to the enriched lambda calculus in order to support pattern matching.

A

Pattern-matching lambda abstractions, FAIL, and []

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A pattern-matching lambda abstract either returns a regular value or ____.

A

FAIL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

True or false: [] is strict in its first argument.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or false: [] is strict in its second argument.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Why is a reduction rule for FAIL needed?

A

So that normal function application to a (curried) function of multiple arguments produces the desired result on pattern match failure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

TR translates guarded right hand sides (RHSs) into ___.

A

a nested IF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

TR translates RHSs with a where clause into a ____.

A

letrec expression

17
Q

True or false: The scope of the where clause ranges over all the RHSs.