clojure学习点滴


1 IDE工具 light table

2 log日志  tlog/core.clj

  (ns tlog.core  "Logging setup"
  (require [ clj-logging-config.log4j :as log-config]
           [ clojure.tools.logging :as log])
  )
(defn t01 []
  (log-config/set-logger! :level :debug
                        :out (org.apache.log4j.FileAppender.
                              (org.apache.log4j.EnhancedPatternLayout. org.apache.log4j.EnhancedPatternLayout/TTCC_CONVERSION_PATTERN)
                              "logs/foo.log"
                              true))
  (log/info "This is a test log message.")
  (log/error "测试.")
  )
(defn -main [& args]
   (t01)
  )

:dependencies

 [log4j/log4j "1.2.16" :exclusions [javax.mail/mail javax.jms/jms com.sun.jdmk/jmxtools com.sun.jmx/jmxri]]
                 [org.slf4j/slf4j-log4j12 "1.6.4"]
                 [org.clojure/tools.logging "0.2.6"]
                 [ clj-logging-config "1.9.7"]

3 xml操作 tlog/txml.clj

(ns example
  (:use [clojure.data.zip.xml :only (attr text xml->)]) ; dep: see below
  (:require [clojure.xml :as xml]
            [clojure.zip :as zip]))


(def xml (xml/parse "../webservice/myfile.xml"))
(def zipped (zip/xml-zip xml))
(xml-> zipped :track :name text)       ; ("Track one" "Track two")
(xml-> zipped :track (attr :id))       ; ("t1" "t2")

:dependencies

[org.clojure/data.zip "0.1.1"]

你可能感兴趣的:(clojure学习点滴)