Skip to content

Instantly share code, notes, and snippets.

@eschulte
Created January 7, 2010 18:00
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 eschulte/271411 to your computer and use it in GitHub Desktop.
Save eschulte/271411 to your computer and use it in GitHub Desktop.
(defn del-sec
"Delete a line or section from the lst. Optional second argument
will force single line deletion rather than deleting an entire
section."
([lst]
(let [start (rand-int (.size lst))
length (rand-int (- (.size lst) start))]
(concat (take start lst) (drop (+ start length) lst))))
([lst single]
(let [start (rand-int (.size lst))]
(concat (take start lst) (drop (inc start) lst)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment