lambdas 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Jim Deville
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2012 Jim Deville
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Lambdas
2
+
3
+ A collection of lambdas to help you code
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'lambdas'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install lambdas
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here (coming soon)
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require 'bundler'
2
+ require 'rake/clean'
3
+
4
+ require 'rspec/core/rake_task'
5
+
6
+ gem 'rdoc' # we need the installed RDoc gem, not the system one
7
+ require 'rdoc/task'
8
+
9
+ include Rake::DSL
10
+
11
+ Bundler::GemHelper.install_tasks
12
+
13
+
14
+ RSpec::Core::RakeTask.new do |t|
15
+ # Put spec opts in a file named .rspec in root
16
+ end
17
+
18
+
19
+ Rake::RDocTask.new do |rd|
20
+
21
+ rd.main = "README.rdoc"
22
+
23
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
24
+ end
25
+
26
+ task :default => :spec
data/lambdas.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/lambdas/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Jim Deville"]
6
+ gem.email = ["james.deville@gmail.com"]
7
+ gem.description = %q{A collection of lambdas for your enjoyment}
8
+ gem.summary = %q{A collection of lambdas to use for programming tasks}
9
+ gem.homepage = "http://github.com/jredville/lambdas"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "lambdas"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Lambdas::VERSION
17
+ gem.add_development_dependency('rdoc')
18
+ gem.add_development_dependency('rake','~> 0.9.2')
19
+ gem.add_development_dependency('rspec')
20
+ end
@@ -0,0 +1,3 @@
1
+ module Lambdas
2
+ VERSION = "0.0.1"
3
+ end
data/lib/lambdas.rb ADDED
@@ -0,0 +1,29 @@
1
+ module Lambdas
2
+ extend self
3
+ def l_true
4
+ l_value(true)
5
+ end
6
+
7
+ def l_false
8
+ l_value(false)
9
+ end
10
+
11
+ def l_nil
12
+ l_value(nil)
13
+ end
14
+
15
+ def l_value(val)
16
+ lambda { val }
17
+ end
18
+
19
+ def l_identity
20
+ lambda {|a| a}
21
+ end
22
+
23
+ def l_y
24
+ lambda { |f| f.call(f) }.call(
25
+ lambda do |g|
26
+ yield(lambda { |*n| g.call(g).call(*n) })
27
+ end)
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ require 'lambdas'
2
+
3
+ describe "Included lambas" do
4
+ it "includes a true lambda" do
5
+ Lambdas.l_true.call.should be_true
6
+ end
7
+
8
+ it "includes a false lambda" do
9
+ Lambdas.l_false.call.should be_false
10
+ end
11
+
12
+ it "includes a nil lambda" do
13
+ Lambdas.l_nil.call.should be_nil
14
+ end
15
+
16
+ it "includes a value lambda" do
17
+ Lambdas.l_value(1).call.should == 1
18
+ end
19
+
20
+ it "includes an identity lambda" do
21
+ Lambdas.l_identity.call(1).should == 1
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lambdas
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jim Deville
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.9.2
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.9.2
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: A collection of lambdas for your enjoyment
63
+ email:
64
+ - james.deville@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE
72
+ - LICENSE.txt
73
+ - README.md
74
+ - Rakefile
75
+ - lambdas.gemspec
76
+ - lib/lambdas.rb
77
+ - lib/lambdas/version.rb
78
+ - spec/lambdas_spec.rb
79
+ homepage: http://github.com/jredville/lambdas
80
+ licenses: []
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 1.8.24
100
+ signing_key:
101
+ specification_version: 3
102
+ summary: A collection of lambdas to use for programming tasks
103
+ test_files:
104
+ - spec/lambdas_spec.rb