23 karma · joined Aug 18, 2013 (13y ago) · 23 submissions
comment 8y ago · link · parent
Egison features a customizable pattern-matching facility. Pattern-matching methods for each data type and pattern can be customizable by users. There might be a possibility that you thought syntax sugar is not syntax sugar.
comment 8y ago · link · parent
I started to implement a computer algebra system as a killer application of customizable pattern matching of Egison.
It allows users to customize the pattern-method for mathematical expressions from more primitive level than the other computer algebra systems.
comment 8y ago · link · parent
The power of Egison's pattern matching becomes more obvious when we consider more general pattern such as (p, p+ 100) not only (p, p+2).
We can write the first 5 prime pairs whose form is (p, p+100) with a small modification for pattern matching for twin primes.
(take 5
(match-all primes (list integer)
[<join _ <cons $p <join _ <cons ,(+ p 100) _>>>>
[p (+ p 100)]]))
;=>{[3 103] [7 107] [13 113] [31 131] [37 137]}7.
Show HN: A Ruby gem for very strong pattern-matching(github.com ↗)
1 points · by egi · 12y ago · discuss
comment 12y ago · link · parent
1- I'm sorry but I don't know materials for the baby steps to implement pattern matching. However, I think it is not so difficult to compile ordinary pattern matching expression into many nested if expressions, if you have a small language you can manage completely.
2- I think difficulty to implement a pattern matching mechanism is not different for each language. I think writing a parser may be the hardest work.
By the way, I forgot to paste URL for my interpreter I wrote in the past. https://github.com/egisatoshi/scheme-meta-interpreter/blob/m... Lisp is easy to write a parser, and it's because I recommended lisp.
comment 12y ago · link · parent
comment 12y ago · link · parent
comment 12y ago · link · parent
comment 12y ago · link · parent
comment 12y ago · link · parent
comment 12y ago · link · parent
comment 12y ago · link · parent
comment 12y ago · link · parent
I got an idea of Egison when I was working with logic expressions. Pattern-matching of the existing languages are not strong enough to do what I'd like to do. They can't express pattern-matching against set intuitively. Therefore, I've created Egison.