functional programming Flashcards

1
Q

what is functional programming?

A
  • places emphasis on values
  • computation is done by the evaluation of expressions
  • emphasize mathematics, not storage
  • values cannot be stored (no assignment)
  • ML and Scheme
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

expressions

A
  • simple exprs are mathematical exprs

* conditionals are exprs (no if-then, only if-then-else)

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

local declarations (let)

A
  • allow names to be used in exprs

* decls are either value-binding or function-binding

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

let bindings

A
  • not assignment, shorthand
  • can expand a binding in the code
  • this expansion will not change meaning (no side effects)
  • assignment/output statements change the state of the machine
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is a type?

A
  • a set of values together with operations on those values

* use type exprs to build new types

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

type expressions can be:

A

1) a name
2) the product of two TEs
3) a list of TE
4) a mapping from one TE to another

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

what defines basic types?

A
  • values are atomic (cannot be broken down further)
  • e.g. boolean, int, real
  • only common operations: =,
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is a list?

A

a finite sequence of elements (like arrays)

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

what is a function?

A
  • a mapping from a domain to a range (A->B)
  • application is left associative
  • way of writing parameterized expressions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

arguments

A
  • functions take only a single argument in ML

* parameter list is expressed as a product

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

recursion

A

a function that calls itself (directly or indirectly)

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