expression evaluation Flashcards

1
Q

how are expressions evaluated?

A

most exprs are simple, evaluate E1 and E2 and combine them

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

short circuit evaluation

A

E1 orelse E2

E1 andalso E2

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

function evaluation

A

two common methods: leftmost innermost and leftmost outermost

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

leftmost innermost

A

• args evaluated from L to R
ª start with innermost expr
• args evaluated before function call
• each arg is evaluated exactly once

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

leftmost outermost

A
  • args evaluated from L to R
  • start with outermost expr
  • args evaluated as needed
  • each arg evaluated 0 or more times
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

innermost

A
  • EVE (eager, value, efficient)
  • call by value (eager)
  • generally more efficient
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

outermost

A
  • LENT (lazy, name, terminates)
  • call by name (lazy)
  • may terminated in cases where innermost does not
How well did you know this?
1
Not at all
2
3
4
5
Perfectly