mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
feat: add String.to-list (#1185)
This commit is contained in:
parent
d8d3669a16
commit
64b0dc4922
@ -486,3 +486,15 @@
|
||||
|
||||
(defmacro str* [:rest forms]
|
||||
`(copy %(build-str* forms)))
|
||||
|
||||
(defmodule Dynamic
|
||||
(defmodule String
|
||||
(defndynamic empty? [s]
|
||||
(= (String.length s) 0))
|
||||
|
||||
(defndynamic to-list [s]
|
||||
(if (String.empty? s)
|
||||
'()
|
||||
(cons (String.head s) (String.to-list (String.tail s)))))
|
||||
)
|
||||
)
|
||||
|
@ -428,4 +428,8 @@
|
||||
3
|
||||
(test-round 2.51)
|
||||
"Dynamic.round works as expected II")
|
||||
(assert-dynamic-equal test
|
||||
'("h" "e" "l" "l" "o")
|
||||
(String.to-list "hello")
|
||||
"Dynamic.String.to-list works as expected")
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user