Created
April 20, 2022 21:31
-
-
Save blogscot/ab00f197cdf414359eee9690304fdda0 to your computer and use it in GitHub Desktop.
Discord Server: Clojure Study Group Solution #1
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
(ns eviscerate-sequence-test | |
(:require [clojure.test :refer [deftest is run-tests]])) | |
(defn eviscerate-sequence | |
([xs n] (eviscerate-sequence xs n n)) | |
([xs n m] | |
(let [v (vec xs)] | |
(concat (subvec v 0 n) (subvec v (inc m)))))) | |
(deftest eviscerate-sequence-test | |
(is (= (eviscerate-sequence '(1 2 3 4 5) 2) '(1 2 4 5))) | |
(is (= (eviscerate-sequence [:a :b :c :d :e [:a :b] :f] 1 4) [:a [:a :b] :f]))) | |
(run-tests *ns*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment