mirror of
https://github.com/richardharrington/robotwar.git
synced 2024-10-12 06:23:41 +00:00
imported clojure.string/split and join
This commit is contained in:
parent
7337fa36cd
commit
0d8cb73924
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
(use '[clojure.core.match :only (match)])
|
(use '[clojure.core.match :only (match)])
|
||||||
(use '[clojure.set :only (union)])
|
(use '[clojure.set :only (union)])
|
||||||
|
(use '[clojure.string :only (split join)])
|
||||||
|
|
||||||
|
|
||||||
(def operators #{\= \< \> \# \+ \- \* \/})
|
(def operators #{\= \< \> \# \+ \- \* \/})
|
||||||
@ -50,7 +51,7 @@
|
|||||||
|
|
||||||
(defn lex
|
(defn lex
|
||||||
[src-code]
|
[src-code]
|
||||||
(mapcat lex-line (clojure.string/split src-code #"\n")))
|
(mapcat lex-line (split src-code #"\n")))
|
||||||
|
|
||||||
(defn str->int
|
(defn str->int
|
||||||
"Like Integer/parseInt, but returns nil on failure"
|
"Like Integer/parseInt, but returns nil on failure"
|
||||||
@ -99,7 +100,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn pretty-print-tokens [token-seq]
|
(defn pretty-print-tokens [token-seq]
|
||||||
(clojure.string/join
|
(join
|
||||||
"\n"
|
"\n"
|
||||||
(map #(format "%2d %s %s" (:pos %) (:type %) (:val %))
|
(map #(format "%2d %s %s" (:pos %) (:type %) (:val %))
|
||||||
token-seq)))
|
token-seq)))
|
||||||
|
Loading…
Reference in New Issue
Block a user