Merge branch 'string-cast' of https://github.com/Willyfrog/hy into Willyfrog-string-cast
This commit is contained in:
commit
f0a9149383
|
@ -175,6 +175,12 @@
|
||||||
"Return second item from `coll`"
|
"Return second item from `coll`"
|
||||||
(get coll 1))
|
(get coll 1))
|
||||||
|
|
||||||
|
(defn string [x]
|
||||||
|
"Cast x as current string implementation"
|
||||||
|
(if-python2
|
||||||
|
(unicode x)
|
||||||
|
(str x)))
|
||||||
|
|
||||||
(defn string? [x]
|
(defn string? [x]
|
||||||
"Return True if x is a string"
|
"Return True if x is a string"
|
||||||
(if-python2
|
(if-python2
|
||||||
|
@ -216,5 +222,5 @@
|
||||||
"even?" "filter" "float?" "inc"
|
"even?" "filter" "float?" "inc"
|
||||||
"instance?" "integer?" "iterable?" "iterate" "iterator?" "neg?"
|
"instance?" "integer?" "iterable?" "iterate" "iterator?" "neg?"
|
||||||
"none?" "nth" "numeric?" "odd?" "pos?" "remove" "repeat"
|
"none?" "nth" "numeric?" "odd?" "pos?" "remove" "repeat"
|
||||||
"repeatedly" "second" "string?" "take" "take_nth" "take_while"
|
"repeatedly" "second" "string" "string?" "take" "take_nth" "take_while"
|
||||||
"zero?"])
|
"zero?"])
|
||||||
|
|
|
@ -779,3 +779,7 @@
|
||||||
"Evaluate an empty list to a []"
|
"Evaluate an empty list to a []"
|
||||||
(assert (= () [])))
|
(assert (= () [])))
|
||||||
|
|
||||||
|
(defn test-string []
|
||||||
|
(assert (string? (string "a")))
|
||||||
|
(assert (string? (string 1)))
|
||||||
|
(assert (= u"unicode" (string "unicode"))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user