notation 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +4 -0
- data/README +12 -1
- data/Rakefile +22 -15
- data/lib/notation.rb +8 -6
- data/notation.gemspec +4 -4
- data/test/test_notation.rb +4 -3
- metadata +45 -38
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f71600bdd1d1131f1e23cf9c553b845326e8a5c5
|
4
|
+
data.tar.gz: 5475de1bc916ca9fba2bd61d8298a94f46d51eef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e6e8659943cb09e3c87b5b5008d80306f0b6d0240bd385151d510471d554986468034589ca9f6fa6a8d296d773e6e82cd96f2416f5f5f4f00a1ad9b5eca77b4f
|
7
|
+
data.tar.gz: 021fcbcd4c87cfa510c6c087b7787065076363152fdfd34fd0e7f80b474e9390471ae55f27cc7977ed5158d194b4e6a93a858a41f338c3b0efa133cdb2e01368
|
data/CHANGES
CHANGED
data/README
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
gem install notation
|
6
6
|
|
7
7
|
= Synopsis
|
8
|
-
# Run with -Ku
|
8
|
+
# Run with -Ku if using Ruby 1.8.
|
9
9
|
require 'notation'
|
10
10
|
|
11
11
|
λ { puts "hello" } # => "Hello"
|
@@ -16,6 +16,17 @@
|
|
16
16
|
This library was inspired by the programming language Fortress, an offshoot
|
17
17
|
of Fortran, created by Sun. Fortress supports unicode operators baked into
|
18
18
|
the language.
|
19
|
+
|
20
|
+
= Restrictions
|
21
|
+
The ability to add unicode methods is limited to method names that have
|
22
|
+
no receiver. This is a limitation of the Ruby parser.
|
23
|
+
|
24
|
+
= Copyright
|
25
|
+
(C) 2009-2014 Daniel J. Berger
|
26
|
+
All Rights Reserved
|
27
|
+
|
28
|
+
= License
|
29
|
+
Artistic 2.0
|
19
30
|
|
20
31
|
= Author
|
21
32
|
Daniel Berger
|
data/Rakefile
CHANGED
@@ -1,26 +1,33 @@
|
|
1
1
|
require 'rake'
|
2
|
+
require 'rake/clean'
|
2
3
|
require 'rake/testtask'
|
3
|
-
include Config
|
4
4
|
|
5
|
-
|
6
|
-
task :install_lib do
|
7
|
-
cp 'lib/notation.rb', CONFIG['sitelibdir'], :verbose => true
|
8
|
-
end
|
5
|
+
CLEAN.include("**/*.gem", "**/*.rbc")
|
9
6
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
namespace :gem do
|
8
|
+
desc 'Build the notation gem'
|
9
|
+
task :create => [:clean] do
|
10
|
+
spec = eval(IO.read('notation.gemspec'))
|
11
|
+
if Gem::VERSION.to_f < 2.0
|
12
|
+
Gem::Builder.new(spec).build
|
13
|
+
else
|
14
|
+
require 'rubygems/package'
|
15
|
+
Gem::Package.build(spec)
|
16
|
+
end
|
17
|
+
end
|
15
18
|
|
16
|
-
desc 'Install the notation library as a gem'
|
17
|
-
task :
|
18
|
-
|
19
|
-
|
19
|
+
desc 'Install the notation library as a gem'
|
20
|
+
task :install => [:create] do
|
21
|
+
file = Dir["*.gem"].first
|
22
|
+
sh "gem install -l #{file}"
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
Rake::TestTask.new do |t|
|
27
|
+
task :test => :clean
|
23
28
|
t.warning = true
|
24
29
|
t.verbose = true
|
25
|
-
t.ruby_opts << '-Ku'
|
30
|
+
t.ruby_opts << '-Ku' if RUBY_VERSION.to_f < 1.9
|
26
31
|
end
|
32
|
+
|
33
|
+
task :default => :test
|
data/lib/notation.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Run with -Ku if using Ruby 1.8.
|
2
4
|
|
3
5
|
module Kernel
|
4
6
|
# Version of the notation library
|
5
|
-
NOTATION_VERSION = '0.1.
|
7
|
+
NOTATION_VERSION = '0.1.1'
|
6
8
|
|
7
9
|
# Make lambda a true lambda
|
8
10
|
#
|
9
11
|
# Example:
|
10
12
|
# λ { puts 'Hello' }.call => 'Hello'
|
11
|
-
#
|
13
|
+
#
|
12
14
|
alias λ proc
|
13
|
-
|
15
|
+
|
14
16
|
# Sigma, i.e. the sum of all elements.
|
15
17
|
#
|
16
18
|
# Example:
|
@@ -21,12 +23,12 @@ module Kernel
|
|
21
23
|
args.each{ |e| sum += e }
|
22
24
|
sum
|
23
25
|
end
|
24
|
-
|
26
|
+
|
25
27
|
# Square root
|
26
28
|
#
|
27
29
|
# Example:
|
28
30
|
# √ 49 => 7.0
|
29
|
-
#
|
31
|
+
#
|
30
32
|
def √(root)
|
31
33
|
Math.sqrt(root)
|
32
34
|
end
|
data/notation.gemspec
CHANGED
@@ -2,17 +2,17 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'notation'
|
5
|
-
gem.version = '0.1.
|
5
|
+
gem.version = '0.1.1'
|
6
6
|
gem.author = 'Daniel J. Berger'
|
7
7
|
gem.email = 'djberg96@gmail.com'
|
8
|
-
gem.
|
8
|
+
gem.license = 'Artistic 2.0'
|
9
|
+
gem.homepage = 'https://github.com/djberg96/notation'
|
9
10
|
gem.summary = 'Unicode symbols that can be used as methods.'
|
10
11
|
gem.test_file = 'test/test_notation.rb'
|
11
|
-
gem.has_rdoc = true
|
12
12
|
gem.files = Dir['**/*'].delete_if{ |item| item.include?('git') }
|
13
13
|
|
14
14
|
gem.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
|
15
|
-
gem.
|
15
|
+
gem.add_development_dependency('rake')
|
16
16
|
|
17
17
|
gem.description = <<-EOF
|
18
18
|
The notation library provides unicode symbols that you can use as
|
data/test/test_notation.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
#######################################################################
|
2
3
|
# test_notation.rb
|
3
4
|
#
|
@@ -9,19 +10,19 @@ require 'notation'
|
|
9
10
|
|
10
11
|
class TC_Notation < Test::Unit::TestCase
|
11
12
|
def test_version
|
12
|
-
assert_equal('0.1.
|
13
|
+
assert_equal('0.1.1', NOTATION_VERSION)
|
13
14
|
end
|
14
15
|
|
15
16
|
def test_sigma
|
16
17
|
assert_respond_to(Kernel, :∑)
|
17
18
|
assert_equal(6, ∑(1,2,3))
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
def test_square_root
|
21
22
|
assert_respond_to(Kernel, :√)
|
22
23
|
assert_equal(7.0, √(49))
|
23
24
|
end
|
24
|
-
|
25
|
+
|
25
26
|
def test_lambda
|
26
27
|
assert_equal('hello', λ { 'hello' }.call)
|
27
28
|
end
|
metadata
CHANGED
@@ -1,63 +1,70 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: notation
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Daniel J. Berger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: |2
|
28
|
+
The notation library provides unicode symbols that you can use as
|
29
|
+
methods instead of using standard method names.
|
17
30
|
email: djberg96@gmail.com
|
18
31
|
executables: []
|
19
|
-
|
20
32
|
extensions: []
|
21
|
-
|
22
|
-
extra_rdoc_files:
|
33
|
+
extra_rdoc_files:
|
23
34
|
- CHANGES
|
24
35
|
- README
|
25
36
|
- MANIFEST
|
26
|
-
files:
|
37
|
+
files:
|
27
38
|
- CHANGES
|
28
|
-
- lib/notation.rb
|
29
39
|
- MANIFEST
|
30
|
-
- notation.gemspec
|
31
|
-
- Rakefile
|
32
40
|
- README
|
41
|
+
- Rakefile
|
42
|
+
- lib/notation.rb
|
43
|
+
- notation.gemspec
|
33
44
|
- test/test_notation.rb
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
45
|
+
homepage: https://github.com/djberg96/notation
|
46
|
+
licenses:
|
47
|
+
- Artistic 2.0
|
48
|
+
metadata: {}
|
38
49
|
post_install_message:
|
39
50
|
rdoc_options: []
|
40
|
-
|
41
|
-
require_paths:
|
51
|
+
require_paths:
|
42
52
|
- lib
|
43
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
45
55
|
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
|
49
|
-
|
50
|
-
requirements:
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
51
60
|
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
version:
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
55
63
|
requirements: []
|
56
|
-
|
57
|
-
|
58
|
-
rubygems_version: 1.3.5
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 2.4.1
|
59
66
|
signing_key:
|
60
|
-
specification_version:
|
67
|
+
specification_version: 4
|
61
68
|
summary: Unicode symbols that can be used as methods.
|
62
|
-
test_files:
|
69
|
+
test_files:
|
63
70
|
- test/test_notation.rb
|