I'm currently working on a route planning program in clojure. I'm using ubergraph to create my data structure and then using ubergraphs built in shortest-path algorithm. I have it working with 2 arguments being passed in and also have it working with passing 3 arguments in.
However, instead of writing a new function each time I want to pass in more arguments is there a way to write a recursive version that can take in any number of arguments?
(defn journey [start end]
(alg/pprint-path (alg/shortest-path all-edges {:start-node start, :end-node end, :cost-attr :weight})))
(journey :main-office :r131)
(defn fullpath [start delivery end]
(journey start delivery)
(journey delivery end))
(fullpath :main-office :r131 :main-office)
(fullpath :main-office :r119 :main-office)
Above is the code I currently have which is working fine.
Would it be possible to write a function that could accept the arguments below for example and still print out the path taken.
(fullpath :main-office :r113 :r115 :main-office)
Any help greatly appreciated.