Computer Languages and Representations Flashcards
What is a factor of the Software crisis and when did the Software crisis begin?
Began - 1960s
High cost of producing software - software costs have been rising as hardware costs have been falling
How are Programs represented and Computation implemented in:
- Functional Programming
- Logic Programming
- Finite State Machines
- Programs are represented by expressions
Computation is represented by reduction - Programs are represented by clauses
Computation is represented by proof - Programs are represented by state machines
Computation is represented by transitions
What are the foundations in Functional and Logic programming?
Functional Programming - lambda calculus
Logic Programming - first-order logic
Define a Function
A function transforms information recieved by inputs to information transmitted by output.
What are arguments and results in functions?
Argument = Inputs
Results = Outputs
What is a must for an equation to apply?
Argument must match the pattern for an equation
(Any argument matches a variable pattern)
What is a Pattern?
A pattern may describe the structure of the argument and name its components
What is a Guard?
A guard is a Boolean expression that must be true for the equation to apply.
(Guards often work with patterns)
Define “otherwise”
A special final guard that is always true.
How are functions used in programming?
The function f to an argument x is written as f x.
What is a Type?
Set of values with the same usage and behaviour.
(All of the values in one of these sets are the same kind of thing such as an integer)
What is a Type System?
The fundamental purpose of a type system is to prevent errors during the execution of the programs, by ensuring types match correctly.
What is Type Checking?
Ensures types are used consistently, and that these errors are avoided.
Define Static Type Checking
Happens before program execution
Define Dynamic Type Checking
Happens during program execution
What is a negative of Local Defintions?
Having all function at the top level of a script can lead to name space pollution - clashes caused by reuse of the same name.
What is a Where Definition?
A where definition allows one to name a value, and to use it in an expression.
What is a Let Definition?
A let definition allows one to name a value, and to use it in an expression.
What are the steps for Polya’s heuristic strategies?
- Understand the problem
- Devise a plan
- Carry out the plan
- Look back and reflect
Explain Understanding the problem in Polya’s heuristic strategies.
Involves careful study. May seem obvious, but failure to understand the problem often explains a failure to solve it.
Explain Devising a plan in Polya’s heuristic strategies.
Involves identifying calclulations, computations or constructions that may be performed in order to obtain the solution
What are 3 key questions when Devising a plan?
- Did you use all the data?
- Did you use the whole condition?
- Could you use a related problem, solved before?
Explain Carrying out the plan in Polya’s heuristic strategies.
Involves performing the steps in sequence to give the solution.
What are 2 key questions when Carrying out the plan?
- Can you see each step is correct?
- Can you prove each step is correct?
Explain Reflecting in Polya’s heuristic strategies.
Taking time to consider what worked and what didn’t. The insights gained may make it easier to find solutions to future problems