I know this example is trivial because I think there is a clojure library function that will do this, that is not the point.
I have the following code
(defn makelistres [a b res]
(if (= a b) res (makelistres a (dec b) (conj res b))))
(defn makelist [a b]
(makelistres a b [])
)
Is there a way to do the same effect without having to pass the list as a parameter? Such as throwing it on the stack
Such as
(defn test [a b]
(if (= a b) 0 (+ 1 (test a (dec b))))
)
Don't know if the parenthesis match up, as I wrote this in this text box, but you get the point.
makelistresfunction does? I'm sure it works, but I'd just like to know what to expect when running it at the REPL.(vec (range b a -1))but with stack overflow ifa > b