cons 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cons.rb +16 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adc2dd443ece22f7da1622844fccd4a898fe52da
|
4
|
+
data.tar.gz: 33380057b9d34f37a07823b4bb5e634892834105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 163288c65b1325935d6dacee39e14266f06b5424d4f4a116c2c81cce767140e4232640df96d07150658f23917889fd1b58192e68a8c32050ae3e1233e441d474
|
7
|
+
data.tar.gz: c08668a981526aa03a56b3cf845e185e68c597e4123dd6cd395332dbdac4a25639dfa6193ba549e6c66442131da796a7ee6d2fd30143156078d7a1b54f9664d1
|
data/lib/cons.rb
CHANGED
@@ -35,6 +35,15 @@
|
|
35
35
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
36
36
|
# POSSIBILITY OF SUCH DAMAGE.
|
37
37
|
|
38
|
+
class NilClass
|
39
|
+
# http://clhs.lisp.se/Body/f_endp.htm
|
40
|
+
def end?
|
41
|
+
true
|
42
|
+
end
|
43
|
+
|
44
|
+
alias endp end?
|
45
|
+
end
|
46
|
+
|
38
47
|
class Array
|
39
48
|
def to_cons
|
40
49
|
Cons.from_array self
|
@@ -105,6 +114,13 @@ class Cons
|
|
105
114
|
nth n
|
106
115
|
end
|
107
116
|
|
117
|
+
# http://clhs.lisp.se/Body/f_endp.htm
|
118
|
+
def end?
|
119
|
+
@car.nil? and @cdr.nil?
|
120
|
+
end
|
121
|
+
|
122
|
+
alias endp end?
|
123
|
+
|
108
124
|
def nth_eq(n, value)
|
109
125
|
i = nthcdr(n)
|
110
126
|
if i.nil?
|
@@ -310,7 +326,6 @@ class Cons
|
|
310
326
|
## Lots of TODOs from the CLHS
|
311
327
|
|
312
328
|
# TODO - (n)butlast - http://clhs.lisp.se/Body/f_butlas.htm
|
313
|
-
# TODO - endp - http://clhs.lisp.se/Body/f_endp.htm
|
314
329
|
# TODO - ldiff, tailp - http://clhs.lisp.se/Body/f_ldiffc.htm
|
315
330
|
# TODO - list* - http://clhs.lisp.se/Body/f_list_.htm
|
316
331
|
# TODO - member, member-if, member-if-not - http://clhs.lisp.se/Body/f_mem_m.htm
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Mark Gore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
description: |-
|
@@ -43,17 +43,17 @@ require_paths:
|
|
43
43
|
- lib
|
44
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '2.3'
|
49
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
55
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.
|
56
|
+
rubygems_version: 2.0.14.1
|
57
57
|
signing_key:
|
58
58
|
specification_version: 4
|
59
59
|
summary: Lisp-style cons cells for Ruby.
|