1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
; 這裡竟然支援 Clojure,不過還是不支援 Falcon @.@

; $代表全域是因為從 Ruby Port 來的 @.@
(def $hash (ref {}))

; 讀檔要用 BufferedReader 還是沒那咩好用 @.@
; 不然就要用它的 duck-stream
(with-open [file (java.io.BufferedReader. (java.io.FileReader. "2.mmjoblist.sql"))]
  (doseq [line (line-seq file)]
    ; REGEX 也沒 Ruby 的直覺 :QQ 另外 $1 也是學 Ruby 的。
    (when-let [$1 (second (re-find #"'FM', (\d+)," line))]
      (if (get @$hash $1)
        (println $1)
      ;else
        (dosync (commute $hash assoc $1 true))))))