2
나는이 목록에서 요소를 결합 할
에서 요소를 결합하는 방법, 내 프로그램이두 목록
(ns datamodel
(:use
[net.cgrand.enlive-html :as en-html ])
(:require
[clojure.zip :as z]
[clojure.data.zip.xml :only (attr text xml->) :as xz]
[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 map-tags-contents [url & tags]
(map #(hash-map % (keyword (last tags)))
(mapcat (comp :content z/node)
(apply xz/xml->
(-> url xml/parse z/xml-zip)
(for [t tags]
(zf/tag= t)
)))))
(def titles (map-tags-contents data-url :events :event :title))
(def descriptions (map-tags-contents data-url :events :event :description))
(defn create-map [](for [el1 titles
el2 descriptions] (into {} (conj el1 el2))))
처럼 보인다하지만 목록에서지도를 결과로 만들 맵을 호출 할 때 복제됩니다. 나는 요소들이 결합 될 방법을 말하지 않았기 때문에 데카르트 조인 (Cartesian join)을 얻었 음을 알 수 있습니다. 그리고, 두 번째 요소 첫 번째지도에서와 두 번째 두 번째지도에서, 등등 ...
감사합니다. 그래서 (지도 제목 설명을지도해야합니다) – Vesna