Re: (pprint template) gives me an exception
Most probably, your template is a lazy seq and pprint forces its evaluation, which is why the error happens at the pprint point. On 17 April 2013 08:33, Tassilo Horn wrote: > larry google groups writes: > >> (println (pp/pprint template)) > > Aside from the original problem: pprint already prints to *out* and only > returns nil, so the code above first prints template, and then the > println will also print the nil returned from pprint. > > Bye, > Tassilo > > -- > -- > 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/groups/opt_out. > > -- -- 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/groups/opt_out.
Re: (pprint template) gives me an exception
larry google groups writes: > (println (pp/pprint template)) Aside from the original problem: pprint already prints to *out* and only returns nil, so the code above first prints template, and then the println will also print the nil returned from pprint. Bye, Tassilo -- -- 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/groups/opt_out.
Re: (pprint template) gives me an exception
Oh, I see. I had just changed :admin-text to hold a keyword instead of text. I should have seen that sooner. But I am still confused why a keyword would cause pprint to throw an exception. And why at that point in the code, and not sooner? On Apr 16, 10:05 am, larry google groups wrote: > The function before the previously mentioned function is this: > > (defn add-public-text-to-top-banner-and-return-as-new-template > [template item] > (println "entering add-public-text-to-top-banner-and-return-as-new- > template") > (println (pp/pprint template)) > (enlive/transform template [:#content :> :h1 :span] (enlive/content > (:admin-text item > > I am not clear why this kills the template, but it seems to. Here, > pprint works and shows the Enlive nodes. But in the next function I > get an exception. > > On Apr 16, 9:59 am, larry google groups > wrote: > > > > > > > > > On the first pprint expression in this function, I get an exception: > > > (defn add-main-image-for-this-item-and-return-as-new-template > > [template item] > > > (println " start of add-main-image-for-this-item-and-return-as-new- > > template") > > > (println (pp/pprint template)) > > (println "add-main-image-for-this-item-and-return-as-new-template") > > (let [final-template (if-not (nil? (:filename item)) > > (enlive/transform template [:#main-image-for- > > this-item] (enlive/html-content (str ""))) > > template)] > > (println (pp/pprint final-template)) > > (println " leaving add-main-image-for-this-item-and-return-as- > > new-template") > > final-template)) > > > The exception is: > > > start of add-main-image-for-this-item-and-return-as-new-template > > 2013-04-16 09:54:23.536:WARN:oejs.AbstractHttpConnection:/admin/edit/ > > planners/summer-camp3804946 > > java.lang.IllegalArgumentException: Don't know how to create ISeq > > from: clojure.lang.Keyword > > at clojure.lang.RT.seqFrom(RT.java:494) > > at clojure.lang.RT.seq(RT.java:475) > > > Why would anything blow up on pprint? I thought pprint could handle > > anything? -- -- 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/groups/opt_out.
Re: (pprint template) gives me an exception
The function before the previously mentioned function is this: (defn add-public-text-to-top-banner-and-return-as-new-template [template item] (println "entering add-public-text-to-top-banner-and-return-as-new- template") (println (pp/pprint template)) (enlive/transform template [:#content :> :h1 :span] (enlive/content (:admin-text item I am not clear why this kills the template, but it seems to. Here, pprint works and shows the Enlive nodes. But in the next function I get an exception. On Apr 16, 9:59 am, larry google groups wrote: > On the first pprint expression in this function, I get an exception: > > (defn add-main-image-for-this-item-and-return-as-new-template > [template item] > > (println " start of add-main-image-for-this-item-and-return-as-new- > template") > > (println (pp/pprint template)) > (println "add-main-image-for-this-item-and-return-as-new-template") > (let [final-template (if-not (nil? (:filename item)) > (enlive/transform template [:#main-image-for- > this-item] (enlive/html-content (str ""))) > template)] > (println (pp/pprint final-template)) > (println " leaving add-main-image-for-this-item-and-return-as- > new-template") > final-template)) > > The exception is: > > start of add-main-image-for-this-item-and-return-as-new-template > 2013-04-16 09:54:23.536:WARN:oejs.AbstractHttpConnection:/admin/edit/ > planners/summer-camp3804946 > java.lang.IllegalArgumentException: Don't know how to create ISeq > from: clojure.lang.Keyword > at clojure.lang.RT.seqFrom(RT.java:494) > at clojure.lang.RT.seq(RT.java:475) > > Why would anything blow up on pprint? I thought pprint could handle > anything? -- -- 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/groups/opt_out.
(pprint template) gives me an exception
On the first pprint expression in this function, I get an exception: (defn add-main-image-for-this-item-and-return-as-new-template [template item] (println " start of add-main-image-for-this-item-and-return-as-new- template") (println (pp/pprint template)) (println "add-main-image-for-this-item-and-return-as-new-template") (let [final-template (if-not (nil? (:filename item)) (enlive/transform template [:#main-image-for- this-item] (enlive/html-content (str ""))) template)] (println (pp/pprint final-template)) (println " leaving add-main-image-for-this-item-and-return-as- new-template") final-template)) The exception is: start of add-main-image-for-this-item-and-return-as-new-template 2013-04-16 09:54:23.536:WARN:oejs.AbstractHttpConnection:/admin/edit/ planners/summer-camp3804946 java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword at clojure.lang.RT.seqFrom(RT.java:494) at clojure.lang.RT.seq(RT.java:475) Why would anything blow up on pprint? I thought pprint could handle anything? -- -- 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/groups/opt_out.