Skip to content

Instantly share code, notes, and snippets.

@cronin101
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save cronin101/9327891 to your computer and use it in GitHub Desktop.

Select an option

Save cronin101/9327891 to your computer and use it in GitHub Desktop.
I have no idea what I am doing
(defn my_even? [n]
(= 0 (rem n 2)))
(defn my_filter [test_fn input_list]
(defn recstep [remaining_input acc]
(if (= 0 (count remaining_input))
acc
(let [ next_input (drop 1 remaining_input)
this_ele (first remaining_input)
next_acc (if (test_fn this_ele)
(concat acc [this_ele])
acc)]
(recstep next_input next_acc))))
(recstep input_list (list)))
(prn
(my_filter my_even? (take 10 (range))))
; > (0 2 4 6 8)
; => nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment