1
0

Fix example and clean up

This commit is contained in:
Jeff 2023-08-25 11:08:25 -04:00
parent 491dd649cd
commit 37604cc8f0
3 changed files with 11 additions and 8 deletions

View File

@ -145,7 +145,7 @@ animals = create_table (
(
("rover", "cat", 14),
("spot", "snake", 9),
("bob", "giraffe", 2),
("bob", "giraffe", 2)
)
);
```
@ -163,14 +163,16 @@ The commands `create_table` and `insert` make sure that all of the memory used t
```dust
insert(
animals,
("eliza", "ostrich", 4),
("pat", "white rhino", 7),
("jim", "walrus", 9)
(
("eliza", "ostrich", 4),
("pat", "white rhino", 7),
("jim", "walrus", 9)
)
);
assert_eq(length(animals.all), 6);
assert_equal(count(animals.all), 6);
sorted = sort(animals, "name");
sorted = sort(animals);
```
### The Yield Operator

View File

@ -50,13 +50,14 @@ pub mod time;
/// Master list of all tools.
///
/// This list is used to match identifiers with tools and to provide info to the shell.
pub const TOOL_LIST: [&'static dyn Tool; 50] = [
pub const TOOL_LIST: [&'static dyn Tool; 51] = [
&collections::Count,
&collections::CreateTable,
&collections::Insert,
&collections::Rows,
&collections::Select,
&collections::String,
&collections::Sort,
&collections::Replace,
&collections::Transform,
&collections::Where,

View File

@ -34,9 +34,9 @@ impl PartialEq for ValueType {
(ValueType::ListExact(left), ValueType::ListExact(right)) => left == right,
(ValueType::ListExact(_), ValueType::List) => true,
(ValueType::List, ValueType::ListExact(_)) => true,
(ValueType::ListOf(left), ValueType::ListOf(right)) => left == right,
(ValueType::ListOf(_), ValueType::List) => true,
(ValueType::List, ValueType::ListOf(_)) => true,
(ValueType::ListOf(left), ValueType::ListOf(right)) => left == right,
(ValueType::ListOf(value_type), ValueType::ListExact(exact_list))
| (ValueType::ListExact(exact_list), ValueType::ListOf(value_type)) => {
if exact_list