Lecture 1 - Basics

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/17

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

18 Terms

1
New cards

What is a compiler and what does it do?

A program which translates code into a standalone executable, called the GHC for Haskell.

2
New cards

What is an interpreter and what does it do?

An interactive interpreter which executes code directly (line-by-line), called the GHCi for Haskell.

3
New cards

What is the standard library for Haskell, and what is it good at?

Standard Prelude, good for list processing.

4
New cards

What is functional programming?

A programming paradigm (algebraic programming style) in which computation is the application of functions to arguments. Programs specify a data flow to describe what computations should happen (thus is declarative), not necessarily how.

5
New cards

What is imperative programming?

A programming paradigm (algorithmic programming style) in which computation is about modifying variables. Programs describe a control-flow to describe how computations should happen. Examples include Python, Java and C.

6
New cards

What is a function?

A mapping of arguments onto a single result. They can be defined as equations that match patterns.

7
New cards

What is an effectful function?

These functions’ outputs depend on/change internal, encapsulated states – thus, are affected by side effects, which are hidden state changes resulting from functions relying upon objects (like variables) external to its parameter list.

8
New cards

What is a pure function?

A deterministic function that takes all its inputs as arguments and produces all its outputs as results. It thus has no side effects.

9
New cards

What is a unary/binary function?

Takes one/two arguement(s).

10
New cards

What was early code, and why did it suck?

Early code was essentially assembly language, which was very hard to read, modify and debug.

11
New cards

What do high level langauges do well?

High-Level languages on the other hand abstract away from hardware details, using interpreters/compilers to translate into machine code. It lets programmers describe what to do, not how to manipulate the physical memory.

12
New cards

What do high-level languages use as tools?

Interpreters, compilers, or a mix of both.

13
New cards

What is the mix of both called?

JIT - “Just-in-time” hybrid compilation, using a compiler and then an interpreter to translate code at run-time.

14
New cards

What is infix notation?

Where you use backticks to insert a function name into a line between two arguments/other functions.

15
New cards

What is prefix notation?

Where you write the function (operations in brackets) before the arguments.

16
New cards

Can variables be changed? What does this mean?

Variables in function are immutable – they are defined once and cannot change. This means Haskell is referentially transparent.

17
New cards

What does referentially transparent mean?

Any expression can be replaced by its value without changing program behaviour.

18
New cards

What is an identity value?

Usually values that, when used in the operation defined by the function, do not change the function’s output.