From 7b109240d2bfdd7caaea8eba849c5b0941ed4f05 Mon Sep 17 00:00:00 2001 From: Amit Weisbord Date: Tue, 27 Sep 2022 10:14:41 +0300 Subject: [PATCH 1/3] Clarified collection in slice definition Noticed the slice definition in the first paragraph relies on the reader recalling: * what collections are * that the reference page ended stating slices are a kind of reference I think the first paragraph should be more clear to someone who lands on it and isn't reading the rest of the documentation ATM. --- src/ch04-03-slices.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ch04-03-slices.md b/src/ch04-03-slices.md index afb6f76b10..1aae43f038 100644 --- a/src/ch04-03-slices.md +++ b/src/ch04-03-slices.md @@ -1,8 +1,9 @@ ## The Slice Type -*Slices* let you reference a contiguous sequence of elements in a collection -rather than the whole collection. A slice is a kind of reference, so it does -not have ownership. +*Slices* are a kind of reference, which lets you access a contiguous sub-sequence +of elements in a sequential [collection](book/src/ch08-00-common-collections.md). +Because slices are a kind of reference, they too can borrow access to memory, but +not own it. Here’s a small programming problem: write a function that takes a string of words separated by spaces and returns the first word it finds in that string. From 3a8ff9bdd272d4a60622f4ef3e2413b4170258ba Mon Sep 17 00:00:00 2001 From: Amit Weisbord Date: Tue, 27 Sep 2022 15:22:13 +0300 Subject: [PATCH 2/3] Fix broken url --- src/ch04-03-slices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch04-03-slices.md b/src/ch04-03-slices.md index 1aae43f038..3b1b7989c1 100644 --- a/src/ch04-03-slices.md +++ b/src/ch04-03-slices.md @@ -1,7 +1,7 @@ ## The Slice Type *Slices* are a kind of reference, which lets you access a contiguous sub-sequence -of elements in a sequential [collection](book/src/ch08-00-common-collections.md). +of elements in a sequential [collection](ch08-00-common-collections.md). Because slices are a kind of reference, they too can borrow access to memory, but not own it. From 82df41e8bda9ae8efb7b99e02ed7855e9e625a33 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 19 Apr 2024 12:46:08 -0600 Subject: [PATCH 3/3] Ch. 4: include link forward to collections Remove the additional, extraneous info from the Ch. 4. section 3 intro. --- src/ch04-03-slices.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ch04-03-slices.md b/src/ch04-03-slices.md index 3b1b7989c1..e986844046 100644 --- a/src/ch04-03-slices.md +++ b/src/ch04-03-slices.md @@ -1,9 +1,8 @@ ## The Slice Type -*Slices* are a kind of reference, which lets you access a contiguous sub-sequence -of elements in a sequential [collection](ch08-00-common-collections.md). -Because slices are a kind of reference, they too can borrow access to memory, but -not own it. +*Slices* let you reference a contiguous sequence of elements in a +[collection](ch08-00-common-collections.md) rather than the whole collection. A +slice is a kind of reference, so it does not have ownership. Here’s a small programming problem: write a function that takes a string of words separated by spaces and returns the first word it finds in that string.