General introduction to Programming Languages ([SCOTT] chapter 1).
Clojure fundamentals.
def
, let
).
+
, +'
, 
, *
, *'
, /
, <
, <=
, =
, not=
, ==
, >
, >=
, boolean
, char
, char?
, dec
, even?
, format
, inc
, keyword?
, neg?
, nil?
, number?
, odd?
, pos?
, quot
, rem
, str
, string?
, symbol?
, and zero?
.
quote
('
) special form.
not
, and
, or
. Shortcircuit evaluation.
if
, cond
, case
). Truthy and falsy values.
defn
) and application. Parameters. Multiarity and variadic functions. Docstrings. Anonymous functions and closures. The apply
, fn?
, and ifn?
functions.
loop
/recur
.
Clojure collections.
butlast
, concat
, cons
, count
, cycle
, distinct
, drop
, dropwhile
, empty?
, every?
, filter
, first
, interleave
, interpose
, iterate
, last
, map
, mapcat
, nth
, partition
, partitionby
, range
, reduce
, remove
, repeat
, rest
, reverse
, seq
, seq?
, some
, sort
, splitat
, splitwith
, take
, and takewhile
.
conj
and list
.
assoc
, conj
, get
, nth
, vec
, and vector
.
assoc
, contains?
, dissoc
, frequencies
, get
, keys
, merge
, vals
, and zipmap
.
conj
, contains?
, disj
, get
, and set
.
Parallel programming.
pmap
function.
NOTE: Once the exam starts you are not allowed to share any items with anyone else.
Pen, pencil, eraser, pencil sharpener.
Simple scientific calculator. You are not allowed to use a cell phone, programmable calculator, tablet, computer, or any other electronic device.
Personal cheat sheet with the following characteristics:

Give three examples of Clojure builtin higherorder functions.
What is the result of the following Clojure expression?
(takewhile #(< % 10) (iterate #(+ % %) 1)))
Write a Clojure function called containsalldigits?
that takes an integer argument \(n\) and returns true
if \(n\) contains each of the ten digits from 0 to 9 at least once, or false
otherwise.
Examples:
(containsalldigits 1023456789) => true (containsalldigits 1236) => false
You are given the following Clojure code:
(defn mystery ([x] (mystery x #(* 2 %) #(inc %))) ([a b c] (c (b a)))) (defn wierd [& t] (let [n (count t)] (cond (zero? n) 1 :else (inc (apply wierd (rest t))))))
What is the result of evaluating the following expressions?
(mystery 5)
(wierd 4 8 15 16 23 42)
(mystery 2 dec inc)
(mystery 10 wierd (fn [z] (* z z)))
Write a function in Clojure called howmanydiv3
that receives as input a sequence of integers and returns the result of counting how many of these numbers are exactly divisible by 3. For example:
(howmanydiv3 ()) => 0 (howmanydiv3 [6 2 3 12 4]) => 3 (howmanydiv3 '(2 5 7 11 19)) => 0 (howmanydiv3 [0 33 66 99]) => 4
You have a sequential program that takes 10 seconds to execute using 1 processor. The parellel version of the same program takes 2 seconds to execute using 8 processors. Calculate its speedup.