Git Product home page Git Product logo

egison's Introduction

The Egison Programming Language

Build Status

Egison is a functional programming language featuring its expressive pattern-matching facility. Egison allows users to define efficient and expressive pattern-matching methods for arbitrary user-defined data types including non-free data types such as lists, multisets, sets, trees, graphs, and mathematical expressions. This is the repository of the interpreter of Egison.

For more information, visit our website.

Refereed Papers

Pattern Matching

Tensor Index Notation

Non-Linear Pattern Matching for Non-Free Data Types

We can use non-linear pattern matching for non-free data types in Egison. A non-free data type is a data type whose data have no canonical form, or a standard way to represent that object. For example, multisets are non-free data types because a multiset {a,b,b} has two other syntastically different representations: {b,a,b} and {b,b,a}. Expressive pattern matching for these data types enables us to write elegant programs.

Twin Primes

We can use pattern matching for enumeration. The following code enumerates all twin primes from the infinite list of prime numbers with pattern matching!

def twinPrimes :=
  matchAll primes as list integer with
  | _ ++ $p :: #(p + 2) :: _ -> (p, p + 2)

take 8 twinPrimes
-- [(3, 5), (5, 7), (11, 13), (17, 19), (29, 31), (41, 43), (59, 61), (71, 73)]

Poker Hands

The following code is a program that determines poker-hands written in Egison. All hands are expressed in a single pattern.

def poker cs :=
  match cs as multiset card with
  | card $s $n :: card #s #(n-1) :: card #s #(n-2) :: card #s #(n-3) :: card #s #(n-4) :: _
    -> "Straight flush"
  | card _ $n :: card _ #n :: card _ #n :: card _ #n :: _ :: []
    -> "Four of a kind"
  | card _ $m :: card _ #m :: card _ #m :: card _ $n :: card _ #n :: []
    -> "Full house"
  | card $s _ :: card #s _ :: card #s _ :: card #s _ :: card #s _ :: []
    -> "Flush"
  | card _ $n :: card _ #(n-1) :: card _ #(n-2) :: card _ #(n-3) :: card _ #(n-4) :: []
    -> "Straight"
  | card _ $n :: card _ #n :: card _ #n :: _ :: _ :: []
    -> "Three of a kind"
  | card _ $m :: card _ #m :: card _ $n :: card _ #n :: _ :: []
    -> "Two pair"
  | card _ $n :: card _ #n :: _ :: _ :: _ :: []
    -> "One pair"
  | _ :: _ :: _ :: _ :: _ :: [] -> "Nothing"

Graphs

We can pattern-match against graphs. We can write a program to solve the travelling salesman problem in a single pattern-matching expression.

def graph := multiset (string, multiset (string, integer))

def graphData :=
  [("Berlin", [("New York", 14), ("London", 2), ("Tokyo", 14), ("Vancouver", 13)]),
   ("New York", [("Berlin", 14), ("London", 12), ("Tokyo", 18), ("Vancouver", 6)]),
   ("London", [("Berlin", 2), ("New York", 12), ("Tokyo", 15), ("Vancouver", 10)]),
   ("Tokyo", [("Berlin", 14), ("New York", 18), ("London", 15), ("Vancouver", 12)]),
   ("Vancouver", [("Berlin", 13), ("New York", 6), ("London", 10), ("Tokyo", 12)])]

def trips :=
  let n := length graphData in
    matchAll graphData as graph with
    | (#"Berlin", (($s_1,$p_1) : _)) ::
        loop $i (2, n - 1)
          ((#s_(i - 1), ($s_i, $p_i) :: _) :: ...)
          ((#s_(n - 1), (#"Berlin" & $s_n, $p_n) :: _) :: [])
    -> sum (map (\i -> p_i) [1..n]), map (\i -> s_i) [1..n]

car (sortBy (\(_, x), (_, y) -> compare x y)) trips)
-- (["London", "New York", "Vancouver", "Tokyo"," Berlin"], 46)

Egison as a Computer Algebra System

As an application of Egison pattern matching, we have implemented a computer algebra system on Egison. The most part of this computer algebra system is written in Egison and extensible using Egison.

Symbolic Algebra

Egison treats unbound variables as symbols.

> x
x
> (x + y)^2
x^2 + 2 * x * y + y^2
> (x + y)^4
x^4 + 4 * x^3 * y + 6 * x^2 * y^2 + 4 * x * y^3 + y^4

We can handle algebraic numbers, too.

> sqrt x
sqrt x
> sqrt 2
sqrt 2
> x + sqrt y
x + sqrt y

Complex Numbers

The symbol i is defined to rewrite i^2 to -1 in Egison library.

> i * i
-1
> (1 + i) * (1 + i)
2 * i
> (x + y * i) * (x + y * i)
x^2 + 2 * x * y * i - y^2

Square Root

The rewriting rule for sqrt is also defined in Egison library.

> sqrt 2 * sqrt 2
2
> sqrt 6 * sqrt 10
2 * sqrt 15
> sqrt (x * y) * sqrt (2 * x)
x * sqrt 2 * sqrt y

The 5th Roots of Unity

The following is a sample to calculate the 5th roots of unity.

> qF' 1 1 (-1)
((-1 + sqrt 5) / 2, (-1 - sqrt 5) / 2)
> def t := fst (qF' 1 1 (-1))
> qF' 1 (-t) 1
((-1 + sqrt 5 + sqrt 2 * sqrt (-5 - sqrt 5)) / 4, (-1 + sqrt 5 - sqrt 2 * sqrt (-5 - sqrt 5)) / 4)
> def z := fst (qF' 1 (-t) 1)
> z
(-1 + sqrt 5 + sqrt 2 * sqrt (-5 - sqrt 5)) / 4
> z ^ 5
1

Differentiation

We can implement differentiation easily in Egison.

> d/d (x ^ 3) x
3 * x^2
> d/d (e ^ (i * x)) x
exp (x * i) * i
> d/d (d/d (log x) x) x
-1 / x^2
> d/d (cos x * sin x) x
-2 * (sin x)^2 + 1

Taylor Expansion

The following sample executes Taylor expansion on Egison. We verify Euler's formula in the following sample.

> take 8 (taylorExpansion (exp (i * x)) x 0)
[1, x * i, - x^2 / 2, - x^3 * i / 6, x^4 / 24, x^5 * i / 120, - x^6 / 720, - x^7 * i / 5040]
> take 8 (taylorExpansion (cos x) x 0)
[1, 0, - x^2 / 2, 0, x^4 / 24, 0, - x^6 / 720, 0]
> take 8 (taylorExpansion (i * sin x) x 0)
[0, x * i, 0, - x^3 * i / 6, 0, x^5 * i / 120, 0, - x^7 * i / 5040]
> take 8 (map2 (+) (taylorExpansion (cos x) x 0) (taylorExpansion (i * sin x) x 0))
[1, x * i, - x^2 / 2, - x^3 * i / 6, x^4 / 24, x^5 * i / 120, - x^6 / 720, - x^7 * i / 5040]

Tensor Index Notation

Egison supports tesnsor index notation. We can use Einstein notation to express arithmetic operations between tensors.

The method for importing tensor index notation into programming is discussed in Egison tensor paper.

The following sample is from Riemann Curvature Tensor of S2 - Egison Mathematics Notebook.

-- Parameters
def x := [| θ, φ |]

def X := [| r * (sin θ) * (cos φ) -- x
      , r * (sin θ) * (sin φ) -- y
      , r * (cos θ)           -- z
      |]

def e_i_j := (∂/∂ X_j x~i)

-- Metric tensors
def g_i_j := generateTensor (\x y -> V.* e_x_# e_y_#) [2, 2]
def g~i~j := M.inverse g_#_#

g_#_# -- [| [| r^2, 0 |], [| 0, r^2 * (sin θ)^2 |] |]_#_#
g~#~# -- [| [| 1 / r^2, 0 |], [| 0, 1 / (r^2 * (sin θ)^2) |] |]~#~#

-- Christoffel symbols
def Γ_i_j_k := (1 / 2) * (∂/∂ g_i_k x~j + ∂/∂ g_i_j x~k - ∂/∂ g_j_k x~i)

Γ_1_#_# -- [| [| 0, 0 |], [| 0, -1 * r^2 * (sin θ) * (cos θ) |] |]_#_#
Γ_2_#_# -- [| [| 0, r^2 * (sin θ) * (cos θ) |], [| r^2 * (sin θ) * (cos θ), 0 |] |]_#_#

def Γ~i_j_k := withSymbols [m]
  g~i~m . Γ_m_j_k

Γ~1_#_# -- [| [| 0, 0 |], [| 0, -1 * (sin θ) * (cos θ) |] |]_#_#
Γ~2_#_# -- [| [| 0, (cos θ) / (sin θ) |], [| (cos θ) / (sin θ), 0 |] |]_#_#

-- Riemann curvature
def R~i_j_k_l := withSymbols [m]
  ∂/∂ Γ~i_j_l x~k - ∂/∂ Γ~i_j_k x~l + Γ~m_j_l . Γ~i_m_k - Γ~m_j_k . Γ~i_m_l

R~#_#_1_1 -- [| [| 0, 0 |], [| 0, 0 |] |]~#_#
R~#_#_1_2 -- [| [| 0, (sin θ)^2 |], [| -1, 0 |] |]~#_#
R~#_#_2_1 -- [| [| 0, -1 * (sin θ)^2 |], [| 1, 0 |] |]~#_#
R~#_#_2_2 -- [| [| 0, 0 |], [| 0, 0 |] |]~#_#

Differential Forms

By designing the index completion rules for omitted indices, we can use the above notation to express a calculation handling the differential forms.

The following sample is from Curvature Form - Egison Mathematics Notebook.

-- Parameters and metric tensor
def x := [| θ, φ |]

def g_i_j := [| [| r^2, 0 |], [| 0, r^2 * (sin θ)^2 |] |]_i_j
def g~i~j := [| [| 1 / r^2, 0 |], [| 0, 1 / (r^2 * (sin θ)^2) |] |]~i~j

-- Christoffel symbols
def Γ_j_l_k := (1 / 2) * (∂/∂ g_j_l x~k + ∂/∂ g_j_k x~l - ∂/∂ g_k_l x~j)

def Γ~i_k_l := withSymbols [j] g~i~j . Γ_j_l_k

-- Exterior derivative
def d %t := !(flip ∂/∂) x t

-- Wedge product
infixl expression 7 

def (∧) %x %y := x !. y

-- Connection form
def ω~i_j := Γ~i_j_#

-- Curvature form
def Ω~i_j := withSymbols [k]
  antisymmetrize (d ω~i_j + ω~i_k  ω~k_j)

Ω~#_#_1_1 -- [| [| 0, 0 |], [| 0, 0 |] |]~#_#
Ω~#_#_1_2 -- [| [| 0, (sin θ)^2  / 2|], [| -1 / 2, 0 |] |]~#_#
Ω~#_#_2_1 -- [| [| 0, -1 * (sin θ)^2 / 2 |], [| 1 / 2, 0 |] |]~#_#
Ω~#_#_2_2 -- [| [| 0, 0 |], [| 0, 0 |] |]~#_#

Egison Mathematics Notebook

Here are more samples.

Comparison with Related Work

There are a lot of existing work for pattern matching.

The advantage of Egison is that it fulfills the following two requirements at the same time.

  1. Efficient backtracking algorithm for non-linear pattern matching.
  2. Extensibility of patterns.

Additionally, it fulfills the following requirements.

  1. Polymorphism of patterns.
  2. Pattern matching with infinitely many results.

Check out our paper for details.

Installation

Installation guide is available on our website.

If you are a beginner of Egison, it would be better to install egison-tutorial as well.

We also have online interpreter and online tutorial. Enjoy!

Notes for Developers

You can build Egison as follows:

$ stack init
$ stack build --fast

For testing, see test/README.md.

Community

We have a mailing list. Please join us!

We are on Twitter. Please follow us.

License

Egison is released under the MIT license.

We used husk-scheme by Justin Ethier as reference to implement the base part of the previous version of the interpreter.

Sponsors

Egison is sponsored by Rakuten, Inc. and Rakuten Institute of Technology.

egison's People

Contributors

alpicola avatar bfontaine avatar calmery avatar egisatoshi avatar ggreif avatar gogotanaka avatar greymd avatar keitotobi1 avatar kotapiku avatar kuwuwa avatar matsubara0507 avatar momohatt avatar readmecritic avatar rns avatar takei-shg avatar tomoasleep avatar unaoya avatar xenophobia avatar xzfc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

egison's Issues

Orderd-Or-Patterns

Or-patternと同じように任意個のパターンを引数にとり、そのうちどれかにパターンマッチ成功したら、パターン全体でもパターンマッチ成功となります。

ただ違うのは、先頭から順番にパターンマッチを行なっていって、どれかでパターンマッチに成功したら、そのパターン以外ではパターンマッチを試さないことです。

(define $seq-pat (pattern-function [$pat1 $pat2] (|. <cons pat (seq-pat pat1 pat2)> pat2)))

patが最長に続く仕方でマッチするパターンとなります。

> (test (match-all {1 2 3 1 2 1 1} (multiset integer)
             [(seq-pat ,1 $xs) xs]))
{{2 3 2}}
> (test (match-all {1 2 3 1 2 1 1} (multiset integer)
             [(seq-pat ,1 <cons $x _>) x]))
{2 3 2}

Dynamic typing system

Egison version 3 has dynamic typing system, though we are planning to implement static typing system in version 4.

We'll add the following predicates.

boolean?
integer?
float?
char?
collection?
array?
hash?

index-pattern inside pattern-function

(define $conss
  (pattern-function [$pat1 $pat2 $pat3]
    (loop $i [1 pat1] <cons pat2_i ...> pat3)))

(test (match-all {1 2 3 4 5} (list integer) [(conss $n $a _) [n a]]))

This program returns Unbound variable: a.
This is because we can't know $a is bound to array from the match-all expression.

Nested cons Bug

(test (match-all {1 2 3} (multiset something)
    [<cons $m
               <cons $n
                     $rest>>
         [m n rest]]))

returns

{[1 2 {3}] [1 3 {2}] [2 1 {3 1 2}] [2 3 {1}] [3 1 {3 1 2 1 2}] [3 3 {1 1 2}] [3 1 {1 3 2}] [3 2 {1 3 1}]}

Showing pattern functions

After binding a variable to a pattern-function, we can show the result of application of a pattern, which may be a pattern!

> (define $f (pattern-function [$xs] xs))
> (test (f $x))
(lambda [#1] ...)
> (test ((f $x) $x))
(lambda [#1] ...)
> (test (((f $x) $x) $x))
(lambda [#1] ...)

Unaccessible primitive function

I can't get neither the sum of nor the difference between two floating numbers.
It means I found primitive functions +f and -f are unbound.

> (test +f)
Parse error at: "egison" (line 1, column 8):
unexpected "f"
expecting "_" or ")"
> (test -f)
Parse error at: "egison" (line 1, column 8):
unexpected "f"
expecting "_" or ")"
> (test *f)
#<primitive>
> (test /f)
#<primitive>

Thank you.

An array refuses to contain newlines

Although the others allows us to insert line breaks, [| |] says "an error occurs".

> (test [1 2 
  3])
[1 2 3]
> (test {1 2
  3})
{1 2 3}
> (test (+ 1 
  2))
3
> (test [| 1 2
Parse error at: "egison" (line 1, column 8):
unexpected "|"
expecting expression or "]"

Generate-array distinguishes a single tuple and its element

Egison identifies a single tuple and its unique element.
However, generate-array refuses to be given an integer as its second argument.
It requires the second argument forming a tuple.
That seems to be strange, doesn't it?

> (test (generate-array [$x] [5] x))
[|1 2 3 4 5|]
> (test (generate-array $x [5] x))
[|1 2 3 4 5|]
> (test (generate-array $x 5 x))
Error: invalid generate-array expression
> (test (generate-array [$x] 5 x))
Error: invalid generate-array expression
> (test (generate-array [$x] [[5]] x))
[|1 2 3 4 5|]

Redesign loop-patterns

All of what we want to do with loop-patterns are covered with the following syntax.

(loop $i [1 {2 3 4} $n] ... _)
(loop $i [1 {3} _] ... _)
(loop $i [1 nats $n] ..._)

We'll support the following syntax sugars.

(loop $i [1 3] ... _) => (loop $i [1 {3} _] ... _)
(loop $i [1 $n] ..._) => (loop $i [1 (from (- 1 1)) $n] ..._)

smart value patterns

Patterns such as <cons (& ,m $n) _> is not efficiently processed as value patterns.

bug for infinite lists

(take 1 (match-all {1 @(map (+ 1 $) (repeat1 1))} (multiset integer) [<cons $n <cons ,n _>> n]))

When executing the above pattern matching expression, pattern matching inside the matcher definition fall into infinite loop. Therefore it can't return the result though it has matches. (n can be binded to 2)

smart loop patterns

Value patterns inside the range expression in the loop patterns can't be efficiently handled as #38.
I have an idea to handle value patterns in loop patterns.
The left-side patterns of the range patterns must be match smaller integers than right-hand side of them.
For example, (loop $i [1 (| ,2 ,3)] ...) is good, but (loop $i [1 (| ,3 ,2)] ...) is bad. In this first case ,2 is the left side than ,3, and 2 is smaller than 3. Therefore, the first case is valid. But the second case is invalid.
If the most right side of the range patterns fails, the pattern-matching of the loop pattern ends.

EgisonQL demo

Make an demonstration of EgisonQL that many people get interested.

BFS and DFS

Enable to switch bfs and dfs pattern-matching in each situation.

algebraic-data-matcherの構文の修正

(define $suit
  (algebraic-data-matcher
    (| <spade> <heart> <club> <diamond> )))

ではなくて、

(define $suit
  (algebraic-data-matcher
    {<spade> <heart> <club> <diamond>}))

とする。

array-ref doesn't work

The following command doesn't terminate.
Be careful.

> (array-ref [|1 2 3|] 3)
(\C-c)

An element of inifinite list with the end points changes

I made an infinite list with the head and the tail, and got the second element to the head, and the tail.
After that, I checked the second element, and found it changed.
The followings are the code I used.
Here, the infinite list is {1 2 3 4 5 6 ... -6 -5 -4 -3 -2 -1}.

> (define $mid-inf (lambda $n {n @(mid-inf (+ n 1)) (neg n)}))
> (define $l (mid-inf 1))
> (test (car (cdr l)))
2
> (test (rac (rdc l)))
-2
> (test (car (cdr l)))
1

Thank you.

Enable users to customize the symbol parser

All built-in data start with #.
For example, #t, #f, #123, #10.1, #ca, #c\n.
The symbol 123 is parsed and handled as #123 by the users.
It enables users to define any algebraic numbers such as i or any.

A pattern-function misses another pattern-function

When I run the following commands on the interpreter, I found a bug.

> (define $s (pattern-function [$pat] pat))
> (define $t (pattern-function [$pat] pat))
> (test (match-all 1 integer [(s (t ,1)) <OK>]))
Unbound variable: t

Strangely, the above commands work well if I wrote them in a file and run the file.

$ egison test.egi
{<OK>}
Unbound variable: main

"buildin"?

lib/core/base.egi has "buildin-data-matcher" but "builtin-data-matcher" sounds more natural.

Switch trevasal algorithm for cut-patterns

探索方法の切り替えを簡単に切り替えることができるようにインタプリタの実装を工夫する必要がある。

幅優先、深さ優先など。

Parallel-Patternの実装

\が先頭につくパターンをparallel-patternと呼びます。

\<cons $x $xs>

parallel-patternにより生成されたmatching stateは並列に処理されます。

Renew Data Structure of MatchingState

As below.
This modification is to implement not-pattern and cut-pattern.

data MatchingState = [MatchingStack]

data MatchingStack = MList [PatternBinding] Env [Binding] [MatchingAtom] [MatchingAtom]

Implementation of Let-patterns

We would like to use let in pattern as below.

(define $hamilton-path
  (pattern-function [$a]
    (& $g
       (let {[$n (size g)]}
         <cons <node (& a_1 $h_1) <cons (& a_2 $h_2) _> _>
               (loop $i (between 3 n)
                 <cons <node ,h_(- i 1) <cons (& a_i $h_i) _> _>
                       ...>
                 <cons <node ,h_n _ _>
                       <nil>>)>)
       )))

Otherwise, we will write same function as below.

(define $hamilton-path
  (pattern-function [$a]
    (& $g
       <cons <node (& a_1 $h_1) <cons (& a_2 $h_2) _> _>
             (loop $i (between 3 (size g))
               <cons <node ,h_(- i 1) <cons (& a_i $h_i) _> _>
                     ...>
               <cons <node ,h_(size g) _ _>
                     <nil>>)>
       )))

let patterns and let expressions are different in Egison.

`relational-matcher`

(define $edge-table
  (relational-matcher "edge"
    {["from_id" itos stoi]
     ["to_id" itos stoi]}))

is desgured to

(define $edge-table
  (matcher
    {[<cons <edge ,$px ,$py> $> [edge-table]
      ; select * from edge where from_id = px and to_id = py                                                                                                                                                
      {[$tgt (match (pure-mysql (database-name tgt) (simple-select {"from_id to_id"} (table-name tgt) {["from_id" (itos px)] ["to_id" (itos py)]})) (list [integer integer])
               {[<nil> {}]
                [_ {tgt}]})]}]
     [<cons <edge ,$px $> $> [integer edge-table]
      ; select to_id from edge where from_id = px                                                                                                                                                           
      {[$tgt (map (lambda [$x] [(stoi x) tgt]) (pure-mysql (database-name tgt) (simple-select {"to_id"} (table-name tgt) {["from_id" (itos px)]})))]}]
     [<cons <edge $ ,$px> $> [integer edge-table]
      ; select from_id from edge where to_id = px                                                                                                                                                           
      {[$tgt (map (lambda [$x] [(stoi x) tgt]) (pure-mysql (database-name tgt) (simple-select {"from_id"} (table-name tgt) {["to_id" (itos px)]})))]}]
     [$ [something]
      {[$tgt {tgt}]}]
     }))

Implement `next-match` expression

The expected return of the following expression is {2}, but it never returns the answer.
The reason is it fallen in infinite loop in the pattern-matching in the matcher multiset.
We have to handle match expressions in the matcher in one single state with the top match expression.

(take 1 (match-all {1 2 @(map (+ $ 1) nats)} (multiset integer) [<cons $n <cons ,n _>> n]))

Type Design of MatchClause, EgisonPattern, MAtom, etc...

For example, in the following type synonyms and datatype definitions, EgisonExpr type is at the place where EgisonPat type should be.

type MatchClause = (EgisonExpr, EgisonExpr)
data EgisonPattern =
    WildCard
  | PatVar String
  | ValuePat EgisonExpr
  | PredPat EgisonExpr
  | CutPat EgisonExpr
  | NotPat EgisonExpr
  | AndPat [EgisonExpr]
  | ...
data MatchingTree =
    MAtom EgisonExpr ObjectRef WHNFData
  | MNode [PatternBinding] MatchingState

type PatternBinding = (Var, EgisonExpr)

These confusion of types complecate case-expression in processMState.
I think that these should be defined as following:

type MatchClause = (EgisonPat, EgisonExpr)
data EgisonPattern =
    WildCard
  | PatVar String
  | ValuePat EgisonExpr
  | PredPat EgisonExpr
  | CutPat EgisonPat
  | NotPat EgisonPat
  | AndPat [EgisonPat]
  | ...
data MatchingTree =
    MAtom EgisonPat ObjectRef WHNFData
  | MNode [PatternBinding] MatchingState

type PatternBinding = (Var, EgisonPat)

However, this EgisonPat definition doesn't allow patterns with applying pattern-constructors (e.g. (twin $n ...) in mahjong.egi). This challenge, probably, can be removed with introducing ApplyPat EgisonExpr [EgisonPat] to EgisonPat.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.