锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲伦乱亚洲h视频,亚洲欧洲久久av,亚洲情A成黄在线观看动漫软件 http://www.tkk7.com/chaocai/category/52793.htmlzh-cnMon, 26 Nov 2012 07:17:44 GMTMon, 26 Nov 2012 07:17:44 GMT60The Clojure Program To solve N Queens Problem (Without back tracing)http://www.tkk7.com/chaocai/archive/2012/11/26/Clojure.html瓚呰秺宸呭嘲瓚呰秺宸呭嘲Mon, 26 Nov 2012 04:21:00 GMThttp://www.tkk7.com/chaocai/archive/2012/11/26/Clojure.htmlhttp://www.tkk7.com/chaocai/comments/391968.htmlhttp://www.tkk7.com/chaocai/archive/2012/11/26/Clojure.html#Feedback0http://www.tkk7.com/chaocai/comments/commentRss/391968.htmlhttp://www.tkk7.com/chaocai/services/trackbacks/391968.htmlThe following solution not using the back tracing way is more concise and readable, but for the searching space becomes huger, the performance is much worser then the previous one.

(ns SICP.unit3)
(defn conflictInCol? [s col]
  (some #(= col %) s)
)

(defn conflictInDia? [s col]
  (let [dia (count s)
        n1 (fn [c
] (Math/abs (- dia (.indexOf s c))))
        n2 (fn [c] (Math/abs (- col c)))]
    (some #(= (n1 %) (n2 %)) s)
  )
)

(defn safe? [s col] 
  (not (or (conflictInCol? s col) (conflictInDia? s col)))
)
  
(defn next-level-queens [solutions-for-prev-level board-size current-level]
  (let [solutions (atom [])]
    (doseq [s solutions-for-prev-level]
      (doseq [col (range 0 board-size)]
        (if (safe? s col)
          (reset! solutions (cons (conj s col) @solutions))
     
        )
       )
   
    )
   
      (if (< current-level (dec board-size))
        (recur @solutions board-size (inc current-level))
        (count @solutions)
      )
   )
)

(defn queens [board-size]
  (next-level-queens  (apply vector (map #(vector %) (range 0 board-size))) board-size 1)
)

Chao Cai (钄¤秴錛?br />Sr. SDE
Amazon


 

]]>
Clojure XPathhttp://www.tkk7.com/chaocai/archive/2012/10/15/ClojureXPath.html瓚呰秺宸呭嘲瓚呰秺宸呭嘲Mon, 15 Oct 2012 02:15:00 GMThttp://www.tkk7.com/chaocai/archive/2012/10/15/ClojureXPath.htmlhttp://www.tkk7.com/chaocai/comments/389555.htmlhttp://www.tkk7.com/chaocai/archive/2012/10/15/ClojureXPath.html#Feedback0http://www.tkk7.com/chaocai/comments/commentRss/389555.htmlhttp://www.tkk7.com/chaocai/services/trackbacks/389555.html
The functions to support using XPath in Clojure.

Source Code

 1 ;The code was implemented by caichao@amazon.com
 2 ;You could use the code anyway, but should keep the comments
 3 ;Created 2012.10
 4 (ns clojure.ccsoft.xml
 5   (:require [clojure.xml :as xml]))
 6  
 7 (import '(java.io StringReader)
 8         '(java.io ByteArrayInputStream))
 9  
10 (defn xml-structure [xml-txt] 
11    [ (xml/parse (-> xml-txt
12               (.getBytes)
13               (ByteArrayInputStream.)
14      )
15     )]
16 )
17  
18 (defn node [tag xmlStruct]
19  
20   (first (filter #(= (:tag %) tag) (:content xmlStruct)))
21 )
22  
23 (defn node [path xml-txt]
24    (loop [path path 
25           xml-content (xml-structure xml-txt) 
26           ]
27       (let [current-tag (first path) current-elem (first xml-content)]
28         (if (= (:tag current-elem ) current-tag)
29  
30           (if (= (count path) 1)
31             current-elem 
32             (recur  (rest path) (:content current-elem ))
33           )
34           (if (> (count  xml-content) 1)
35            (recur path  (rest xml-content))
36           )
37         )
38      )
39     )
40  )

How to Use

(def cmd-example "<command>
                   <header>
                     
<type>script</type>
                     
<transaction_id>12345</transaction_id>
                   
</header>
                   
<body>
                      println 
3+4;
                   
</body>
                  
</command>")
 
 
(node [:command :header :transaction_id] cmd
-example)




]]>
主站蜘蛛池模板: 亚洲男人第一av网站| 国产精品免费播放| 亚洲国产精品久久久天堂| 一级成人毛片免费观看| 国产成人免费永久播放视频平台| 亚洲一日韩欧美中文字幕在线| 免费精品人在线二线三线区别| 亚洲美女中文字幕| 日本在线高清免费爱做网站| 久久精品国产亚洲αv忘忧草| 青青草免费在线视频| 色婷婷亚洲一区二区三区| 免费一看一级毛片人| 一本岛v免费不卡一二三区| 亚洲精品中文字幕无码蜜桃| 久久亚洲免费视频| 亚洲日韩乱码中文无码蜜桃 | 啦啦啦完整版免费视频在线观看 | 亚洲国产精品综合福利专区| 亚洲黄色免费在线观看| 亚洲AV无码乱码在线观看代蜜桃 | 亚洲欧美日韩中文无线码| 无码国产亚洲日韩国精品视频一区二区三区| 亚洲成av人片在www鸭子| 亚洲成av人片在线观看天堂无码 | 狠狠色香婷婷久久亚洲精品| 女人张腿给男人桶视频免费版 | 亚洲一二成人精品区| 免费福利视频导航| 亚洲国产成人无码AV在线影院| 亚洲精品乱码久久久久久蜜桃| 人妻在线日韩免费视频| 亚洲伊人久久大香线蕉影院| 国产免费一区二区三区VR| 国产一级黄片儿免费看| 亚洲AV色吊丝无码| 亚洲一区二区三区在线观看精品中文| 99爱视频99爱在线观看免费| 香蕉视频亚洲一级| 久久亚洲AV成人无码国产| 国产又大又粗又硬又长免费|