1
(defn GetValuesFromWhereCommand
"return a list of values from Where command"
[Query tableName]
(let [values (re-seq #"[0-9a-zA-Z_=<>]+" ((re-find #"WHERE(.*)" Query) 1))
bitwise (re-find #"AND|OR" Query)
tempList (ref #{})
]
; first loop will look for the operators = < >
(doseq [item values]
(let [result (case (re-find #"[=><]" item)
"=" (GetRowsfromCondition tableName item =)
"<" (GetRowsfromCondition tableName item <)
">" (GetRowsfromCondition tableName item >)
nil (println "nothing")
)]
(when (not= nil result) (dosync (alter tempList conj result)))
tempList)
)
(println tempList)
tempList) ; get the Where from Update ','
)
這裏是我的輸出。Clojure和/或集合
#<[email protected]: #{#<[email protected]: #{0}> #<[email protected]: #{0 1}>}>
我想提出實施和操作,將返回#{0}
和或將返回#{0 1}。
我的問題是如何訪問我創建的列表。出於某種原因,我無法使用union/intersection。