Your inner (add1 [x]) is calling add1 with a vector containing x, you want (add1 x):
(defn add2 [x] (add1 (add1 x)) HTH On 10 November 2016 at 14:51, 'Rickesh Bedia' via Clojure <clojure@googlegroups.com> wrote: > I have this function: > (defn add1 [x] > (+ 1 x)) > which is just a very simple function that adds 1. > > I now want to create a new function called add2 that uses add1 twice. > I have tried > (defn add2 [x] > (add1 (add1 [x])) > but this doesn't work. (Can someone explain why this doesn't work. I think > its maybe I am calling the function incorrectly) > > I have ideas about using recur because I eventually want to create a > function addn where the function takes arguments n and x and calls add1 n > times to x > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.