From e125e8b4405f4485bb6649032f05c7677667c2ef Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 24 Aug 2018 16:29:28 -0700 Subject: [PATCH] Add spaceship operator for getting an ord --- schala-lang/src/builtin.rs | 1 + schala-lang/src/lib.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/schala-lang/src/builtin.rs b/schala-lang/src/builtin.rs index 5e7c8cd..498ca88 100644 --- a/schala-lang/src/builtin.rs +++ b/schala-lang/src/builtin.rs @@ -133,5 +133,6 @@ lazy_static! { "<=" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 20), "==" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 20), "=" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 20), + "<=>" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 20), }; } diff --git a/schala-lang/src/lib.rs b/schala-lang/src/lib.rs index 7069124..3ba3cf8 100644 --- a/schala-lang/src/lib.rs +++ b/schala-lang/src/lib.rs @@ -57,6 +57,7 @@ impl Schala { let prelude = r#" type Option = Some(T) | None type Color = Red | Green | Blue +type Ord = LT | EQ | GT "#; let mut s = Schala::new_blank_env(); s.execute_pipeline(prelude, &EvalOptions::default());