Skip to content

Instantly share code, notes, and snippets.

@wontheone1
Created January 1, 2017 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wontheone1/d5fe299f379c8912cd3a0496e9444d06 to your computer and use it in GitHub Desktop.
Save wontheone1/d5fe299f379c8912cd3a0496e9444d06 to your computer and use it in GitHub Desktop.
(def array ["az" "toto" "picaro" "zone" "kiwi"])
(def str-arr ["I" "wish" "I" "hadn't" "come"])
(concat (drop 1 (for [elmt array]
(map (partial clojure.string/join " ") (split-at (.indexOf array elmt) array)))))
(defn partlist [arr]
(->> (remove (partial some #{""})
(for [index (range (count arr))]
(map (partial clojure.string/join " ") (split-at index arr))))
(into [])))
@wontheone1
Copy link
Author

(def array ["az" "toto" "picaro" "zone" "kiwi"])
(def str-arr ["I" "wish" "I" "hadn't" "come"])

(defn partlist [arr]
  (->> (for [index (range 1 (count arr))]
         (map (partial clojure.string/join " ")
              (split-at index arr)))
       (into [] (for [index (range 1 (count arr))]
                  (map (partial clojure.string/join " ")
                       (split-at index arr))))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment