This file contains hidden or 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 max_first [coll] | |
"Function which returns collection with firt number beign maximum of entire collection" | |
(loop [collection (rest coll) minimum (seq [(first coll)])] | |
(if (empty? collection) minimum | |
(recur (rest collection) | |
(if (> (first collection) (first minimum)) | |
(cons (first collection) minimum) | |
;since first argument of cons is number,I need to split 'minimum' into two subsequences. | |
(cons (first minimum) (cons (first collection) (rest minimum)))))))) |