egison 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -4
- data/lib/egison/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de7ad9f50fc2017c4546ff5ec489cd05e73fb13e
|
4
|
+
data.tar.gz: 093963280669d6413a0729c82902bf342e321c82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00bdaec6a09f92e11144f45bdd4835c06ade096c13769350d9766a55ab27a0b5a92ab8c25186e8c5e604ba8adf5b76a722986434e9f3c9ae498c5c1488e33d5f
|
7
|
+
data.tar.gz: 314486adbe83a12d08f46c92e0dc062c52555d9f152e158103b0962bd1300f1b3f75093a95b3d3b3948a7529c6580b51021071486923a5e27d927e34a2226cfd
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ $ gem install egison
|
|
13
13
|
or
|
14
14
|
|
15
15
|
```
|
16
|
-
$ git clone
|
16
|
+
$ git clone https://github.com/egison/egison-ruby.git
|
17
17
|
$ cd egison-ruby
|
18
18
|
$ gem build egison.gemspec
|
19
19
|
$ gem install egison-*.gem
|
@@ -23,13 +23,13 @@ or
|
|
23
23
|
|
24
24
|
```
|
25
25
|
$ gem install bundler (if you need)
|
26
|
-
$ echo "gem 'egison', :git => '
|
26
|
+
$ echo "gem 'egison', :git => 'https://github.com/egison/egison-ruby.git'" > Gemfile
|
27
27
|
$ bundle install --path vendor/bundle
|
28
28
|
```
|
29
29
|
|
30
30
|
## Basic Usage
|
31
31
|
|
32
|
-
|
32
|
+
The library provides `Kernel#match_all` and `Kernel#match`.
|
33
33
|
|
34
34
|
```
|
35
35
|
require 'egison'
|
@@ -107,6 +107,16 @@ match_all([1, 2, 3]) do
|
|
107
107
|
end #=> [[1, 1],[1, 2],[1, 3],[2, 1],[2, 2],[2, 3],[3, 1],[3, 2],[3, 3]]
|
108
108
|
```
|
109
109
|
|
110
|
+
Note that <code>_[]</code> is provided as syntactic sugar for <code>List.()</code>.
|
111
|
+
|
112
|
+
```
|
113
|
+
match_all([1, 2, 3]) do
|
114
|
+
with(_[_a, _b, *_]) do
|
115
|
+
[a, b]
|
116
|
+
end
|
117
|
+
end #=> [[1, 2]]
|
118
|
+
```
|
119
|
+
|
110
120
|
### Non-linear patterns
|
111
121
|
|
112
122
|
Non-linear pattern is the most important feature of our pattern-matching system.
|
@@ -180,6 +190,8 @@ p(poker_hands([["diamond", 4], ["club", 2], ["club", 5], ["heart", 1], ["diamond
|
|
180
190
|
p(poker_hands([["diamond", 4], ["club", 10], ["club", 5], ["heart", 1], ["diamond", 3]])) #=> "Nothing"
|
181
191
|
```
|
182
192
|
|
193
|
+
You can find more demonstrations in the [`sample`](https://github.com/egison/egison-ruby/tree/master/sample) directory.
|
194
|
+
|
183
195
|
## About Egison
|
184
196
|
|
185
197
|
If you get to love the above pattern-matching, please try [the Egison programming language](http://www.egison.org), too.
|
@@ -187,7 +199,7 @@ Egison is the pattern-matching oriented pure functional programming language.
|
|
187
199
|
Actually, the original pattern-matching system of Egison is more powerful.
|
188
200
|
For example, we can do following things in the original Egison.
|
189
201
|
|
190
|
-
- We can pattern-match against infinite lists
|
202
|
+
- We can pattern-match against infinite lists.
|
191
203
|
- We can define new pattern-constructors.
|
192
204
|
- We can modularize useful patterns.
|
193
205
|
|
data/lib/egison/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egison
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Satoshi Egi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|