Change literals map to vector of vectors
This commit is contained in:
parent
1698c51194
commit
62fc20f8e7
@ -113,21 +113,21 @@
|
|||||||
;; :integer. Otherwise, return nil"
|
;; :integer. Otherwise, return nil"
|
||||||
(defn get-literal-type
|
(defn get-literal-type
|
||||||
[data]
|
[data]
|
||||||
(let [literals {:boolean (fn [thing] (or (true? thing) (false? thing)))
|
(let [literals [[:boolean (fn [thing] (or (true? thing) (false? thing)))]
|
||||||
:char char?
|
[:integer integer?]
|
||||||
:float float?
|
[:float float?]
|
||||||
:integer integer?
|
[:string string?]
|
||||||
:string string?
|
[:char char?]
|
||||||
:vector_boolean (fn [thing] (and (vector? thing)
|
[:vector_boolean (fn [thing] (and (vector? thing)
|
||||||
(or (true? (first thing))
|
(or (true? (first thing))
|
||||||
(false? (first thing)))))
|
(false? (first thing)))))]
|
||||||
:vector_float (fn [thing] (and (vector? thing)
|
[:vector_float (fn [thing] (and (vector? thing)
|
||||||
(float? (first thing))))
|
(float? (first thing))))]
|
||||||
:vector_integer (fn [thing] (and (vector? thing)
|
[:vector_integer (fn [thing] (and (vector? thing)
|
||||||
(integer? (first thing))))
|
(integer? (first thing))))]
|
||||||
:vector_string (fn [thing] (and (vector? thing)
|
[:vector_string (fn [thing] (and (vector? thing)
|
||||||
(string? (first thing))))
|
(string? (first thing))))]
|
||||||
:generic-vector (fn [thing] (= [] thing))}]
|
[:generic-vector (fn [thing] (= [] thing))]]]
|
||||||
(first (for [[stack function] literals
|
(first (for [[stack function] literals
|
||||||
:when (function data)]
|
:when (function data)]
|
||||||
stack))))
|
stack))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user