funtools 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/funtools/recursion.rb +17 -0
- data/lib/funtools.rb +3 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 036d1878297cacd7200f654099de5562013960c0
|
4
|
+
data.tar.gz: c9b7c2d23b5703886d1ed1259c48512d049e555c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f6c44f96b373b4f0eab32e9a83c962d803172b81e4f4fa6e5a0eed4237ea2955ceb760d154b0fbda1e169c139b9de55f6f50f49ad8adb04d277d8f87e8b884d
|
7
|
+
data.tar.gz: d72c6f65e29fe7342e20d47b1c1fb14ede77ad996d970af8ac6ab5b53caf5322e6dd386ae3f8727ebdca6923b967edd03c7571bd326f511c7028b733ed592047
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
class Object
|
4
|
+
# Public: Define a method in the current scope which will execute a given
|
5
|
+
# block recursively until a fixpoint is reached.
|
6
|
+
#
|
7
|
+
# sym - Symbol defining the name of the method to be created.
|
8
|
+
# block - Block containing the logic for the function to be created.
|
9
|
+
#
|
10
|
+
# Returns nothing.
|
11
|
+
def deftail(sym, &block)
|
12
|
+
self.send(:define_method, sym) do |*n|
|
13
|
+
last = nil
|
14
|
+
[1].cycle.reduce(n) { |c, e| break c if last == c; last = c; block[c] }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/funtools.rb
ADDED
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: funtools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tina Wuest
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Tools to assist in programming in a more functional style
|
14
|
+
email: tina@wuest.me
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/funtools.rb
|
20
|
+
- lib/funtools/recursion.rb
|
21
|
+
homepage: https://gitlab.com/wuest/funtools
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.9.3
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.2.2
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Functional programming tools
|
45
|
+
test_files: []
|