@@ -1043,7 +1043,7 @@
(λ [(Ref String a), Int] String)
- (suffix-string s b)
+ (suffix s b)
Return the last b
characters of the string s
.
diff --git a/examples/basics.carp b/examples/basics.carp
index 5e9cc554..fee76dee 100644
--- a/examples/basics.carp
+++ b/examples/basics.carp
@@ -183,8 +183,8 @@
(defn two-lengths-in-same-func []
(let [a [[1]]
b [1 2 3]
- c1 (length &a)
- c2 (length &b)]
+ c1 (Array.length &a)
+ c2 (Array.length &b)]
(println* (+ c1 c2))))
(defn changing-target-of-ref []
diff --git a/out/keep.txt b/out/keep.txt
deleted file mode 100644
index 251cf3c3..00000000
--- a/out/keep.txt
+++ /dev/null
@@ -1 +0,0 @@
-Keep this directory.
diff --git a/src/StartingEnv.hs b/src/StartingEnv.hs
index dde4f487..dcf02098 100644
--- a/src/StartingEnv.hs
+++ b/src/StartingEnv.hs
@@ -321,7 +321,7 @@ dynamicStringModule = Env { envBindings = bindings
, envFunctionNestingLevel = 0 }
where bindings = Map.fromList [ addCommand "char-at" 2 commandCharAt
, addCommand "index-of" 2 commandIndexOf
- , addCommand "substring" 3 commandSubstring
+ , addCommand "slice" 3 commandSubstring
, addCommand "length" 1 commandStringLength
, addCommand "join" 1 commandStringJoin
, addCommand "directory" 1 commandStringDirectory
diff --git a/test/array.carp b/test/array.carp
index b62da71d..30848a85 100644
--- a/test/array.carp
+++ b/test/array.carp
@@ -105,16 +105,16 @@
"sum works as expected")
(assert-equal test
&[2 3]
- &(subarray &(range 1 10 1) 1 3)
- "subarray works as expected")
+ &(slice &(range 1 10 1) 1 3)
+ "slice works as expected")
(assert-equal test
&[1 2 3]
- &(prefix-array &(range 1 10 1) 3)
- "prefix-array works as expected")
+ &(prefix &(range 1 10 1) 3)
+ "prefix works as expected")
(assert-equal test
&[8 9 10]
- &(suffix-array &(range 1 10 1) 7)
- "suffix-array works as expected")
+ &(suffix &(range 1 10 1) 7)
+ "suffix works as expected")
(assert-equal test
&(Maybe.Nothing)
&(nth &a 100)
diff --git a/test/memory.carp b/test/memory.carp
index 34a59ec8..6a33950b 100644
--- a/test/memory.carp
+++ b/test/memory.carp
@@ -181,9 +181,9 @@
(defn if-6 []
(branch-in-let false))
-(defn string-substring []
+(defn string-slice []
(let [s1 @"abcde"
- s2 (String.substring &s1 0 3)]
+ s2 (String.slice &s1 0 3)]
(assert (= "abc" &s2))))
(defn array-aset []
@@ -241,9 +241,9 @@
(let [xs [10 20 30 40 50]]
(assert (= 150 (sum &xs)))))
-(defn array-subarray []
+(defn array-slice []
(let [xs [@"a" @"b" @"c" @"d" @"e"]]
- (assert (= &[@"c" @"d"] &(Array.subarray &xs 2 4)))))
+ (assert (= &[@"c" @"d"] &(Array.slice &xs 2 4)))))
(defn array-reverse-1 []
(let [xs [@"a" @"b" @"c" @"d" @"e"]]
@@ -259,7 +259,7 @@
(assert (= 3 (Array.element-count &xs "a")))))
(defn first-letter [s]
- (String.substring s 0 1))
+ (String.slice s 0 1))
(defn array-aupdate []
(let [xs [@"abc" @"xyz"]
@@ -458,7 +458,7 @@
(assert-no-leak test if-4 "if-4 does not leak")
(assert-no-leak test if-5 "if-5 does not leak")
(assert-no-leak test if-6 "if-6 does not leak")
- (assert-no-leak test string-substring "string-substring does not leak")
+ (assert-no-leak test string-slice "string-slice does not leak")
(assert-no-leak test array-aset "array-aset does not leak")
(assert-no-leak test array-reduce "array-reduce does not leak")
(assert-no-leak test array-endo-filter "array-endo-filter does not leak")
@@ -470,7 +470,7 @@
(assert-no-leak test array-maximum "array-maximum does not leak")
(assert-no-leak test array-minimum "array-minimum does not leak")
(assert-no-leak test array-sum "array-sum does not leak")
- (assert-no-leak test array-subarray "array-subarray does not leak")
+ (assert-no-leak test array-slice "array-slice does not leak")
(assert-no-leak test array-reverse-1 "array-reverse-2 does not leak")
(assert-no-leak test array-index-of "array-index-of does not leak")
(assert-no-leak test array-element-count "array-element-count does not leak")
diff --git a/test/string.carp b/test/string.carp
index e91d26ef..a7916d60 100644
--- a/test/string.carp
+++ b/test/string.carp
@@ -84,16 +84,16 @@
"from-chars works as expected")
(assert-equal test
"edan"
- &(substring "svedang" 2 6)
- "substring works as expected")
+ &(slice "svedang" 2 6)
+ "slice works as expected")
(assert-equal test
"sved"
- &(prefix-string "svedang" 4)
- "prefix-string works as expected")
+ &(prefix "svedang" 4)
+ "prefix works as expected")
(assert-equal test
"dang"
- &(suffix-string "svedang" 3)
- "suffix-string works as expected")
+ &(suffix "svedang" 3)
+ "suffix works as expected")
(assert-true test
(ends-with? "heller" "ler")
"ends-with? works as expected")