nydp 0.1.13.1 → 0.1.13.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4f450a23c8998d99bc57a5c23a0c87c06566322
4
- data.tar.gz: 3256bb897e0a2e6a4e7da105ff389dc422f37510
3
+ metadata.gz: c7374115cdd9df0c64b65aaf6321b23f5eac50ef
4
+ data.tar.gz: 9d108fd6697da14be302dec3da20926de83ff6a2
5
5
  SHA512:
6
- metadata.gz: 0956fc389dbe051a444cfd2dbcf3de1f5b8990427fb567618cf51a4c0941bb1fc286dbf0cff3a6f70f41567ce86629b77e76f59735837269bb244bcda3c5985a
7
- data.tar.gz: 7c72d7bfd3ee47c9e0f6d75ff86f9b679d1ec803db68cf899b46e3878f53ecd50d77bfbba40a942dcdf277245d431adbe121aa43cc89397c7a5d9165cdaf0d02
6
+ metadata.gz: 46702e5f71b4cb0335773567020bb223839b5f50702583af33d6469fcfda6fe6a130b00d5b69cc9bf40cd344b8fb6a7b1ae628bfb539488dc0060711bef9d0af
7
+ data.tar.gz: 05028cdc5301c4670c053b95aead31e179784915c35096153e124e3d3d2405392767189dcbb4d15f8960599cc8ef2bbdb23be242bd9d2ff924173e5f66d13a97
@@ -27,16 +27,20 @@
27
27
  (def bm-3-arg-times-call () (* 23 24 25))
28
28
  (def bm-4-arg-times-call () (* 23 24 25 26))
29
29
 
30
+ (def bm-complicated-0 (a b c) (a (+ 1 b) (+ 1 c)))
31
+
32
+ (def bm-complicated ()
33
+ (bm-complicated-0 +
34
+ (bm-complicated-0 * 3 (bm-complicated-0 + 3 6))
35
+ (bm-complicated-0 - 10 (bm-complicated-0 - 13 8))))
36
+
30
37
  (def rbs (name)
31
38
  (let summary nil
32
- ;; (push (bm "pythag" bm-pythag 10 20) summary)
33
- ;; (push (bm "zero arg call" bm-zero-arg-call 10 100) summary)
34
- ;; (push (bm "one arg call" bm-one-arg-call 10 100) summary)
35
- ;; (push (bm "two arg call" bm-two-arg-call 10 100) summary)
36
- ;; (push (bm "three arg call" bm-three-arg-call 10 100) summary)
37
- (push (bm "0 arg times" bm-0-arg-times-call 10 10000) summary)
38
- (push (bm "1 arg times" bm-1-arg-times-call 10 10000) summary)
39
- (push (bm "2 arg times" bm-2-arg-times-call 10 10000) summary)
40
- (push (bm "3 arg times" bm-3-arg-times-call 10 10000) summary)
41
- (push (bm "4 arg times" bm-4-arg-times-call 10 10000) summary)
39
+ (push (bm "pythag " bm-pythag 10 10) summary)
40
+ (push (bm "recursive " bm-complicated 10 20000) summary)
41
+ (push (bm "0 arg times" bm-0-arg-times-call 5 40000) summary)
42
+ (push (bm "1 arg times" bm-1-arg-times-call 5 40000) summary)
43
+ (push (bm "2 arg times" bm-2-arg-times-call 5 40000) summary)
44
+ (push (bm "3 arg times" bm-3-arg-times-call 5 40000) summary)
45
+ (push (bm "4 arg times" bm-4-arg-times-call 5 40000) summary)
42
46
  (each s summary (p name " " s))))
@@ -138,9 +138,4 @@ class Nydp::Pair
138
138
  end
139
139
  self
140
140
  end
141
-
142
- def repush instructions, _
143
- instructions.push self
144
- end
145
-
146
141
  end
@@ -22,14 +22,7 @@ module Nydp
22
22
  def inspect ; "nil" ; end
23
23
  def nydp_type ; :nil ; end
24
24
  def to_ruby ; nil ; end
25
-
26
- def execute vm
27
- vm.push_arg self
28
- end
29
-
30
- def repush _, contexts
31
- contexts.pop
32
- end
25
+ def execute vm ; vm.push_arg self ; end
33
26
  end
34
27
 
35
28
  @@nil = Nil.new
@@ -1,3 +1,3 @@
1
1
  module Nydp
2
- VERSION = "0.1.13.1"
2
+ VERSION = "0.1.13.2"
3
3
  end
@@ -15,13 +15,16 @@ module Nydp
15
15
 
16
16
  def thread expr=nil
17
17
  instructions.push expr if expr
18
- while instructions.length > 0
18
+ while instructions.first
19
19
  begin
20
- self.current_context = contexts.last
21
- ii = instructions.pop
22
- i = ii.car
23
- ii.cdr.repush instructions, contexts
24
- i.execute(self)
20
+ thisi = instructions.pop
21
+ if thisi.cdr.is_a? Nydp::Nil
22
+ self.current_context = contexts.pop
23
+ else
24
+ self.current_context = contexts.last
25
+ instructions.push thisi.cdr
26
+ end
27
+ thisi.car.execute(self)
25
28
  rescue Exception => e
26
29
  handle_error e
27
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nydp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13.1
4
+ version: 0.1.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conan Dalton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-27 00:00:00.000000000 Z
11
+ date: 2016-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler