Last active
July 6, 2018 13:34
-
-
Save kaskichandrakant/53b62fad7f0522fa21127a4a55792195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn addition_of_numbers [array] | |
(reduce + array)) | |
;-------------------------------------- | |
(defn added_num_at_start [array num] | |
(cons num array)) | |
;-------------------------------------- | |
(defn calculated_value [operation num1 num2] | |
(cond-> num1 | |
(= "add" operation) (+ num2) | |
(= "sub" operation) (- num2) | |
(= "div" operation) (/ num2) | |
(= "mul" operation) (* num2))) | |
;-------------------------------------- | |
(defn day_of_nth_number [num] | |
(condp = num | |
1 "mon" | |
2 "tue" | |
3 "wed" | |
4 "thu" | |
5 "fri" | |
6 "sat" | |
7 "sun")) | |
;-------------------------------------- | |
(defn greatest_of_all [array] | |
(reduce (fn [num1 num2] (if (> num1 num2) num1 num2)) array)) | |
;-------------------------------------- | |
(defn even_numbers [array] | |
(filter even? array)) | |
;-------------------------------------- | |
(defn number_greater_than_100 [num] | |
(> num 100)) | |
;-------------------------------------- | |
(defn squares_of_all [array] | |
(map (fn [num] (* num num)) array)) | |
;-------------------------------------- | |
(defn addition_of_even [array] | |
(def even_array (even_numbers array)) | |
(addition_of_numbers even_array)) | |
;----------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment