I am solving 4Clojure exercise, this exercise asks you to create your own insert function. My answer:
(fn my-interpose
([separator input] (my-interpose separator input nil))
([separator input result]
(if
(empty? input)
(reverse (rest result))
(my-interpose separator (rest input) (cons separator (cons (first input) result))))))
I do these exercises to learn the language when I read the book Clojure. I would like to know an opinion about my code of people with experience in this language. Can I avoid the callback? Are there any conventions that I rarely come across with such code?
source
share