diff --git a/Cargo.lock b/Cargo.lock index 7e38f418..889655ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "calcit_runner" -version = "0.3.0-a5" +version = "0.3.0-a6" dependencies = [ "cirru_edn", "cirru_parser", diff --git a/Cargo.toml b/Cargo.toml index 2b4a6cf4..38f75045 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "calcit_runner" -version = "0.3.0-a5" +version = "0.3.0-a6" authors = ["jiyinyiyong "] edition = "2018" license = "MIT" diff --git a/calcit/snapshots/test.cirru b/calcit/snapshots/test.cirru index fe60861c..87e29f7f 100644 --- a/calcit/snapshots/test.cirru +++ b/calcit/snapshots/test.cirru @@ -190,6 +190,16 @@ echo "|Finished testing try" + |test-fn-eq $ quote + fn () + log-title "|Testing equality of functions" + let + a $ fn (x) x + b $ fn (x) x + assert= a a + assert= b b + assert= false (&= a b) + |reload! $ quote defn reload! () nil @@ -223,6 +233,8 @@ test-try + test-fn-eq + inside-nim: test-gynienic/main! diff --git a/package.json b/package.json index 9574c4b8..3f3b3e49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@calcit/procs", - "version": "0.3.0-a5", + "version": "0.3.0-a6", "main": "./lib/calcit.procs.js", "devDependencies": { "@types/node": "^14.14.41", diff --git a/src/primes.rs b/src/primes.rs index b9145f3a..c7edecf0 100644 --- a/src/primes.rs +++ b/src/primes.rs @@ -260,14 +260,14 @@ impl Hash for Calcit { "proc:".hash(_state); name.hash(_state); } - Calcit::Macro(name, gen_id, ..) => { + Calcit::Macro(_name, _ns, gen_id, ..) => { "macro:".hash(_state); - name.hash(_state); + // name.hash(_state); gen_id.hash(_state); } - Calcit::Fn(name, gen_id, ..) => { + Calcit::Fn(_name, _ns, gen_id, ..) => { "fn:".hash(_state); - name.hash(_state); + // name.hash(_state); gen_id.hash(_state); } Calcit::Syntax(name, _ns) => { @@ -356,11 +356,11 @@ impl Ord for Calcit { (Calcit::Proc(_), _) => Less, (_, Calcit::Proc(_)) => Greater, - (Calcit::Macro(_, a, ..), Calcit::Macro(_, b, ..)) => a.cmp(b), + (Calcit::Macro(_name1, _ns1, a, ..), Calcit::Macro(_name2, _ns2, b, ..)) => a.cmp(b), (Calcit::Macro(..), _) => Less, (_, Calcit::Macro(..)) => Greater, - (Calcit::Fn(_, a, ..), Calcit::Fn(_, b, ..)) => a.cmp(&b), // compared with nanoid + (Calcit::Fn(_name1, _ns1, a, ..), Calcit::Fn(_name2, _ns2, b, ..)) => a.cmp(&b), // compared with nanoid (Calcit::Fn(..), _) => Less, (_, Calcit::Fn(..)) => Greater, @@ -397,8 +397,8 @@ impl PartialEq for Calcit { // functions compared with nanoid (Calcit::Proc(a), Calcit::Proc(b)) => a == b, - (Calcit::Macro(_, a, ..), Calcit::Macro(_, b, ..)) => a == b, - (Calcit::Fn(_, a, ..), Calcit::Fn(_, b, ..)) => a == b, + (Calcit::Macro(_name1, _ns1, a, ..), Calcit::Macro(_name2, _ns2, b, ..)) => a == b, + (Calcit::Fn(_name1, _ns1, a, ..), Calcit::Fn(_name2, _ns2, b, ..)) => a == b, (Calcit::Syntax(a, _), Calcit::Syntax(b, _)) => a == b, (_, _) => false, } @@ -408,7 +408,7 @@ impl PartialEq for Calcit { pub const CORE_NS: &str = "calcit.core"; pub const GENERATED_NS: &str = "calcit.gen"; -pub const CALCI_VERSION: &str = "0.3.0-a5"; +pub const CALCI_VERSION: &str = "0.3.0-a6"; impl Calcit { pub fn turn_string(&self) -> String {