Skip to content

Instantly share code, notes, and snippets.

@blogscot
Created April 20, 2022 21:31
Show Gist options
  • Save blogscot/ab00f197cdf414359eee9690304fdda0 to your computer and use it in GitHub Desktop.
Save blogscot/ab00f197cdf414359eee9690304fdda0 to your computer and use it in GitHub Desktop.
Discord Server: Clojure Study Group Solution #1
(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