seq? sequential? coll?
ã³ã¬ã¯ã·ã§ã³ã£ã½ããã¼ã¿æ§é ã«ãããã¦ãããããã©ããªãã調ã¹ã¦ã¿ãã
çµæ
seq? | sequential? | coll? | |
---|---|---|---|
Javaé
å (int-array 2) |
false | false | false |
æåå "12" |
false | false | false |
ã»ãã #{1 2} |
false | false | true |
ããã {:a 1 :b 2} |
false | false | true |
ãã¯ã¿ [1 2] |
false | true | true |
ãªã¹ã '(1 2) |
true | true | true |
é
延ã·ã¼ã±ã³ã¹ (lazy-seq [1 2]) |
true | true | true |
- javaé åã¨æååã¯ãã©ãã«ã該å½ããªãã
- ãªã¹ãã¨é 延ãªã¹ãã¯ãå ¨ã¦ã«è©²å½ããã
- ãããã¨ã»ããã¯ãcoll?ã«è©²å½ããããseq? ã sequential? ã«ã¯è©²å½ããªãã
- ãã¯ã¿ã¯ãcoll?ã¨sequential?ã«è©²å½ããããseq? ã«ã¯è©²å½ããªãã
ãã«ãã¡ã½ããæ¸ãã¨ãã«æ³¨æãå¿ è¦ã§ããã
ã¡ãªã¿ã«ã½ã¼ã¹ã³ã¼ãã¯
ãããããããªã§ããã
;; clojure 1.1.0 (def seq? (fn seq? [x] (instance? clojure.lang.ISeq x))) (defn sequential? [coll] (instance? clojure.lang.Sequential coll)) (defn coll? [x] (instance? clojure.lang.IPersistentCollection x))