Input/Output Flashcards

1
Q

What is an Action

A

An action is a value of type IO a that, when performed, may do some input/output, before delivering a value of type a.
Example putStrLn :: String -> IO()

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

What does the bind operator&raquo_space;= do?

A

Passes the result of performing a first action to a parameterised second action i.e
snooper = readFile “/etc/passwd”&raquo_space;=
putStrLn

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

Do notation

A

Do notation provides a convenient notation for the&raquo_space;= and&raquo_space; operators

test fn s
= do writeFile fn s
readFile fn

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

Why is traditional parallel programming hard?

A
One must
conceive of a parallel algorithm
express the algorithm using tasks
map the tasks onto processors
ensure that scheduling avoids deadlock.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why is function parallel programming easier?

A

One must

conceive of a parallel algorithm

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

Why would a sequential algorithm not work well on multiprocessor machine

A

Only one processor can get involved.

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

Before creating a task to evaluate an expression one must consider:

A

is the result going to be useful
is the computation large enough
is there spare processing capacity

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