Sections 2.1 and 2.2 Flashcards

1
Q

Fill in the blank

Executing a functional program consists of ____ an expression.

A

Executing a functional program consists of evaluating an expression.

p. 4

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

Fill in the blank

A functional program has a natural representation as a ____.

A

A functional program has a natural representation as a graph.

p. 4

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

Fill in the blank

Evaluation proceeds by means of a sequence of simple steps, called ____.

A

Evaluation proceeds by means of a sequence of simple steps, called reductions.

Hence the term graph reduction.

p. 4

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

What does the term redex stand for?

A

“reducible expression”

p. 10

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

How does one read the right-pointing arrow?

A


“reduces to”

p. 10

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

Given all functions take a single argument, how should one understand the following?

(+ 3 4)
A

“the function +, applied to 3, the result of which is a function applied to 4.”

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

Fill in the blank

(+ 3 2) ←→ ((+ 3) 2)

Or in words, “Function application is ____ associative.”

A

Function application is left associative.

p. 11

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

Fill in the blank

Lambda abstraction is ____ associative.

λx . λy . E
A

Lambda abstraction is right associative.

λx . λy . E → (λx . (λy . E)) 

Adhiraj

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

CONS is short for what?

A

“construct”

p. 12

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

Fill in the blank

The lambda calculus provides a construct, called a lambda ____, to denote new, non-built-in functions.

(λx . + x 1)
A

The lambda calculus provides a construct, called a lambda abstractions, to denote new, non-built-in functions.

p. 12

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

What is a good way to read the following?

(λx . + x 1)
A

“That function of x which adds x to 1.”

Always those four parts. λ, parameter, dot, body.

p. 12

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

What are the four expression types?

A

constants, variables names, applications, lambda abstractions

<exp> :: = <constant>
      |    <variable>
      |    <exp> <exp>
      |    λ<variable> . <exp>

Figure 2.1, Syntax of a lambda expression (in BNF)

p. 13

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

What do we know about the expressions e and E ?

A
  • e (lower-case) is a variable.
  • E (upper-case) is any lambda expression
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which variable is free? Which is bound?

(λx . + x y) 4
A

x is bound.
y is free.

p. 14

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

Which variables are free? Which are bound?

 \+ x ((λx . + x 1) 4)
A

first x is free.
second x is bound.

p. 15

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

What term describes this conversion?

(λx . + x 1) 4 → + 4 1
A

β-reduction

Instances of the parameter are replaced with the argument.

p. 15

17
Q

What term describes this conversion?

 \+ 4 1 ← (λx . + x 1) 4
A

β-abstraction

Introduces a new lambda abstraction

p. 18

18
Q

What term covers both of these cases?

(λx . + x 1) 4 ←β→ + 4 1
A

β-conversion

Both β-reduction and β-abstraction

p. 18

19
Q

What term describes this equivalence?

(λx . + x 1) ←→ (λy . + y 1)
A

α-conversion

“alpha”

p. 18

20
Q

What term describes this equivalence?

(λx . + 1 x) ←→ (+ 1)
A

η-conversion