Erlang Flashcards

(39 cards)

1
Q

erlang og need

A

telecom systems where reliability, responsiveness, scalability, and constant availability were needed

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

nature of erlang programs

A

immutable data, pattern matching, functional programming, garbage collector

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

sequential subset of erlang lang supports

A

eager evaluation, single assignment, dynamic typing

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

normal erlang application built out of

A

thousands of small erlang programs

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

BEAM

A

virtual machine at core of erlang
part of run time system

.beam file extension

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

Erlang run time system (ERTS) compiles

A

erlang source code into bytecode which runs on BEAM

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

ERTS designed for systems with these traits:

A

distributed, fault tolerant, soft real time, highly available non stop apps, hot swapping

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

what makes erlang processes “living” objects

A

data encapsulation, message passing and capable of changing behavior during runtime (hot swapping)

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

thread of execution

A

process

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

how does erlang communicate

A

asynch signaling

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

most commonly used signal

A

message

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

other common signals

A

exit, link, unlink, monitor, demonitor

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

basic unit of concurrency

A

process

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

process

A

lightweight thread of execution that runs independently and communicates with other processes through message passing

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

how are processes created

A

spawn function -> takes function as an argument and returns process identifier (pid)

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

what is a program a call to

A

call to an initial function

17
Q

how are processes scheduled

A

virtual machine (vm)

18
Q

erlang: let it crash or let it fail

A

let it fail -> less code devoted to defensive programming

19
Q

design philosophy

A

systems -> expect failure to happen, build supervisor structure to monitor executions, detect failures, and restart failed processes

20
Q

variables

A

sequence of characters, must begin with uppercase letter

21
Q

are variables single assignment

A

yes, value cannot be changed once assigned

22
Q

atoms

A

sequence of characters, must begin with lowercase

23
Q

functions

A

named sequences of expressions to be evaluated

24
Q

modules

A

primary mechanism for organizing erlang code -> contain func defs

25
basic data types
atom, int, float, binary, pid, port, fun
26
structured types
list: dynamic mixed collection [] tuple: fixed-length mixed collection {}
27
pattern matching
used in function parameter binding
28
guards
used to partially define function clauses
29
io:format("~s~p~n"["age: ", 45]). what does this do
~n -> newline ~p -> numeric data ~s -> string data
30
module consists of
sequence of attributes and function declarations
31
what do modules get compiled into
nameoffile.beam
32
function declaration
sequence of function clauses separated by semicolons and terminated by period
33
what does a function clause consist of
head and body separated by ->
34
clause head
func name, argument list, optional guard sequence beg with keyword when
35
sequential scope
variables are accessible after they are bound
36
nested scope
inner expressions dont leak variables to outer ones
37
t/f: no global variables
true, everything is local to the func, mod, or process
38
t/f: processes can share variables
false, its all local to process scope
39
pattern matching scope
case, receive, if expressions -> vars are bound to one branch only