Permalink
Browse files

move some basic predicates higher up

  • Loading branch information...
1 parent 893d5ee commit 4f74bd48e1ab27833503a45d98e8c7f5dc41521b @swannodette swannodette committed May 4, 2013
Showing with 17 additions and 21 deletions.
  1. +17 −21 src/cljs/cljs/core.cljs
@@ -59,10 +59,17 @@
(defn ^boolean array? [x]
(cljs.core/array? x))
+(defn ^boolean number? [n]
+ (cljs.core/number? n))
+
(defn ^boolean not
"Returns true if x is logical false, false otherwise."
[x] (if x false true))
+(defn ^boolean string? [x]
+ (and ^boolean (goog/isString x)
+ (not (identical? (.charAt x 0) \uFDD0))))
+
(set! *unchecked-if* true)
(defn ^boolean type_satisfies_
"Internal - do not use!"
@@ -328,7 +335,13 @@
;;;;;;;;;;;;;;;;;;; symbols ;;;;;;;;;;;;;;;
-(declare list instance? symbol? hash-combine hash)
+(declare list hash-combine hash Symbol)
+
+(defn ^boolean instance? [t o]
+ (cljs.core/instance? t o))
+
+(defn ^boolean symbol? [x]
+ (instance? Symbol x))
(deftype Symbol [ns name str ^:mutable _hash _meta]
Object
@@ -373,11 +386,7 @@
;;;;;;;;;;;;;;;;;;; fundamentals ;;;;;;;;;;;;;;;
-(declare array-seq prim-seq keyword? IndexedSeq)
-
-(defn ^boolean string? [x]
- (and ^boolean (goog/isString x)
- (not (identical? (.charAt x 0) \uFDD0))))
+(declare array-seq prim-seq IndexedSeq)
(defn ^seq seq
"Returns a seq on the collection. If the collection is
@@ -444,9 +453,6 @@
(= y (first more)))
false)))
-(defn ^boolean instance? [t o]
- (cljs.core/instance? t o))
-
;;;;;;;;;;;;;;;;;;; protocols on primitives ;;;;;;;;
(declare hash-map list equiv-sequential)
@@ -914,7 +920,8 @@ reduces them without incurring seq initialization"
(recur ret (first ks) (next ks))
ret))))
-(declare fn?)
+(defn ^boolean fn? [f]
+ (or ^boolean (goog/isFunction f) (satisfies? Fn f)))
(defn with-meta
"Returns an object of the same type and value as obj, with
@@ -971,8 +978,6 @@ reduces them without incurring seq initialization"
(set! string-hash-cache-count (inc string-hash-cache-count))
h))
-(declare number?)
-
(defn check-string-hash-cache [k]
(when (> string-hash-cache-count 255)
(set! string-hash-cache (js-obj))
@@ -1104,15 +1109,6 @@ reduces them without incurring seq initialization"
(and ^boolean (goog/isString x)
(identical? (.charAt x 0) \uFDD0)))
-(defn ^boolean symbol? [x]
- (instance? Symbol x))
-
-(defn ^boolean number? [n]
- (cljs.core/number? n))
-
-(defn ^boolean fn? [f]
- (or ^boolean (goog/isFunction f) (satisfies? Fn f)))
-
(defn ^boolean ifn? [f]
(or (fn? f) (satisfies? IFn f)))

0 comments on commit 4f74bd4

Please sign in to comment.