prelude 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,8 +1,11 @@
1
1
  = CHANGELOG
2
2
 
3
- $Id: CHANGELOG 7 2006-09-06 17:03:26Z prelude $
3
+ $Id: CHANGELOG 17 2006-09-17 18:03:15Z prelude $
4
4
 
5
- == 09/06/06 - Release 0.0.2
5
+ == 09/17/06 - Release 0.0.3
6
+ * Converted List from being functional-like to fully functional, i.e., all its methods return functions.
7
+
8
+ == 09/06/06 - Release 0.0.2
6
9
 
7
10
  * Expanded README and moved references from sources into it.
8
11
  * Fixed Tuple's implementation.
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  = Prelude - a Haskell-like functional library
2
2
 
3
- $Id: README 7 2006-09-06 17:03:26Z prelude $
3
+ $Id: README 17 2006-09-17 18:03:15Z prelude $
4
4
 
5
5
  *WARNING* <tt>The project is still in a very preliminary state. Only
6
6
  List was partially implemented. Feel free to contribute.</tt>
@@ -119,7 +119,7 @@ itself, see http://nomaware.com/monads/html/index.html to get
119
119
  started. More monadic resources are here:
120
120
  http://haskell.org/haskellwiki/Books_and_tutorials#Using_monads
121
121
 
122
- === What else
122
+ === What else?
123
123
 
124
124
  These features will be nice to have in a second release of the library:
125
125
 
@@ -127,7 +127,7 @@ These features will be nice to have in a second release of the library:
127
127
 
128
128
  * Tools for automatic program verification and algebraic proofs
129
129
 
130
- * What else
130
+ * What else?
131
131
 
132
132
 
133
133
  == What's in a name
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # $Id: Rakefile 7 2006-09-06 17:03:26Z prelude $
2
+ # $Id: Rakefile 18 2006-09-17 23:33:58Z prelude $
3
3
  #
4
4
  # This file is part of the Prelude library that provides tools to
5
5
  # enable Haskell style functional programming in Ruby.
@@ -23,6 +23,12 @@
23
23
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
24
  #++
25
25
 
26
+ #--
27
+ # To run:
28
+ # c:/tools/trunk/ruby-1.8.4_20/bin/rake.bat
29
+ #
30
+ #++
31
+
26
32
  require 'rubygems'
27
33
  require 'rake'
28
34
  require 'rake/testtask'
@@ -31,6 +37,7 @@ require 'rake/packagetask'
31
37
  require 'rake/gempackagetask'
32
38
  require 'rake/contrib/rubyforgepublisher'
33
39
  require 'fileutils'
40
+ require 'pp'
34
41
 
35
42
  require File.join(File.dirname(__FILE__), 'lib', 'prelude')
36
43
 
@@ -47,12 +54,13 @@ RUBY_FORGE_USER = "prelude"
47
54
  desc "Default Task"
48
55
  task :default => [ :test ]
49
56
 
50
- # Run the unit tests
51
- Rake::TestTask.new { |t|
52
- t.libs << "test"
53
- t.test_files = Dir['test/ts_*.rb']
54
- t.verbose = true
55
- }
57
+ task :test do |x|
58
+ Rake::TestTask.new { |t|
59
+ t.libs << "test"
60
+ t.test_files = Dir['test/ts_*.rb']
61
+ t.verbose = true
62
+ }
63
+ end # :test
56
64
 
57
65
  file 'doc/index.html' => ['misc/rdoc_template.rb' ]
58
66
  task :rdoc => ['doc/index.html']
@@ -80,31 +88,42 @@ task :gem => [ :clobber, :rdoc ]
80
88
  # ~..>tar xvf prelude-0.0.1.gem; gunzip data.tar.gz metadata.gz; tar xvf data.tar; cat metadata
81
89
 
82
90
  spec = Gem::Specification.new do |s|
83
- s.platform = Gem::Platform::RUBY
84
- s.name = PKG_NAME
85
- s.summary = "Haskell-like functional library"
86
- s.description = %q{Enables Ruby programmers to use higher-order functions, monads, and other Haskell features.}
87
- s.version = PKG_VERSION
88
-
89
- s.author = "Ivan K. and APP Design, Inc."
90
- s.email = "prelude@rubyforge.org"
91
- s.rubyforge_project = "prelude"
92
- s.homepage = "http://prelude.rubyforge.org"
91
+ s.platform = Gem::Platform::RUBY
92
+ s.name = PKG_NAME
93
+ s.version = PKG_VERSION
94
+ s.summary = 'Haskell-like functional library'
95
+ s.description = 'Enables Ruby programmers to use higher-order functions, monads, and other Haskell features.'
96
+ s.author = 'Ivan K. and APP Design, Inc.'
97
+ s.email = 'prelude@rubyforge.org'
98
+ s.rubyforge_project = 'prelude'
99
+ s.homepage = 'http://prelude.rubyforge.org'
93
100
 
94
101
  s.has_rdoc = true
95
102
  s.requirements << 'none'
96
103
  s.require_path = 'lib'
97
104
  s.autorequire = 'prelude'
98
105
 
99
- s.files = [ "Rakefile", "README", "TODO", "CHANGELOG", "COPYING" ]
100
- s.files += Dir.glob( "doc/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
101
- s.files += Dir.glob( "examples/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
102
- s.files += Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
103
- s.files += Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
104
-
105
- s.test_files = Dir.glob( "test/**/ts_*rb" ).delete_if { |item| item.include?( "\.svn" ) }
106
-
106
+ [
107
+ "Rakefile",
108
+ "README",
109
+ "TODO",
110
+ "CHANGELOG",
111
+ "COPYING",
112
+ "doc/**/*",
113
+ "examples/**/*",
114
+ "lib/**/*",
115
+ "test/**/*"
116
+ ].each do |i|
117
+ s.files += Dir.glob(i).delete_if do
118
+ |x| x =~ /.*~/
119
+ end
120
+ end
121
+ puts "Files included into the GEM:"
122
+ pp s.files
123
+
124
+ s.test_files = Dir.glob( "test/**/ts_*rb" )
107
125
  end
126
+
108
127
  Rake::GemPackageTask.new(spec) do |p|
109
128
  p.gem_spec = spec
110
129
  p.need_tar = true
@@ -0,0 +1,198 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Kernel</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Kernel</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/prelude_rb.html">
59
+ lib/prelude.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000113">caller_method</a>&nbsp;&nbsp;
84
+ <a href="#M000114">silence_warnings</a>&nbsp;&nbsp;
85
+ <a href="#M000112">this_method</a>&nbsp;&nbsp;
86
+ </div>
87
+ </div>
88
+
89
+ </div>
90
+
91
+
92
+ <!-- if includes -->
93
+
94
+ <div id="section">
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <!-- if method_list -->
104
+ <div id="methods">
105
+ <h3 class="section-bar">Public Instance methods</h3>
106
+
107
+ <div id="method-M000113" class="method-detail">
108
+ <a name="M000113"></a>
109
+
110
+ <div class="method-heading">
111
+ <a href="#M000113" class="method-signature">
112
+ <span class="method-name">caller_method</span><span class="method-args">()</span>
113
+ </a>
114
+ </div>
115
+
116
+ <div class="method-description">
117
+ <p>
118
+ Method object for the caller of the currently executing method
119
+ </p>
120
+ <p><a class="source-toggle" href="#"
121
+ onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
122
+ <div class="method-source-code" id="M000113-source">
123
+ <pre>
124
+ <span class="ruby-comment cmt"># File lib/prelude.rb, line 118</span>
125
+ 118: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">caller_method</span>
126
+ 119: <span class="ruby-identifier">name</span> = (<span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">caller</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/`([^']*)'/</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">$1</span>)
127
+ 120: <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;self.method(\&quot;#{name}\&quot;.to_sym)&quot;</span>, <span class="ruby-identifier">binding</span>
128
+ 121: <span class="ruby-keyword kw">end</span>
129
+ </pre>
130
+ </div>
131
+ </div>
132
+ </div>
133
+
134
+ <div id="method-M000114" class="method-detail">
135
+ <a name="M000114"></a>
136
+
137
+ <div class="method-heading">
138
+ <a href="#M000114" class="method-signature">
139
+ <span class="method-name">silence_warnings</span><span class="method-args">() {|| ...}</span>
140
+ </a>
141
+ </div>
142
+
143
+ <div class="method-description">
144
+ <p>
145
+ Shuts up Ruby&#8217;s warning.
146
+ </p>
147
+ <p><a class="source-toggle" href="#"
148
+ onclick="toggleCode('M000114-source');return false;">[Source]</a></p>
149
+ <div class="method-source-code" id="M000114-source">
150
+ <pre>
151
+ <span class="ruby-comment cmt"># File lib/prelude.rb, line 124</span>
152
+ 124: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">silence_warnings</span>
153
+ 125: <span class="ruby-identifier">old_verbose</span>, <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-identifier">$VERBOSE</span>, <span class="ruby-keyword kw">nil</span>
154
+ 126: <span class="ruby-keyword kw">yield</span>
155
+ 127: <span class="ruby-keyword kw">ensure</span>
156
+ 128: <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-identifier">old_verbose</span>
157
+ 129: <span class="ruby-keyword kw">end</span>
158
+ </pre>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <div id="method-M000112" class="method-detail">
164
+ <a name="M000112"></a>
165
+
166
+ <div class="method-heading">
167
+ <a href="#M000112" class="method-signature">
168
+ <span class="method-name">this_method</span><span class="method-args">()</span>
169
+ </a>
170
+ </div>
171
+
172
+ <div class="method-description">
173
+ <p>
174
+ Method object for currently executing method
175
+ </p>
176
+ <p><a class="source-toggle" href="#"
177
+ onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
178
+ <div class="method-source-code" id="M000112-source">
179
+ <pre>
180
+ <span class="ruby-comment cmt"># File lib/prelude.rb, line 112</span>
181
+ 112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">this_method</span>
182
+ 113: <span class="ruby-identifier">name</span> = (<span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">caller</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/`([^']*)'/</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">$1</span>)
183
+ 114: <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;self.method(\&quot;#{name}\&quot;.to_sym)&quot;</span>, <span class="ruby-identifier">binding</span>
184
+ 115: <span class="ruby-keyword kw">end</span>
185
+ </pre>
186
+ </div>
187
+ </div>
188
+ </div>
189
+
190
+
191
+ </div>
192
+
193
+
194
+ </div>
195
+
196
+
197
+ </body>
198
+ </html>
@@ -88,6 +88,15 @@
88
88
 
89
89
  </div>
90
90
 
91
+ <div id="method-list">
92
+ <h3 class="section-bar">Methods</h3>
93
+
94
+ <div class="name-list">
95
+ <a href="#M000007">empty_list_error</a>&nbsp;&nbsp;
96
+ <a href="#M000009">get_proc</a>&nbsp;&nbsp;
97
+ <a href="#M000008">missing_function_error</a>&nbsp;&nbsp;
98
+ </div>
99
+ </div>
91
100
 
92
101
  </div>
93
102
 
@@ -99,8 +108,10 @@
99
108
  <div id="class-list">
100
109
  <h3 class="section-bar">Classes and Modules</h3>
101
110
 
102
- Class <a href="Prelude/List.html" class="link">Prelude::List</a><br />
103
- Class <a href="Prelude/Monad.html" class="link">Prelude::Monad</a><br />
111
+ Module <a href="Prelude/List.html" class="link">Prelude::List</a><br />
112
+ Module <a href="Prelude/Monad.html" class="link">Prelude::Monad</a><br />
113
+ Class <a href="Prelude/EmptyListError.html" class="link">Prelude::EmptyListError</a><br />
114
+ Class <a href="Prelude/MissingFunctionError.html" class="link">Prelude::MissingFunctionError</a><br />
104
115
  Class <a href="Prelude/Tuple.html" class="link">Prelude::Tuple</a><br />
105
116
 
106
117
  </div>
@@ -113,7 +124,17 @@ Class <a href="Prelude/Tuple.html" class="link">Prelude::Tuple</a><br />
113
124
  <tr class="top-aligned-row context-row">
114
125
  <td class="context-item-name">VERSION</td>
115
126
  <td>=</td>
116
- <td class="context-item-value">'0.0.2'</td>
127
+ <td class="context-item-value">'0.0.3'</td>
128
+ </tr>
129
+ <tr class="top-aligned-row context-row">
130
+ <td class="context-item-name">Id</td>
131
+ <td>=</td>
132
+ <td class="context-item-value">lambda { |x| x }</td>
133
+ <td width="3em">&nbsp;</td>
134
+ <td class="context-item-desc">
135
+ Returns function that returns its argument
136
+
137
+ </td>
117
138
  </tr>
118
139
  </table>
119
140
  </div>
@@ -125,6 +146,92 @@ Class <a href="Prelude/Tuple.html" class="link">Prelude::Tuple</a><br />
125
146
 
126
147
 
127
148
  <!-- if method_list -->
149
+ <div id="methods">
150
+ <h3 class="section-bar">Public Instance methods</h3>
151
+
152
+ <div id="method-M000007" class="method-detail">
153
+ <a name="M000007"></a>
154
+
155
+ <div class="method-heading">
156
+ <a href="#M000007" class="method-signature">
157
+ <span class="method-name">empty_list_error</span><span class="method-args">()</span>
158
+ </a>
159
+ </div>
160
+
161
+ <div class="method-description">
162
+ <p>
163
+ This is used to handle empty list errors in this library. Re-define to fit.
164
+ </p>
165
+ <p><a class="source-toggle" href="#"
166
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
167
+ <div class="method-source-code" id="M000007-source">
168
+ <pre>
169
+ <span class="ruby-comment cmt"># File lib/prelude.rb, line 39</span>
170
+ 39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">empty_list_error</span>
171
+ 40: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EmptyListError</span>, <span class="ruby-value str">'Illegal operation on an empty list.'</span>
172
+ 41: <span class="ruby-keyword kw">end</span>
173
+ </pre>
174
+ </div>
175
+ </div>
176
+ </div>
177
+
178
+ <div id="method-M000009" class="method-detail">
179
+ <a name="M000009"></a>
180
+
181
+ <div class="method-heading">
182
+ <a href="#M000009" class="method-signature">
183
+ <span class="method-name">get_proc</span><span class="method-args">(f=nil, &amp;block)</span>
184
+ </a>
185
+ </div>
186
+
187
+ <div class="method-description">
188
+ <p>
189
+ A utility to determine if a function was passed
190
+ </p>
191
+ <p><a class="source-toggle" href="#"
192
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
193
+ <div class="method-source-code" id="M000009-source">
194
+ <pre>
195
+ <span class="ruby-comment cmt"># File lib/prelude.rb, line 52</span>
196
+ 52: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_proc</span>(<span class="ruby-identifier">f</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
197
+ 53: <span class="ruby-comment cmt"># Has to be either function 'f' or block</span>
198
+ 54: <span class="ruby-identifier">f</span> = <span class="ruby-identifier">block_given?</span> <span class="ruby-value">? </span><span class="ruby-identifier">block</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">missing_function_error</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">nil?</span>
199
+ 55: <span class="ruby-identifier">f</span>.<span class="ruby-identifier">to_proc</span>
200
+ 56: <span class="ruby-keyword kw">end</span>
201
+ </pre>
202
+ </div>
203
+ </div>
204
+ </div>
205
+
206
+ <div id="method-M000008" class="method-detail">
207
+ <a name="M000008"></a>
208
+
209
+ <div class="method-heading">
210
+ <a href="#M000008" class="method-signature">
211
+ <span class="method-name">missing_function_error</span><span class="method-args">()</span>
212
+ </a>
213
+ </div>
214
+
215
+ <div class="method-description">
216
+ <p>
217
+ This is used to handle missing function errors in this library. Re-define
218
+ to fit.
219
+ </p>
220
+ <p><a class="source-toggle" href="#"
221
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
222
+ <div class="method-source-code" id="M000008-source">
223
+ <pre>
224
+ <span class="ruby-comment cmt"># File lib/prelude.rb, line 47</span>
225
+ 47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">missing_function_error</span>
226
+ 48: <span class="ruby-identifier">raise</span> <span class="ruby-constant">MissingFunctionError</span>, <span class="ruby-value str">'No function or block supplied.'</span>
227
+ 49: <span class="ruby-keyword kw">end</span>
228
+ </pre>
229
+ </div>
230
+ </div>
231
+ </div>
232
+
233
+
234
+ </div>
128
235
 
129
236
 
130
237
  </div>