shen-ruby 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +6 -2
- data/README.md +4 -4
- data/lib/shen_ruby/rb.shen +7 -13
- data/lib/shen_ruby/shen_ruby.shen +1 -1
- data/lib/shen_ruby/version.rb +1 -1
- data/shen-ruby.gemspec +1 -1
- data/spec/shen_ruby/interop_spec.rb +5 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef53ec1dece12e1268ad947755b50ac7f0dde4b7
|
4
|
+
data.tar.gz: 1f72b4134912bb154027f240c1ef3fa5f65472ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eef86bddefaf28ffa148243ab05c2818bd9fd52365cc7653c5b17d0b7fc5e46acc0e84ce7112bb5333c54584ce4b164db0ac0d42366183e496c4850198d6f3f
|
7
|
+
data.tar.gz: 86e6189fed2c9860123fdf61728bb1b6e0f58a151911f696fad067a5ec16bdf5773ecc84bdb42ca3a6baa6a6cb5168d34426c16297392ca31a562e584488d2bb
|
data/HISTORY.md
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
# ShenRuby Release History
|
2
2
|
|
3
|
-
## 0.12.
|
3
|
+
## 0.12.1 - February 1, 2015
|
4
|
+
### Breaking Changes
|
5
|
+
- The arity of block arguments to Ruby methods no longer needs to be specified. Now all block arguments are denoted by a `&` followed by the function to pass as the block. Any usages of the old syntax, e.g. `&2`, must be updated to `&`.
|
6
|
+
|
7
|
+
## 0.12.0 - January 31, 2015
|
4
8
|
### Features
|
5
9
|
- Shen -> Ruby interop
|
6
10
|
- See README.md for details
|
7
11
|
|
8
|
-
## 0.11.0 - January 15,
|
12
|
+
## 0.11.0 - January 15, 2015
|
9
13
|
### Features
|
10
14
|
- KLambda implementation switched to [Klam](https://github.com/gregspurrier/klam). This has many implications, including:
|
11
15
|
- Significant performance increase. E.g., the Shen Test Suite now runs 2.5 times faster than with ShenRuby 0.10.0.
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ ShenRuby 0.1.0 began to satisfy the first goal by providing a Shen REPL accessib
|
|
14
14
|
## Installation
|
15
15
|
NOTE: ShenRuby requires Ruby 1.9 language features. It is tested with Ruby 2.0.0, 2.1.5, and 2.2.0. It has been lightly tested with JRuby 1.7.17. It is functional with Ruby 1.9.3, however its fixed stack size prevents it from passing the Shen Test Suite (see [Setting Stack Size](setting-stack-size) below).
|
16
16
|
|
17
|
-
ShenRuby 0.12.
|
17
|
+
ShenRuby 0.12.1 is the current release. To install it as a gem, use the following command:
|
18
18
|
|
19
19
|
gem install shen-ruby
|
20
20
|
|
@@ -29,7 +29,7 @@ Once the gem has been installed, the Shen REPL can be launched via the `srrepl`
|
|
29
29
|
released under the Shen license
|
30
30
|
www.shenlanguage.org, version 16
|
31
31
|
running under Ruby, implementation: ruby 2.2.0
|
32
|
-
port 0.12.
|
32
|
+
port 0.12.1 ported by Greg Spurrier
|
33
33
|
|
34
34
|
|
35
35
|
(0-)
|
@@ -162,7 +162,7 @@ Many Ruby methods take a `Hash` object as their final parameter. Ruby provides a
|
|
162
162
|
As in Ruby, the key-arrow-value triples must be the final normal arguments to the method.
|
163
163
|
|
164
164
|
#### Block Parameters
|
165
|
-
In addition to normal arguments, Ruby methods may also accept blocks. A block argument in ShenRuby is denoted by
|
165
|
+
In addition to normal arguments, Ruby methods may also accept blocks. A block argument in ShenRuby is denoted by the symbol `&` followed by a function. These must be the final two elements in the method's argument list.
|
166
166
|
|
167
167
|
For example, to print each character of a string on a separate line using Shen's `pr` and `nl` system functions:
|
168
168
|
|
@@ -170,7 +170,7 @@ For example, to print each character of a string on a separate line using Shen's
|
|
170
170
|
|
171
171
|
Or, to sum the elements of a list using Ruby's `Enumerable#reduce`:
|
172
172
|
|
173
|
-
(rb.reduce [1 2 3] &
|
173
|
+
(rb.reduce [1 2 3] & +)
|
174
174
|
|
175
175
|
This use of `reduce` is possible because Shen's list and vector types are enumerable in ShenRuby.
|
176
176
|
|
data/lib/shen_ruby/rb.shen
CHANGED
@@ -43,8 +43,8 @@
|
|
43
43
|
\\\\ Parsing of method argument lists
|
44
44
|
|
45
45
|
(defcc <method-invocation>
|
46
|
-
Receiver Method <normal-args> <block-
|
47
|
-
[rb-send-block Receiver Method
|
46
|
+
Receiver Method <normal-args> <block-arg> :=
|
47
|
+
[rb-send-block Receiver Method <block-arg> | <normal-args>];
|
48
48
|
Receiver Method <normal-args> :=
|
49
49
|
[rb-send Receiver Method | <normal-args>];)
|
50
50
|
|
@@ -71,17 +71,11 @@
|
|
71
71
|
(and (symbol? Sym)
|
72
72
|
(= (hdstr (str Sym)) "&"))));)
|
73
73
|
|
74
|
-
(defcc <block-
|
75
|
-
<
|
76
|
-
|
77
|
-
(defcc <
|
78
|
-
X :=
|
79
|
-
X := 0 where (= X (intern "&0"));
|
80
|
-
X := 1 where (= X (intern "&1"));
|
81
|
-
X := 2 where (= X (intern "&2"));
|
82
|
-
X := 3 where (= X (intern "&3"));
|
83
|
-
X := 4 where (= X (intern "&4"));
|
84
|
-
X := 5 where (= X (intern "&5"));)
|
74
|
+
(defcc <block-arg>
|
75
|
+
<block-marker> Expr := Expr;)
|
76
|
+
|
77
|
+
(defcc <block-marker>
|
78
|
+
X := X where (= X (intern "&"));)
|
85
79
|
|
86
80
|
(define make-hash-constructor
|
87
81
|
Pairs -> (let Temp (gensym (protect Hash))
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
\\ Convert a Ruby Enumerable to a Shen vector
|
4
4
|
(define rb-to-l
|
5
|
-
Enum -> (reverse (rb.reduce Enum [] &
|
5
|
+
Enum -> (reverse (rb.reduce Enum [] & (/. L X (cons X L))))
|
6
6
|
where (rb.kind_of? Enum rb.#Enumerable)
|
7
7
|
X -> (error (make-string "'~A' is not a Ruby Enumerable" X)))
|
8
8
|
|
data/lib/shen_ruby/version.rb
CHANGED
data/shen-ruby.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.required_ruby_version = ">= 1.9.3"
|
18
18
|
|
19
|
-
s.add_runtime_dependency 'klam', '0.0.
|
19
|
+
s.add_runtime_dependency 'klam', '0.0.6', '0.0.6'
|
20
20
|
|
21
21
|
s.add_development_dependency 'rake', '~> 10.4.2', '>= 10.4.2'
|
22
22
|
s.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.0'
|
@@ -71,22 +71,22 @@ describe 'Shen -> Ruby interop', :type => :functional do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'supports arities other than 1' do
|
74
|
-
expect_shen('(rb.reduce [1 2 3] &
|
75
|
-
expect_shen('(rb.reduce [1 2 3] &
|
76
|
-
expect_shen('(rb.reduce [1 2 3] &
|
74
|
+
expect_shen('(rb.reduce [1 2 3] & (/. A X (+ A X)))').to eq(6)
|
75
|
+
expect_shen('(rb.reduce [1 2 3] & +)').to eq(6)
|
76
|
+
expect_shen('(rb.reduce [1 2 3] & (function +))').to eq(6)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "Shen's list type" do
|
82
82
|
it 'implements Enumerable' do
|
83
|
-
expect_shen('(rb.reduce [1 2 3] &
|
83
|
+
expect_shen('(rb.reduce [1 2 3] & +)').to eq(6)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
describe "Shen's vector type" do
|
88
88
|
it 'implements Enumerable' do
|
89
|
-
expect_shen('(rb.reduce (@v 1 2 3 <>) &
|
89
|
+
expect_shen('(rb.reduce (@v 1 2 3 <>) & +)').to eq(6)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shen-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Spurrier
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.0.
|
20
|
+
version: 0.0.6
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.0.
|
27
|
+
version: 0.0.6
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|