Week 1 Flashcards

(14 cards)

1
Q

What is a Function?

A

Transforms information received on its inputs to info transmitted on its output

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

What is a Guard (+special final guard)?

A

A Guard is a boolean expression that must be true for the equation to apply

The special final guard, otherwise is always true

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

How do you write the application of a function f to an argument x in programming?

A

Always written f x (instead of f(x) )

or f a b c d (spaces between arguments)

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

What are Types?

A

Set of values with the same usage and behaviour

All of values in these sets are same kind of thing, eg. Integers / Strings / Floats / Characters / Booleans only

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

What is the purpose of a Type System?

A

to prevent errors during the execution of a process

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

What is Typechecking?

A

Ensures types are used consistently, so these errors are avoided

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

What is Dynamic Typechecking?

A

If typechecking happens during program execution, then we have Dynamic Typechecking

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

What is Name Space Pollution?

A

Namespace pollution occurs when too many identifiers (e.g., variables, functions) are defined in the same scope, making it hard to track and manage them. It increases the risk of naming conflicts and bugs.

Having all functions at the top level of a script can lead to Name Space Pollution

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

What are Local Definitions?

A

Local definitions are variables, functions, or objects declared within a specific block of code (e.g., a function, loop, or conditional block). They are accessible only within that block and do not affect the wider program

Prevents Name Space Pollution

Eg. Where, Let etc..

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

What does the Where definition do?

A

Allows one to name a value, and to use it in an expression

eg. in Haskell

result = x + y
where
x = 5
y = 10

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

What has happened to Hardware and Software prices over the years?

A

Hardware prices have fallen whereas software prices have increased

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

What is Functional Programming?

A

Programs Represented by Expressions:

In functional programming, everything is expressed in terms of expressions (e.g., mathematical functions) rather than statements.
Example: Instead of loops or imperative instructions, functional programming focuses on expressions like map, filter, or recursive functions.
Computation is Implemented by Reduction:

Computation occurs through reducing expressions to their simplest form (like evaluating a math equation).

Programs represented by expressions

Computation is implemented by reduction

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

What is Logical Programming?

A

Core Concept: Programs are defined using facts and rules that describe relationships and logic.

A programming paradigm where computation is based on formal logic (facts and rules).
Key Features:
Declarative: Focuses on what to solve, not how.
Uses rules and facts to infer conclusions.
No explicit flow control; the program searches for solutions.

Programs represented by clauses

Computation represented by proof

The foundation is first-order logic

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

What are Finite State Machines?

A

Programs represented by state machines

Computation is represented by transitions

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