egison 3.3.4 → 3.3.5
raw patch · 5 files changed
+26/−12 lines, 5 files
Files
- egison.cabal +8/−5
- hs-src/Language/Egison/Primitives.hs +2/−2
- lib/core/natural-number.egi +1/−1
- lib/core/number.egi +4/−4
- sample/tak.egi +11/−0
egison.cabal view
@@ -1,9 +1,9 @@ Name: egison-Version: 3.3.4-Synopsis: Programming language with non-linear pattern-matching with backtracking+Version: 3.3.5+Synopsis: Programming language with non-linear pattern-matching against unfree data Description:- An interpreter for Egison, the programming langugage that realized non-linear pattern-matching with backtracking.- With Egison, we can directly represent pattern-matching against lists, multisets, sets, trees, graphs and any kind of data types.+ An interpreter for Egison, the programming langugage that realized non-linear pattern-matching against unfree data types.+ With Egison, we can directly represent pattern-matching against a wide range of data types such as lists, multisets, sets, trees and graphs. We can find Egison programs in @lib@ and @sample@ directories. This package also include Emacs Lisp file @egison-mode.el@ in @elisp@ directory. .@@ -14,7 +14,10 @@ <<http://www.egison.org/images/poker-hands.png>> . The pattern-matching of Egison is very powerful.- We can use it for pattern-matching against graphs, too.+ Please view and try more demonstrations.+ .+ <http://www.egison.org/demonstrations/>+ . Egison is not popular at all now. Please help us to make Egison popular. Homepage: http://www.egison.org
hs-src/Language/Egison/Primitives.hs view
@@ -255,9 +255,9 @@ divide :: PrimitiveFunc divide = twoArgs $ \val val' -> numberBinaryOp' val val' where- numberBinaryOp' (Integer i) (Integer i') = return $ Rational $ (%) i i'+ numberBinaryOp' (Integer i) (Integer i') = numberBinaryOp' (Rational (i % 1)) (Rational (i' % 1)) numberBinaryOp' (Integer i) val = numberBinaryOp' (Rational (i % 1)) val- numberBinaryOp' val (Integer i) = numberBinaryOp' val (Rational (i % 1)) + numberBinaryOp' val (Integer i) = numberBinaryOp' val (Rational (i % 1)) numberBinaryOp' (Rational r) (Rational r') = let m = numerator r' in let n = denominator r' in
lib/core/natural-number.egi view
@@ -12,7 +12,7 @@ {[0 {[]}] [_ {}]}] [<s $> nat- {[$tgt (match (compare-integer tgt 0) ordering+ {[$tgt (match (compare tgt 0) ordering {[<greater> {(- tgt 1)}] [_ {}]})]}] [$ [something]
lib/core/number.egi view
@@ -15,7 +15,7 @@ {[<cons $n <nil>> n] [<cons $n $rs> (let {[$r (min rs)]}- (match (compare-integer n r) ordering+ (match (compare n r) ordering {[<less> n] [_ r]}))]}))) @@ -25,7 +25,7 @@ {[<cons $n <nil>> n] [<cons $n $rs> (let {[$r (max rs)]}- (match (compare-integer n r) ordering+ (match (compare n r) ordering {[<greater> n] [_ r]}))]}))) @@ -35,9 +35,9 @@ {[<cons $n <nil>> [n n]] [<cons $n $rs> (let {[[$min-n $max-n] (min-and-max rs)]}- (match (compare-integer n min-n) ordering+ (match (compare n min-n) ordering {[<less> [n max-n]]- [_ (match (compare-integer n max-n) ordering+ [_ (match (compare n max-n) ordering {[<greater> [min-n n]] [_ [min-n max-n]]})]}))]})))
+ sample/tak.egi view
@@ -0,0 +1,11 @@+(define $tak+ (lambda [$x $y $z]+ (if (lte? x y)+ y+ (tak (tak (- x 1) y z)+ (tak (- y 1) z x)+ (tak (- z 1) x y)))))++(test (tak 1 1 1))++(test (tak 4 2 1))