From 37604cc8f0f4b2ac826798ce6fc01435d646a587 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 25 Aug 2023 11:08:25 -0400 Subject: [PATCH] Fix example and clean up --- README.md | 14 ++++++++------ src/tools/mod.rs | 3 ++- src/value/value_type.rs | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 606d6cc..a4f6bc5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/tools/mod.rs b/src/tools/mod.rs index 19a16ef..ae921fe 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -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, diff --git a/src/value/value_type.rs b/src/value/value_type.rs index 36397bf..0429cac 100644 --- a/src/value/value_type.rs +++ b/src/value/value_type.rs @@ -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