Re: Error in main using Stuart Sierra's Component when deploying to Heroku
The full error message is (when I look at the heroku logs) Exception in thread "main" clojure.lang.ExceptionInfo: Error in component :listener in system com.stuartsierra.component.SystemMap calling #'com.stuartsierra.component/start {:reason :com.stuartsierra.component/component-function-threw-exception, :function #'com.stuartsierra.component/start, :system-key :listener, :component #web.core.Listener{:listener nil}, :system #}, compiling:(/tmp/form-init7411312467703964054.clj:1:73) 2017-03-13T14:18:34.518986+00:00 app[web.1]: at clojure.lang.Compiler.load(Compiler.java:7391) 2017-03-13T14:18:34.519021+00:00 app[web.1]: at clojure.lang.Compiler.loadFile(Compiler.java:7317) 2017-03-13T14:18:34.519050+00:00 app[web.1]: at clojure.main$load_script.invokeStatic(main.clj:275) 2017-03-13T14:18:34.519088+00:00 app[web.1]: at clojure.main$init_opt.invokeStatic(main.clj:277) 2017-03-13T14:18:34.519125+00:00 app[web.1]: at clojure.main$init_opt.invoke(main.clj:277) 2017-03-13T14:18:34.519157+00:00 app[web.1]: at clojure.main$initialize.invokeStatic(main.clj:308) 2017-03-13T14:18:34.519190+00:00 app[web.1]: at clojure.main$null_opt.invokeStatic(main.clj:342) 2017-03-13T14:18:34.519229+00:00 app[web.1]: at clojure.main$null_opt.invoke(main.clj:339) 2017-03-13T14:18:34.519266+00:00 app[web.1]: at clojure.main$main.invokeStatic(main.clj:421) 2017-03-13T14:18:34.519300+00:00 app[web.1]: at clojure.main$main.doInvoke(main.clj:384) 2017-03-13T14:18:34.519344+00:00 app[web.1]: at clojure.lang.RestFn.invoke(RestFn.java:421) 2017-03-13T14:18:34.519372+00:00 app[web.1]: at clojure.lang.Var.invoke(Var.java:383) 2017-03-13T14:18:34.519450+00:00 app[web.1]: at clojure.lang.AFn.applyToHelper(AFn.java:156) 2017-03-13T14:18:34.632589+00:00 heroku[web.1]: Process exited with status 1 2017-03-13T14:18:34.519503+00:00 app[web.1]: at clojure.lang.Var.applyTo(Var.java:700) 2017-03-13T14:18:34.519564+00:00 app[web.1]: at clojure.main.main(main.java:37) 2017-03-13T14:18:34.519947+00:00 app[web.1]: Caused by: clojure.lang.ExceptionInfo: Error in component :listener in system com.stuartsierra.component.SystemMap calling #'com.stuartsierra.component/start {:reason :com.stuartsierra.component/component-function-threw-exception, :function #'com.stuartsierra.component/start, :system-key :listener, :component #web.core.Listener{:listener nil}, :system #} 2017-03-13T14:18:34.520007+00:00 app[web.1]: at clojure.core$ex_info.invokeStatic(core.clj:4617) 2017-03-13T14:18:34.520035+00:00 app[web.1]: at clojure.core$ex_info.invoke(core.clj:4617) 2017-03-13T14:18:34.520098+00:00 app[web.1]: at com.stuartsierra.component$try_action.invokeStatic(component.cljc:119) 2017-03-13T14:18:34.520153+00:00 app[web.1]: at com.stuartsierra.component$try_action.invoke(component.cljc:116) 2017-03-13T14:18:34.520215+00:00 app[web.1]: at com.stuartsierra.component$update_system$fn__27520.invoke(component.cljc:139) 2017-03-13T14:18:34.520267+00:00 app[web.1]: at clojure.lang.ArraySeq.reduce(ArraySeq.java:109) 2017-03-13T14:18:34.520327+00:00 app[web.1]: at clojure.core$reduce.invokeStatic(core.clj:6544) 2017-03-13T14:18:34.520377+00:00 app[web.1]: at clojure.core$reduce.invoke(core.clj:6527) 2017-03-13T14:18:34.520400+00:00 app[web.1]: at com.stuartsierra.component$update_system.invokeStatic(component.cljc:135) 2017-03-13T14:18:34.520430+00:00 app[web.1]: at com.stuartsierra.component$update_system.doInvoke(component.cljc:129) 2017-03-13T14:18:34.520458+00:00 app[web.1]: at clojure.lang.RestFn.invoke(RestFn.java:445) 2017-03-13T14:18:34.520536+00:00 app[web.1]: at com.stuartsierra.component$start_system.invokeStatic(component.cljc:163) 2017-03-13T14:18:34.520610+00:00 app[web.1]: at com.stuartsierra.component$start_system.invoke(component.cljc:155) 2017-03-13T14:18:34.520729+00:00 app[web.1]: at com.stuartsierra.component$start_system.invokeStatic(component.cljc:161) 2017-03-13T14:18:34.520800+00:00 app[web.1]: at com.stuartsierra.component$start_system.invoke(component.cljc:155) 2017-03-13T14:18:34.520855+00:00 app[web.1]: at com.stuartsierra.component.SystemMap.start(component.cljc:178) 2017-03-13T14:18:34.520969+00:00 app[web.1]: at web.core$_main.invokeStatic(core.clj:71) 2017-03-13T14:18:34.521016+00:00 app[web.1]: at web.core$_main.doInvoke(core.clj:69) 2017-03-13T14:18:34.521069+00:00 app[web.1]: at clojure.lang.RestFn.invoke(RestFn.java:397) 2017-03-13T14:18:34.521135+00:00 app[web.1]: at clojure.lang.Var.invoke(Var.java:375) 2017-03-13T14:18:34.521191+00:00 app[web.1]: at user$eval5.invokeStatic(form-init7411312467703964054.clj:1) 2017-03-13T14:18:34.521250+00:00 app[web.1]: at user$eval5.invoke(form-init7411312467703964054.clj:1) 2017-03-13T14:18:34.521308+00:00 app[web.1]: at clojure.lang.Compiler.eval(Compiler.java:6927) 2017-03-13T14:18:34.521366+00:00 app[web.1]: at clojure.lang.Compiler.eval(Compiler.java:6917) 2017-03-13T14:18:34.521435+00:00 app[web.1]: at clojure.lang.Compiler.load(Compiler.java:7379)
Error in main using Stuart Sierra's Component when deploying to Heroku
I am trying to start my clojure application on my heroku dyno but I keep getting and error in my stuartsierra.component/start. Below is my core file containing my main function. (defrecord Listener [listener] component/Lifecycle (start [component] (assoc component :listener (yada/listener ["/" [(view/view-route) routes/route-handler ["public/" (new-directory-resource (io/file "target/cljsbuild/public") {})] [true (as-resource nil)]]] (or (env :port) (get (read-config "resources/config.edn" {:profile :dev}) :webserver)) ))) (stop [component] (when-let [close (-> component :listener :close)] (close)) (assoc component :listener nil))) (defn new-system [] (component/system-map :listener (map->Listener {}) )) (def system nil) (defn init [] (alter-var-root #'system (constantly (new-system (defn start [] (alter-var-root #'system component/start)) (defn stop [] (alter-var-root #'system (fn [s] (when s (component/stop s) (defn go [] (init) (start)) (defn reset [] (stop) (refresh :after 'web.core/go)) (defn -main [& [port]] (component/start (new-system)) (println "System Started") @(promise)) This is my core file with all my stuartsierra.component code. This all works perfectly when I run it locally on my laptop doing lein repl and then (go) and also when I just do lein run. So I am confused as to why it doesn't work when I push this to the heroku dyno. The error I get is Exception in thread "main" clojure.lang.ExceptionInfo: Error in component :listener in system com.stuartsierra.component.SystemMap calling #'com.stuartsierra.component/start {:reason :com.stuartsierra.component/component-function-threw-exception, :function #'com.stuartsierra.component/start, :system-key :listener, :component #web.core.Listener{:listener nil}, :system #}, compiling:(/tmp/form-init9049917434081554913.clj:1:73) This is telling me that my :listener is nil in the system-map. When I check locally (doing lein repl (go)) in (keys system) is (:listener) which is good so that means that the listener is starting and is in the system. When I do (-> system :listener) I get #web.core.Listener{:listener {:port 3300, :close #object[yada.aleph$listener$fn__21671 0xa5d4865 "yada.aleph$listener$fn__21671@a5d4865"], :server #object[aleph.netty$start_server$reify__13574 0x3cc9a232 "aleph.netty$start_server$reify__13574@3cc9a232"]}} which is perfect as the port has loaded up (3300) and the server has started. This makes it all the more confusing as to why the :listener is nil in my heroku app Any help would be much appreciated. Thanks -- 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.
GraphQL - Clojure - resolver-fn
I am researching how to use graphql in clojure and it all seems to make sense, and I can follow the Demo Project, except for the resolver-fn In https://github.com/tendant/graphql-clj the resolver function is defined to be (defn resolver-fn [type-name field-name] (cond (and (= "QueryRoot" type-name) (= "user" field-name)) (fn [context parent args] {:name "test user name" :age 30}))) And in the demo, https://github.com/tendant/graphql-clj-starter, the resolver function is (defn starter-resolver-fn [type-name field-name] (match/match [type-name field-name] ["Query" "hero"] (fn [context parent args] (get-hero (:episode args))) ["Query" "human"] (fn [context parent args] (get-human (str (get args "id" ["Query" "droid"] (fn [context parent args] (get-droid (str (get args "id" ["Query" "objectList"] (fn [context parent args] (repeat 3 {:id (java.util.UUID/randomUUID)})) ;; Hacky!!! Should use resolver for interface ["Human" "friends"] (fn [context parent args] (get-friends parent)) ["Droid" "friends"] (fn [context parent args] (get-friends parent)) ["Character" "friends"] (fn [context parent args] (get-friends parent)) ["Mutation" "createHuman"] (fn [context parent args] (create-human args)) :else nil)) I am confused about what arguments the resolver-fn should take. I see that it returns another function but where do the context, parent and args come from for this function. Any help would be much appreciated -- 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.
Changing value of atom vector using swap
I have (def data {:headers ["A" "B" "C" "D"] :rows [["1" "2" "3" "4"] ["5" "6" "7" "8"] ["9" "10" "11" "12"]]}) And I have a function (defn replace-value [struct] (clojure.walk/prewalk-replace {"3" "hello"} (struct :rows))) When I do (replace-value @data) > [["1" "2" "hello" "4"] ["5" "6" "7" "8"] ["9" "10" "11" "12"]] which is what I am expecting. However I want to achieve this same result using swap! So I tried #(swap! data (replace-value %)) but I get the error #object[user$eval1308$fn__1309 0x6caeefd7 "user$eval1308$fn__1309@6caeefd7"] I don't know what this error means nor how to resolve it -- 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.
Clojure.spec - Why should you use and when
Hello, I have recently watched Rich Hickeys talk at Cojure Conj 2016 (https://www.youtube.com/watch?v=oyLBGkS5ICk - here's the link in case anyone missed it) and although it was very interesting, I didn't really understand the point in Clojure.Spec or when you'd use it. It seemed like most of the ideas, such as conform, valid etc, had similar functions in Clojure already. I have only been learning clojure for around 3 months now so maybe this is due to lack of programming/Clojure experience. Thanks -- 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.
Re: Index of an element in a vector of vectors
Is there a way to generalise? I.e a function that allows you to swap any of the 1-9? On Wednesday, 7 December 2016 18:06:19 UTC, Andy- wrote: > > One option is to use keep-indexed: > > (first > (keep-indexed > (fn [i xs] > (first > (keep-indexed > (fn [j x] > (when (= x "5") > [i j])) > xs))) > players)) > > > > On Wednesday, December 7, 2016 at 5:32:10 PM UTC+1, Rickesh Bedia wrote: >> >> If I have >> >> (def players [["1" "2" "3"] ["4" "5" "6"] ["7" "8" "9"]]) >> >> How would I get the index of number 5? I think it should be [1 1] but >> don't know how to get this >> >> If it were more simple such as >> >> (def players ["1" "2" "3"]) >> >> I can get the index using >> >> (.indexOf players "2") > 1 >> (.indexOf players "3") > 2 >> >> -- 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.
Index of an element in a vector of vectors
If I have (def players [["1" "2" "3"] ["4" "5" "6"] ["7" "8" "9"]]) How would I get the index of number 5? I think it should be [1 1] but don't know how to get this If it were more simple such as (def players ["1" "2" "3"]) I can get the index using (.indexOf players "2") > 1 (.indexOf players "3") > 2 -- 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.
Re: Returning multiple values
Because the information is coming from a table I don't know if I can change it to look like that. The information from the table looks like {:people ({:name "John" :age 25} {:name "Harry" :age 23} {:name "Peter" :age 24})} I was wondering if you could apply (into [] (map (-> class1 :people) [:name :age])) to each of the {:name "Peter" :age "24"}, {:name "John" :age "25"}, {:name "Harry" :age "23"} and then put that into a vector so the final vector is in the form [["John" "25"] ["Harry" "23"] ["Peter" "24"]] On Wednesday, 30 November 2016 10:37:04 UTC, Colin Yates wrote: > > (def class1 {:people '({:name "John" :age "25"} {:name "Harry" :age > "23"} {:name "Peter" :age "24"})}) or (def class1 {:people [{:name > "John" :age "25"} {:name "Harry" :age "23"} {:name "Peter" :age > "24"}]}) is probably what you want. > > (mapv (juxt :name :age) (:people class1)) on either of those will give > you your result. > > On 30 November 2016 at 10:34, Colin Yates > wrote: > > Ah, I just realised people is _not_ a sequence of maps but the result > > of calling '{:name "John" :age "25"}' passing in the other two maps as > > arguments. You probably want a literal literal '({:name "John" :age > > "25"}.) or a vector [{:name "John" :age "25"}...] > > > > On 30 November 2016 at 10:29, Colin Yates > wrote: > >> (mapv (juxt :name :age) (:people class1)) should work > >> > >> On 30 November 2016 at 10:27, 'Rickesh Bedia' via Clojure > >> > wrote: > >>> I have a definition: > >>> (def class1 {:people ({:name "John" :age "25"} > >>> {:name "Harry" :age "23"} > >>> {:name "Peter" :age "24"})}) > >>> > >>> The result I want is a vector that looks like > >>> [["John" "25"] > >>> ["Harry" "23"] > >>> ["Peter" "24"]] > >>> > >>> If I call (map (-> class1 :people) [:name :age]) > >>> then I get the result ("Peter" "24"). Why do I only get the values > from the > >>> last hashmap and not the others? > >>> > >>> If I then call (into [] (map (-> class1 :people) [:name :age])) > >>> then I get the result ["Peter" "24"] > >>> > >>> What I need to do is run the 'into' function again on the other two > hashmaps > >>> and then put the 3 results into a vector but I don't know how to do > this. > >>> > >>> Any help would be much appreciated > >>> > >>> -- > >>> You received this message because you are subscribed to the Google > >>> Groups "Clojure" group. > >>> To post to this group, send email to clo...@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+u...@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+u...@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.
Returning multiple values
I have a definition: (def class1 {:people ({:name "John" :age "25"} {:name "Harry" :age "23"} {:name "Peter" :age "24"})}) The result I want is a vector that looks like [["John" "25"] ["Harry" "23"] ["Peter" "24"]] If I call (map (-> class1 :people) [:name :age]) then I get the result ("Peter" "24"). Why do I only get the values from the last hashmap and not the others? If I then call (into [] (map (-> class1 :people) [:name :age])) then I get the result ["Peter" "24"] What I need to do is run the 'into' function again on the other two hashmaps and then put the 3 results into a vector but I don't know how to do this. Any help would be much appreciated -- 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.
Re: Getting information from a hashmap that is inside anothe hashmap
That makes sense. Thanks for the help. Also say I wanted to get both eye-colour and hair-colour. Could that be done by (-> human2 :char [:eye-colour :hair-colour])? On Tuesday, 22 November 2016 11:08:45 UTC, Bost wrote: > > (->> human2 :char :eye-colour) or > (-> human2 :char :eye-colour) or > ((human2 :char) :eye-colour) or > (:eye-colour (:char human2)) all variants work. > > Either way it looks like you're asking a very basic question. > I recomend you to go over http://clojurekoans.com/ or read some > tutorial, quick start guide etc. > > > 2016-11-22 11:42 GMT+01:00 'Rickesh Bedia' via Clojure > >: > > Lets say I have: > > (def human {:firstname "John" :surname "Smith"}) > > To get the firstname I would run (human :firstname) and this would give > > "John" > > > > However if I now have > > (def human2 {:name "Bob" :char {:eye-colour "brown" :hair-colour > > "red"}}) > > how would I get the eye-colour? Would it be (human2 :char :eye-colour). > I > > just want the eye-colour > > > > Thanks in advance > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@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+u...@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+u...@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.
Re: Saving the value of an atom
When I put @car into my table the value doesn't show? On Wednesday, 23 November 2016 13:32:56 UTC, Alex Miller wrote: > > In what way does it not work? -- 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.
Saving the value of an atom
(defonce car (atom "")) (defn car-colour [ ] [:div [:div.container [:div.span12 [car-form car]]] [:div.container [:div.span12 "The car colour is: " @car]] ]) I have this function where you type in the make of a car and then this goes to a database and returns the colour of the car. Is there a way of getting the value of @car to use in another function? For example, to put the make of car and colour into a table. When I try to use @car in my table function it doesn't work. Also is there a way to save these values in the table so if I called the car-colour function on another make it would add that to the table as well -- 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.
Getting information from a hashmap that is inside anothe hashmap
Lets say I have: (def human {:firstname "John" :surname "Smith"}) To get the firstname I would run (human :firstname) and this would give "John" However if I now have (def human2 {:name "Bob" :char {:eye-colour "brown" :hair-colour "red"}}) how would I get the eye-colour? Would it be (human2 :char :eye-colour). I just want the eye-colour Thanks in advance -- 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.
Using a function in another function
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.
Clojure Web Applications for Beginner
Hi, I am fairly new to Clojure, only been learning about it for a around 2 months. I have mainly been spending my time learning through "Clojure for the Brave and True", Clojure Koans and 4Clojure. However, I have recently been reading about Clojure's use in creating Web Apps. I have been following "Web Development with Clojure" by Dmitri Sotnikov but I feel that it is still a bit too advanced for me at this time and a lot of the concepts and ideas are going over my head. Is there any other resources that anyone could recommend that would be closer to my current knowledge levels or would it be best to carry on with my current book? Thanks in advance. -- 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.
get function
Hi everyone, I am new to Clojure and have been playing around with it for a little while. I have seen that (get [3 2 1] 0) and ([[3 2 1] 0) both return the value 3. Similarly (get {:a 0 :b 1} :b) and ({:a 0 :b 1} :b) return 1. I was wondering if anyone could explain why the get function is useful or maybe an example? Apologies in advance if this question is due to ignorance and I haven't reached the level where this function is used. Thanks in advance -- 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.