• No results found

Functioneel Programmeren (INFOFP) 24 februari 2005

N/A
N/A
Protected

Academic year: 2021

Share "Functioneel Programmeren (INFOFP) 24 februari 2005"

Copied!
2
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

Informatica Instituut, Faculteit Wiskunde en Informatica, UU.

In elektronische vorm beschikbaar gemaakt door de TBC van A−Eskwadraat.

Het college INFOFP werd in 2004-2005 gegeven door Prof. dr. S.D. Swierstra.

Functioneel Programmeren (INFOFP) 24 februari 2005

The exam consists of two open questions (2 points each) and 6 multiple choice questions (1 point each). A wrong multiple choice answer will give a negative result (−13 point), whereas omitting the answer results in 0 points. Therefore, guessing is not recommended. Hand in this form, with choices made and open questions answered. Put the right answer to the multiple choice questions in the box to the right of the alternatives.

Opgave 1

Define the function takeWhile using a call to foldr.

Opgave 2

Give the type and the definition of the function foldl.

Opgave 3

What is the type of the expression [[]]?

a) [a]

b) [[]]

c) [Int]

d) [[a]]

Opgave 4

What is the result of foldr const 0 [1,2,3] in which const x y = x?

a) 0 b) 1 c) 3 d) 6

Opgave 5

What is the result of (filter even.takeWhile even) [[2]]?

a) []

b) [2]

c) [[2]]

d) a type error message

(2)

Opgave 6

What is the result of foldr ((+).(+1)) 0 [1,2,3]?

a) 1 b) 6 c) 7 d) 9

Opgave 7

Which text completes until p f x = ...?

a) takeWhile p (iterate f x) b) takeWhile (not.p) (iterate f x)

c) (head.dropWhile (not.p)) (iterate f x) d) dropWhile p (iterate f x)

Opgave 8

What is the type of of the function dmap f l = map (map f) l?

a) ( a → b) → [[a]] → [[b]]

b) ( a → b) → [[a]] → [b]

c) ( a → b) → (a → b) → [a] → [b]

d) ( a → c → b) → [a] → [c] → [b]

Referenties

GERELATEERDE DOCUMENTEN

User agent style definitions have a higher priority than author style definitions.. User style definitions always have a higher priority than author

If the HTTP server is designed to be used by an AJAX client, it should never respond to HTTP POST requests.. A drawback of AJAX is that HTTP servers can no longer use the common

If the HTTP server is designed to be used by an AJAX client, it should never respond to HTTP POST requests.. A drawback of AJAX is that HTTP servers can no longer use the common

Je hoeft ook de functies voor sequenti¨ ele compositie (<*>), keuze (<|>), voor de lege string (pSucceed) en voor een enkel symbool (pSym) niet zelf te defini¨ eren.

Woorden mogen niet afgebroken worden, en de lengte van het langste woord is hoogstens de meegegeven

a) De functie foldl gebruikt altijd minder ruimte dan foldr.. b) De functie foldr kan al een stukje van een resultaat opleveren als het lijstargument nog niet helemaal

The questionnaire has provided room for the respondents to express their wishes and improvements for their OR information systems.. This appendix summarizes their response, ranked

We predict that children will be drawn to the sentence-internal reading of ’different’, for both the quantifier ’each’ and the definite plural ’the’, due to their preference