Functional Programming Flashcards

1
Q
What is the function signature for the following functions:
foldL (reduceL)
foldR (reduceR)
map
flatMap
filter
groupBy
scan
zip
A
foldL(xs: [A], f: (B, A) → B, acc: B): B
foldR(xs: [A], f: (A, B) → B, acc: B): B
scan(xs: [A], f(B,A) → B, acc: B)
map(xs: [A] f: A → B): [B]
flatMap(xs: [A], f: A → [B]): [B]
filter(xs: [A], f: A → Boolean): [A]
groupBy(xs: [A], f: A → K): Map[K, [A]]
zip(xs: [A], ys: [B]) [(A,B)]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
(How) Can we re-write an SQL query with FP primitives?
SQL
Where 
Group by
select 
join
A
FP
Filter
group_by
map
join on KVs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the COW method?

A

The Copy-on-Write method, or COW for short, is a general technique used to share read-only access across processes, and deal with writes only if/when they are performed by copying the modded resource in a private version.
COW enables efficient immutable data, implements file systems, and shares read-only buffers

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