I have a function which at this point only amounts to a print line:
(defn add-rows-of-choices-for-a-given-type-and-return-new-template
[template item-type-as-string sequence-of-items]
(pp/pprint sequence-of-items)
;; (let [inner-template-of-rows-showing-options-for-this-type-of-item
(enlive/html-resource "templates/rows_of_options.html")
;; inner-template (enlive/select
inner-template-of-rows-showing-options-for-this-type-of-item
[:#list_all_of_type_inner_rows_and_options])
;; inner-template-transformed (enlive/transform inner-template
[:.row_of_choices]
;; (enlive/clone-for
[one-map-of-this-type sequence-of-items]
;;
[:li :h2]
;;
(enlive/content (:public-text one-map-of-this-type))
;;
[:li.edit_button :a]
;;
(enlive/set-attr :href (str "/admin/edit/" item-type-as-string "/"
(correct/transform-keyword-into-string (:item-name one-map-of-this-type))))
;;
[:li.preview_button :a]
;;
(enlive/set-attr :href (str "/admin/preview/" item-type-as-string"/"
(correct/transform-keyword-into-string (:item-name one-map-of-this-type))))
;;
[:li.delete_button :a]
;;
(enlive/set-attr :href (str "/admin/delete/" item-type-as-string "/"
(correct/transform-keyword-into-string (:item-name one-map-of-this-type))))
;;
[:li.clone_button :a]
;;
(enlive/set-attr :href (str "/admin/clone/" item-type-as-string "/"
(correct/transform-keyword-into-string (:item-name
one-map-of-this-type))))))
;; final-template (enlive/transform template
[:#rows-of-choices-for-a-given-type] (enlive/content
inner-template-transformed))]
;; final-template
;; )
)
I get this error:
java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be
cast to java.util.Map$Entry
at clojure.lang.APersistentMap$ValSeq.first(APersistentMap.java:174)
at clojure.lang.RT.first(RT.java:566)
at clojure.core$first.invoke(core.clj:55)
at clojure.pprint$pprint_reader_macro.invoke(dispatch.clj:50)
at clojure.pprint$pprint_list.invoke(dispatch.clj:77)
at clojure.lang.MultiFn.invoke(MultiFn.java:163)
at clojure.pprint$write_out.invoke(pprint_base.clj:194)
at clojure.pprint$pprint$fn__7359.invoke(pprint_base.clj:250)
at clojure.pprint$pprint.invoke(pprint_base.clj:248)
at clojure.pprint$pprint.invoke(pprint_base.clj:245)
at
kiosks_clojure.admin$add_rows_of_choices_for_a_given_type_and_return_new_template.invoke(admin.clj:28)
at kiosks_clojure.admin$render_all_of_this_type.invoke(admin.clj:222)
at
kiosks_clojure.admin$render_the_template_that_lists_all_items_of_this_type.invoke(admin.clj:234)
The function that feeds data to this function returns this:
return value from
transform-seq-of-items-filter-out-any-that-are-scheduled-to-be-deleted
[{:per-page-form-cache {:per-page-banner-title "What kind of performing
arts?", :html-input "<select id='answer-input' name='answer'> <option
value='choose'>Choose</option><option
value='performing-arts-followup-dance'>Dance</option><option
value='performing-arts-followup-theater'>Theater</option><option
value='performing-arts-followup-music'>Music</option><option
value='performing-arts-followup-all-kinds'>All kinds</option></select>"},
:slides-styles " #supporting_and_explanatory_illustration {
background-image: url('/img/camp_planner_the_sun_is_shining.png') } ",
:public-text "What kind of performing arts?", :multiple false, :planners-id
:summer-camp, :item-name :performing-arts-followup, :item-image
"camp_planner_the_sun_is_shining.png", :children-type :answers}
{:per-page-form-cache {:per-page-banner-title "What type of camp? ",
:html-input "<select id='answer-input' name='answer'> <option
value='choose'>Choose</option><option
value='what-type-of-camp-daycamp-academic'>Academic</option><option
value='what-type-of-camp-daycamp-art'>Art</option><option
value='what-type-of-camp-daycamp-performing-arts'>Performing
Arts</option><option
value='what-type-of-camp-daycamp-sports'>Sports</option><option
value='what-type-of-camp-daycamp-general-interest'>General
interest</option><option
value='what-type-of-camp-daycamp-special-interest'>Special
interest</option><option
value='what-type-of-camp-daycamp-special-needs'>Special
needs</option></select>"}, :slides-styles "
#supporting_and_explanatory_illustration { background-image:
url('/img/camp_planner_the_sun_is_shining.png') } ", :public-text "What
type of camp? ", :multiple false, :planners-id :summer-camp, :item-name
:what-type-of-camp-daycamp, :item-image
"camp_planner_the_sun_is_shining.png", :children-type :answers}
{:per-page-form-cache {:per-page-banner-title "What's your budget? ",
:html-input "<select id='answer-input' name='answer'> <option
value='choose'>Choose</option><option
value='what-s-your-budget-sleepaway-one-dollar-signs'>$</option><option
value='what-s-your-budget-sleepaway-two-dollar-signs'>$$</option><option
value='what-s-your-budget-sleepaway-three-dollar-signs'>$$$</option><option
value='what-s-your-budget-sleepaway-four-dollar-signs'>$$$$</option></select>"},
:slides-styles " #supporting_and_explanatory_illustration {
background-image: url('/img/camp_planner_dollar_signs.png') } ",
:public-text "What's your budget? ", :multiple false, :planners-id
:summer-camp, :item-name :what-s-your-budget-sleepaway, :item-image
"camp_planner_dollar_signs.png", :children-type :answers}
{:per-page-form-cache {:per-page-banner-title "What kind of camp do you
want?", :html-input "<select id='answer-input' name='answer'> <option
value='choose'>Choose</option><option value='start-day-camps'>Day
camps</option><option value='start-sleepaway-camps'>Sleepaway
camps</option></select>"}, :slides-styles "
#supporting_and_explanatory_illustration { background-image:
url('/img/camp_plannner_pencil_and_brush_art_supplies.png') } ",
:public-text "What kind of camp do you want?", :multiple false,
:planners-id :summer-camp, :item-name :start, :item-image
"camp_plannner_pencil_and_brush_art_supplies.png", :children-type :answers}
{:per-page-form-cache {:per-page-banner-title "Click submit to see
results", :html-input "<select id='answer-input' name='answer'> <option
value='choose'>Choose</option><option
value='final-page-final-answer'></option></select>"}, :slides-styles "
#span-with-html-form-input-for-question-and-answer { display: none; } \n
#finalized-link { display: block; } \n ", :public-text "Click submit to
see results", :planners-id :summer-camp, :item-name :final-page,
:item-image "", :children-type :answers} {:per-page-form-cache
{:per-page-banner-title "What type of camp? ", :html-input "<select
id='answer-input' name='answer'> <option
value='choose'>Choose</option><option
value='what-type-of-camp-sleepaway-active'>Active</option><option
value='what-type-of-camp-sleepaway-general-interest'>General
interest</option><option
value='what-type-of-camp-sleepaway-special-interest'>Special
interest</option></select>"}, :slides-styles "
#supporting_and_explanatory_illustration { background-image:
url('/img/camp_planner_the_sun_is_shining.png') } ", :public-text "What
type of camp? ", :multiple false, :planners-id :summer-camp, :item-name
:what-type-of-camp-sleepaway, :item-image
"camp_planner_the_sun_is_shining.png", :children-type :answers}
{:per-page-form-cache {:per-page-banner-title "What's your budget? ",
:html-input "<select id='answer-input' name='answer'> <option
value='choose'>Choose</option><option
value='what-s-your-budget-daycamp-one-dollar-signs'>$</option><option
value='what-s-your-budget-daycamp-two-dollar-signs'>$$</option><option
value='what-s-your-budget-daycamp-three-dollar-signs'>$$$</option><option
value='what-s-your-budget-daycamp-four-dollar-signs'>$$$$</option></select>"},
:slides-styles " #supporting_and_explanatory_illustration {
background-image: url('/img/camp_planner_dollar_signs.png') } ",
:public-text "What's your budget? ", :multiple false, :planners-id
:summer-camp, :item-name :what-s-your-budget-daycamp, :item-image
"camp_planner_dollar_signs.png", :children-type :answers}
{:per-page-form-cache {:per-page-banner-title "What location do you want?
", :html-input "<select id='answer-input' name='answer'> <option
value='choose'>Choose</option><option
value='what-location-do-you-want-daycamp-manhattan'>Manhattan</option><option
value='what-location-do-you-want-daycamp-brooklyn'>Brooklyn</option><option
value='what-location-do-you-want-daycamp-bronx'>Bronx</option><option
value='what-location-do-you-want-daycamp-queens'>Queens</option><option
value='what-location-do-you-want-daycamp-staten-island'>Staten
Island</option><option
value='what-location-do-you-want-daycamp-city-wide'>City-wide</option></select>"},
:slides-styles " #supporting_and_explanatory_illustration {
background-image: url('/img/camp_planner_manhattan_skyline.png') } ",
:public-text "What location do you want? ", :multiple false, :planners-id
:summer-camp, :item-name :what-location-do-you-want-daycamp, :item-image
"camp_planner_manhattan_skyline.png", :children-type :answers}
{:per-page-form-cache {:per-page-banner-title "Who's going to camp? ",
:html-input "<select id='answer-input' name='answer'> <option
value='choose'>Choose</option><option
value='who-s-going-to-camp-sleepaway-kid'>Kid</option><option
value='who-s-going-to-camp-sleepaway-tween'>Tween</option><option
value='who-s-going-to-camp-sleepaway-teen'>Teen</option></select>"},
:slides-styles " #supporting_and_explanatory_illustration {
background-image:
url('/img/camp_planner_two_children_smiling_or_mom_with_child_smiling.png')
} ", :public-text "Who's going to camp? ", :multiple false, :planners-id
:summer-camp, :item-name :who-s-going-to-camp-sleepaway, :item-image
"camp_planner_two_children_smiling_or_mom_with_child_smiling.png",
:children-type :answers} {:per-page-form-cache {:per-page-banner-title
"Who's going to camp? ", :html-input "<select id='answer-input'
name='answer'> <option value='choose'>Choose</option><option
value='who-s-going-to-camp-daycamp-preschool'>Preschool</option><option
value='who-s-going-to-camp-daycamp-kid'>Kid</option><option
value='tween'>Tween</option><option
value='who-s-going-to-camp-daycamp-teen'>Teen</option></select>"},
:slides-styles " #supporting_and_explanatory_illustration {
background-image:
url('/img/camp_planner_two_children_smiling_or_mom_with_child_smiling.png')
} ", :public-text "Who's going to camp? ", :multiple false, :planners-id
:summer-camp, :item-name :who-s-going-to-camp-daycamp, :item-image
"camp_planner_two_children_smiling_or_mom_with_child_smiling.png",
:children-type :answers} {:per-page-form-cache {:per-page-banner-title
"What kind of sports?", :html-input "<select id='answer-input'
name='answer'> <option value='choose'>Choose</option><option
value='sports-followup-basketball'>Basketball</option><option
value='sports-followup-baseball'>Baseball</option><option
value='sports-followup-fencing'>Fencing</option><option
value='sports-followup-gymnastics'>Gymnastics</option><option
value='sports-followup-horseback-riding'>Horseback riding</option><option
value='sports-followup-martial-arts'>Martial arts</option><option
value='sports-followup-soccer'>Soccer</option><option
value='sports-followup-swimming'>Swimming</option><option
value='sports-followup-tennis'>Tennis</option><option
value='sports-followup-yoga'>Yoga</option><option
value='sports-followup-all-sports'>All sports</option></select>"},
:slides-styles " #supporting_and_explanatory_illustration {
background-image: url('/img/camp_planner_basketball_and_sports.png') } ",
:public-text "What kind of sports?", :multiple false, :planners-id
:summer-camp, :item-name :sports-followup, :item-image
"camp_planner_basketball_and_sports.png", :children-type :answers}]
Can anyone suggest why pprint is unable to show whatever is being passed
into the function?
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.