タグのコレクションの xml から 1 つのタグのコンテンツを抽出する関数を適用しようとしています。基本的に、このようにxmlからコンテンツを抽出する関数を作成しようとしています
(defn get-events
[xz]
(map (juxt
#(zf/xml1-> % :title zf/text)
#(zf/xml1-> % :performers :performer :name zf/text)
#(zf/xml1-> % :start_time zf/text)
#(zf/xml1-> % :stop_time zf/text))
(zf/xml-> xz :events :event)))
そして、これまでの私の解決策は次のようになります
(ns datamodel
(:use
[net.cgrand.enlive-html :as en-html ])
(:require
[clojure.zip :as z]
[clojure.xml :as xml ]
[clojure.data.zip.xml :as zf]
[clojure.java.io :as io]
))
(def data-url "http://api.eventful.com/rest/events/search? app_key=4H4Vff4PdrTGp3vV&keywords=music&location=Belgrade&date=Future")
(defn xz [url](z/xml-zip (xml/parse url)))
(defn xml-zipper [& tags](zf/xml-> (xz data-url) tags))
(defn func [& tags]#(zf/xml1-> (xml-zipper tags) % zf/text))
(def tags [:title :venue_name])
そしてREPLで、このようなタグに func を適用しようとすると
(map #((apply comp (reverse( func :events :event))) %) tags)
空のコレクション () を取得します。