I'm writing a function in clojure, that takes in 2 arguments (both are lists), and iterates over vehicles by recursion, until the vehicle list becomes empty. The function is like:
(defn v [vehicles locs]
(if (= (count vehicles) 0)
nil
(if (> (count vehicles) 0)
(split-at 1 locs)
(v (rest vehicles) (rest locs))
))
)
So, if I give the input as (v '(v1 v2 v3) '([1 2] [2 3] [4 2] [5 3])), then I want the output as [([1 2]) ([3 4]) ([5 6] [6 7])]. I know that the statement (v (rest vehicles) (rest locs)) is not executing because it's taking it in the else case i.e., when count(vehicles) not > 0. I want to know how can I make this statement be executed in the same if block, i.e., in (if (> (count vehicles) 0)
when.