mll 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (9) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +3 -0
  4. data/README.md +28 -0
  5. data/Rakefile +9 -0
  6. data/lib/mll.rb +30 -0
  7. data/mll.gemspec +22 -0
  8. data/spec/_spec.rb +26 -0
  9. metadata +79 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7adfea3942afe7d69c17c7eb21543b42e550b97b
4
+ data.tar.gz: a435aa21974c01485aea5ade3ebd024cb101b0f0
5
+ SHA512:
6
+ metadata.gz: c56f1539a27872154f60e742346852a5ee3d3fae77f330361b76dd7e289427c84ef569917cb8b8763a49c3f249fa0e886432c621d5ee008c4e2670fac45dea89
7
+ data.tar.gz: 8d7bdb509af3a9206dfa2b31c5f1aa428b7763c26ac75f6d7e48536a14b52fab99c3cf511e8201443e8219a9dc2082a26be9089efedf63fad3c12c92fcedd312
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,28 @@
1
+ # MLL (Mathematica Language Library)
2
+
3
+ Этот гем не ставит перед собой цель полностью имитировать типы данных, синтаксис Математики, или научить Ruby крутым визуализациям. Целью является вложить в Ruby мощь стандартной библиотеки. Прежде всего, List manipulation. В перспективе визуализация возможна при помощи других гемов.
4
+
5
+ ## Usage
6
+
7
+ Планируется несколько способов использования этой библиотеки -- как доступ к ней через `MLL::`, так и манкипатчинг стандартных типов, таких как Numeric и Array.
8
+
9
+ ### Examples:
10
+
11
+ MLL::range(3).to_a #=> [1, 2, 3]
12
+ MLL::range(range(3)).map(&:to_a) #=> [[1], [1, 2], [1, 2, 3]]
13
+
14
+ ## Installation
15
+
16
+ Add this line to your application's Gemfile:
17
+
18
+ ```ruby
19
+ gem 'mll'
20
+ ```
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install mll
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |t|
5
+ t.verbose = false
6
+ end
7
+
8
+ task :default => :spec
9
+
@@ -0,0 +1,30 @@
1
+ # http://reference.wolfram.com/language/guide/LanguageOverview.html
2
+ module MLL
3
+
4
+ # http://reference.wolfram.com/language/guide/ListManipulation.html
5
+
6
+ # http://reference.wolfram.com/language/guide/ConstructingLists.html
7
+
8
+ # http://reference.wolfram.com/language/ref/Range.html
9
+ def self.range *args
10
+ # see also http://ruby-doc.org/core-1.9.3/Range.html#method-i-step
11
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 1..3)") unless (1..3).include? args.size
12
+ if args.size == 1
13
+ if args[0].respond_to?(:map)
14
+ args[0].map &method(:range)
15
+ else
16
+ range 1, args[0]
17
+ end
18
+ else
19
+ Range.new(args[0], args[1]).step(args[2] || 1)
20
+ end
21
+ end
22
+
23
+ # http://reference.wolfram.com/language/guide/ElementsOfLists.html
24
+ # http://reference.wolfram.com/language/guide/RearrangingAndRestructuringLists.html
25
+ # http://reference.wolfram.com/language/guide/ApplyingFunctionsToLists.html
26
+ # http://reference.wolfram.com/language/guide/MathematicalAndCountingOperationsOnLists.html
27
+
28
+ # http://reference.wolfram.com/language/guide/FunctionalProgramming.html
29
+
30
+ end
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "mll"
3
+ spec.version = "0.0.1"
4
+ spec.authors = ["Victor Maslov"]
5
+ spec.email = ["nakilon@gmail.com"]
6
+ spec.summary = "Mathematica Language Library in Ruby"
7
+ spec.description = ""
8
+ # spec.homepage = ""
9
+ spec.license = "MIT"
10
+
11
+ spec.files = `git ls-files -z`.split("\x0")
12
+ # spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
13
+ spec.test_files = ["spec/"]
14
+ # spec.require_paths = ["lib"]
15
+
16
+ spec.add_development_dependency "bundler", "~> 1.7"
17
+ # spec.add_development_dependency "rake", "~> 10.0"
18
+ spec.add_development_dependency "rspec", "~> 3.1.0"
19
+
20
+ spec.required_ruby_version = ">= 2.0.0"
21
+ # spec.post_install_message = ""
22
+ end
@@ -0,0 +1,26 @@
1
+ require_relative File.join "..", "lib", "mll"
2
+
3
+ describe "mll" do
4
+
5
+ describe "range" do
6
+
7
+ example "range(n)" do
8
+ expect(MLL::range(5).to_a).to eq [1,2,3,4,5]
9
+ end
10
+ example "range(imin, imax)" do
11
+ expect(MLL::range(2,5).to_a).to eq [2,3,4,5]
12
+ end
13
+ example "range(imin, imax, id)" do
14
+ expect(MLL::range(2,5,2).to_a).to eq [2,4]
15
+ expect(MLL::range(2,6,2).to_a).to eq [2,4,6]
16
+ end
17
+ example "range([n1,n2])" do
18
+ expect(MLL::range([2,3]).map(&:to_a)).to eq [[1,2],[1,2,3]]
19
+ end
20
+ example "range(range(n))" do
21
+ expect(MLL::range(MLL::range(3)).map(&:to_a)).to eq [[1],[1,2],[1,2,3]]
22
+ end
23
+
24
+ end
25
+
26
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mll
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Victor Maslov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 3.1.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 3.1.0
41
+ description: ''
42
+ email:
43
+ - nakilon@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .rspec
49
+ - Gemfile
50
+ - README.md
51
+ - Rakefile
52
+ - lib/mll.rb
53
+ - mll.gemspec
54
+ - spec/_spec.rb
55
+ homepage:
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: 2.0.0
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.0.14
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Mathematica Language Library in Ruby
79
+ test_files: []