Advertisement
CLooker

2 indented versions of clj fn

Dec 26th, 2017
1,311
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (fn [some-seq]
  2.   (let [removed (reduce
  3.                   (fn [new-seq item]
  4.                     (if (= item (first (take-last 1 new-seq)))
  5.                       new-seq
  6.                       (conj new-seq item)))
  7.                   []
  8.                   some-seq)]
  9.     (if (= java.lang.String  (type some-seq))
  10.       (apply str removed)
  11.       removed)))
  12.  
  13. (fn rm-dp [some-seq]
  14.   (let
  15.       [removed
  16.        (reduce
  17.         (fn [new-seq item]
  18.           (if (= item (first (take-last 1 new-seq)) )
  19.             new-seq
  20.             (conj new-seq item )))
  21.         []
  22.         some-seq)]
  23.     (if (= java.lang.String  (type some-seq))
  24.       (apply str removed)
  25.       removed)))
Advertisement
RAW Paste Data Copied
Advertisement