Skip to content

Commit

Permalink
fix Eq of functions; alpha release
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Apr 26, 2021
1 parent e79a93f commit 7a8930d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "calcit_runner"
version = "0.3.0-a5"
version = "0.3.0-a6"
authors = ["jiyinyiyong <jiyinyiyong@gmail.com>"]
edition = "2018"
license = "MIT"
Expand Down
12 changes: 12 additions & 0 deletions calcit/snapshots/test.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -223,6 +233,8 @@

test-try

test-fn-eq

inside-nim:
test-gynienic/main!

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
18 changes: 9 additions & 9 deletions src/primes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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,
}
Expand All @@ -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 {
Expand Down

0 comments on commit 7a8930d

Please sign in to comment.