You are here:   ArielOrtiz.com > Programming Languages > 4Clojure Problems

4Clojure Problems

Objectives

During this activity, students should be able to:

This activity helps the student develop the following skills, values and attitudes: ability to analyze and synthesize, capacity for identifying and solving problems, and efficient use of computer systems.

Activity Description

This activity can be developed individually or in pairs.

Solve the following problems from the 4Clojure web site:

Deliverables

For each individual problem, write a Clojure source file called problem_n.clj (where n is the problem number) using the following structure:

; Problem and authors info.
    
(use 'clojure.test)

(def p
  
  ;;; Clojure code that solves the problem.

)

(deftest test-p

  ;;; Unit tests.

)

(run-tests)

The unit tests should be same ones provided for that specific problem.

For example, for problem 21. Nth Element, the corresponding Clojure source file problem_21.clj would be:

;----------------------------------------------------------
; Problem 21: Nth Element
; Date: March 17, 2016.
; Authors:
;          A01166611 Pepper Pots
;          A01160611 Anthony Stark
;----------------------------------------------------------

(use 'clojure.test)

(def p
  
  #(first (drop %2 %1))

)

(deftest test-p
  (is (= (p '(4 5 6 7) 2) 6))
  (is (= (p [:a :b :c] 0) :a))
  (is (= (p [1 2 3 4] 1) 2))
  (is (= (p '([1 2] [3 4] [5 6]) 2) [5 6])))

(run-tests)

Create a ZIP file containing all ten Clojure source files. Call this file 4clojure.zip.

✔ Upload Instructions

To deliver the 4clojure.zip file, please provide the following information:

Request PIN

Due date is Thursday, March 17.

Evaluation

This activity will be evaluated using the following criteria:

DA One ore more programs were plagiarized.
10-100 Depending on the amount of exercises that were solved correctly.