CIS 554 -- Clojure Quiz Name __________________________________
1. Write an anonymous function (a "function literal") to return the third value in a list. You may assume that the list has at least three elements.

2. Write a function named neg to return the first negative number in a list of numbers. You may assume that the list contains some negative numbers.

3. Write an anonymous function that, given a positive integer N, will return a list or sequence (either one) of the integers 1 through N, inclusive.

4. Give the function defined in the previous question the name count-to. Then use count-to to write an expression whose value is a list of squares of the numbers 1 through 100. That is, it returns [1 4 9 16 ... 10000].

5. Define a function non-mult-3 with argument N which returns true if N is not a multiple of 3. Reminder: Clojure has mod and not functions that you can use.

6. Use the previously defined functions to compute the product of the numbers 1 through 25 that are not multiples of 3.

7. Briefly, what does it mean to say that "a transaction is atomic"?

8. Briefly, what is a reference varable (ref)?

9. The real problem with the Java approach to concurrency is that

___________________________ + ___________________________ = ___________________________.
(fill in the blanks).

10. Write a tail-recursive function named sum to add up all the numbers in a list of numbers. Hint: Define sum to have two parameters, and use one of them as an "accumulator."