prelude 0.0.3 → 0.0.5

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.
Files changed (43) hide show
  1. data/CHANGELOG +25 -1
  2. data/README +11 -12
  3. data/Rakefile +6 -10
  4. data/lib/prelude.rb +36 -91
  5. data/lib/prelude/{tuple.rb → array_list.rb} +30 -27
  6. data/lib/prelude/functions.rb +414 -0
  7. data/lib/prelude/functors.rb +72 -0
  8. data/lib/prelude/lambda.rb +89 -0
  9. data/lib/prelude/minimal_array_list.rb +61 -0
  10. data/lib/prelude/monad.rb +11 -15
  11. data/lib/prelude/proper_list.rb +47 -0
  12. data/lib/prelude/proper_ruby_list.rb +48 -0
  13. data/lib/prelude/util.rb +33 -0
  14. data/test/tc_functions.rb +801 -0
  15. data/test/tc_monad.rb +21 -41
  16. data/test/ts_prelude.rb +2 -8
  17. metadata +13 -36
  18. data/doc/classes/Kernel.html +0 -198
  19. data/doc/classes/Prelude.html +0 -241
  20. data/doc/classes/Prelude/EmptyListError.html +0 -113
  21. data/doc/classes/Prelude/List.html +0 -2692
  22. data/doc/classes/Prelude/MissingFunctionError.html +0 -113
  23. data/doc/classes/Prelude/Monad.html +0 -283
  24. data/doc/classes/Prelude/Tuple.html +0 -217
  25. data/doc/classes/Proc.html +0 -198
  26. data/doc/classes/Symbol.html +0 -219
  27. data/doc/created.rid +0 -1
  28. data/doc/files/CHANGELOG.html +0 -122
  29. data/doc/files/README.html +0 -328
  30. data/doc/files/TODO.html +0 -95
  31. data/doc/files/lib/prelude/list_rb.html +0 -83
  32. data/doc/files/lib/prelude/monad_rb.html +0 -83
  33. data/doc/files/lib/prelude/tuple_rb.html +0 -83
  34. data/doc/files/lib/prelude_rb.html +0 -98
  35. data/doc/fr_class_index.html +0 -35
  36. data/doc/fr_file_index.html +0 -33
  37. data/doc/fr_method_index.html +0 -140
  38. data/doc/index.html +0 -27
  39. data/doc/rdoc-style.css +0 -208
  40. data/lib/prelude/list.rb +0 -588
  41. data/test/tc_higher.rb +0 -89
  42. data/test/tc_list.rb +0 -777
  43. data/test/tc_tuple.rb +0 -82
@@ -1,89 +0,0 @@
1
- #--
2
- # $Id: tc_higher.rb 17 2006-09-17 18:03:15Z prelude $
3
- #
4
- #
5
- # This file is part of the Prelude library that provides tools to
6
- # enable Haskell style functional programming in Ruby.
7
- #
8
- # http://prelude.rubyforge.org
9
- #
10
- # Copyright (C) 2006 APP Design, Inc.
11
- #
12
- # This library is free software; you can redistribute it and/or
13
- # modify it under the terms of the GNU Lesser General Public
14
- # License as published by the Free Software Foundation; either
15
- # version 2.1 of the License, or (at your option) any later version.
16
- #
17
- # This library is distributed in the hope that it will be useful,
18
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
- # Lesser General Public License for more details.
21
- #
22
- # You should have received a copy of the GNU Lesser General Public
23
- # License along with this library; if not, write to the Free Software
24
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25
- #++
26
-
27
- class TestHigher < Test::Unit::TestCase
28
-
29
- def setup
30
- # Nothing
31
- end # setup
32
-
33
- def teardown
34
- # Nothing
35
- end # teardown
36
-
37
- #
38
- # Test higher functions
39
- #
40
- def test_curry_proc
41
- add5 = (proc {|x,y,z| x+y+z}).curry(5)
42
-
43
- result = add5[3, 2]
44
- expect = 10
45
-
46
- assert_equal(expect, result)
47
-
48
- result = add5.call(3, 2)
49
- expect = 10
50
-
51
- assert_equal(expect, result)
52
- end
53
-
54
- def test_curry_symbol
55
- add5 = :+.curry(5)
56
-
57
- result = add5.call(3)
58
- expect = 8
59
-
60
- assert_equal(expect, result)
61
-
62
- result = add5[4]
63
- expect = 9
64
-
65
- assert_equal(expect, result)
66
- end
67
-
68
- def test_composition
69
- add5 = proc {|x| x+5}
70
- add6 = proc {|x,y| x+y+6}
71
- add11 = add5 ** add6
72
-
73
- result = add11[1, 2]
74
- expect = 14
75
-
76
- assert_equal(expect, result)
77
-
78
- result = add5 ** 1
79
- expect = 6
80
-
81
- assert_equal(expect, result)
82
-
83
- result = add5 ** add6 ** [1, 2]
84
- expect = 14
85
-
86
- assert_equal(expect, result)
87
- end
88
-
89
- end # TestHigher
@@ -1,777 +0,0 @@
1
- #--
2
- # $Id: tc_list.rb 17 2006-09-17 18:03:15Z prelude $
3
- #
4
- #
5
- # This file is part of the Prelude library that provides tools to
6
- # enable Haskell style functional programming in Ruby.
7
- #
8
- # http://prelude.rubyforge.org
9
- #
10
- # Copyright (C) 2006 APP Design, Inc.
11
- #
12
- # This library is free software; you can redistribute it and/or
13
- # modify it under the terms of the GNU Lesser General Public
14
- # License as published by the Free Software Foundation; either
15
- # version 2.1 of the License, or (at your option) any later version.
16
- #
17
- # This library is distributed in the hope that it will be useful,
18
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
- # Lesser General Public License for more details.
21
- #
22
- # You should have received a copy of the GNU Lesser General Public
23
- # License along with this library; if not, write to the Free Software
24
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25
- #++
26
-
27
- class TestList < Test::Unit::TestCase
28
-
29
- include List
30
-
31
- NOT_IMPLEMENTED_YET = []
32
-
33
- def setup
34
-
35
- @a = [1, 2, 3, 4, 5]
36
- @true_list = [true, true, true]
37
- @false_list = [false, false, false]
38
- @mixed_list = [false, true, false]
39
-
40
- end # setup
41
-
42
- def teardown
43
- # Nothing
44
- end # teardown
45
-
46
- # head -- :: [a] -> a
47
- def test_head
48
- result = ~head(@a)
49
- expect = 1
50
-
51
- assert_equal(expect, result)
52
-
53
- assert_raise(EmptyListError) { ~head([]) }
54
- end
55
-
56
- # last -- :: [a] -> a
57
- def test_last
58
- result = ~last(@a)
59
- expect = 5
60
-
61
- assert_equal(expect, result)
62
-
63
- assert_raise(EmptyListError) { last [] }
64
- end
65
-
66
- # tail -- :: [a] -> [a]
67
- def test_tail
68
- result = ~tail(@a)
69
- expect = [2, 3, 4, 5]
70
-
71
- assert_equal(expect, result)
72
-
73
- assert_raise(EmptyListError) { ~tail([]) }
74
- end
75
-
76
- # init -- :: [a] -> [a]
77
- def test_init
78
- result = ~init(@a)
79
- expect = [1, 2, 3, 4]
80
-
81
- assert_equal(expect, result)
82
-
83
- assert_equal( ~init([1]), [])
84
- assert_raise(EmptyListError) { ~init([]) }
85
- end
86
-
87
- # null -- :: [a] -> Bool
88
- def test_null
89
- result = ~null(@a)
90
- expect = false
91
-
92
- assert_equal(expect, result)
93
- end
94
-
95
- # length -- :: [a] -> Int
96
- def test_length
97
- result = ~length(@a)
98
- expect = 5
99
-
100
- assert_equal(expect, result)
101
- end
102
-
103
- # map -- :: (a -> b) -> [a] -> [b]
104
- def test_map
105
- expect = [2, 3, 4, 5, 6]
106
-
107
- result = ~map(proc {|x| x+1}, @a)
108
- assert_equal(expect, result)
109
- end
110
-
111
- # reverse -- :: [a] -> [a]
112
- def test_reverse
113
- result = ~reverse(@a)
114
- expect = [5, 4, 3, 2, 1]
115
-
116
- assert_equal(expect, result)
117
- end
118
-
119
- # intersperse -- :: a -> [a] -> [a]
120
- def test_intersperse
121
- result = ~intersperse(@a)
122
- expect = NOT_IMPLEMENTED_YET
123
-
124
- assert_equal(expect, result)
125
- end
126
-
127
- # transpose -- :: [[a]] -> [[a]]
128
- def test_transpose
129
- result = ~transpose([@a, @a, @a])
130
- expect = [[1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4], [5, 5, 5] ]
131
-
132
- assert_equal(expect, result)
133
- end
134
-
135
- # -- * Reducing lists (folds)
136
-
137
- # foldl -- :: (a -> b -> a) -> a -> [b] -> a
138
-
139
- def test_foldl
140
- expect = 15
141
-
142
- result = ~foldl(proc{ |x, y| x+y}, 0, @a )
143
- assert_equal(expect, result)
144
-
145
- result = ~foldl(-:+, 0, @a )
146
- assert_equal(expect, result)
147
- end
148
-
149
- # foldl' -- :: (a -> b -> a) -> a -> [b] -> a
150
- def test_foldl_
151
- result = ~foldl_(@a)
152
- expect = NOT_IMPLEMENTED_YET
153
-
154
- assert_equal(expect, result)
155
- end
156
-
157
- # foldl1 -- :: (a -> a -> a) -> [a] -> a
158
- def test_foldl1
159
- expect = 15
160
-
161
- result = ~foldl1( proc{ |x, y| x+y}, @a )
162
- assert_equal(expect, result)
163
-
164
- result = ~foldl1(-:+, @a )
165
- assert_equal(expect, result)
166
- end
167
-
168
- # foldl1' -- :: (a -> a -> a) -> [a] -> a
169
- def test_foldl1_
170
- result = ~foldl1_(@a)
171
- expect = NOT_IMPLEMENTED_YET
172
-
173
- assert_equal(expect, result)
174
- end
175
-
176
- # foldr -- :: (a -> b -> b) -> b -> [a] -> b
177
- def test_foldr
178
- expect = 15
179
-
180
- result = ~foldr(proc{ |x, y| x+y}, 0, @a)
181
- assert_equal(expect, result)
182
-
183
- result = ~foldr(-:+, 0, @a )
184
- assert_equal(expect, result)
185
- end
186
-
187
- # foldr1 -- :: (a -> a -> a) -> [a] -> a
188
- def test_foldr1
189
- expect = 15
190
-
191
- result = ~foldr1(proc{ |x, y| x+y}, @a)
192
- assert_equal(expect, result)
193
-
194
- result = ~foldr1(-:+, @a)
195
- assert_equal(expect, result)
196
- end
197
-
198
- # -- ** Special folds
199
-
200
- # concat -- :: [[a]] -> [a]
201
- def test_concat
202
- result = ~concat( [[1, 2, [1, 2]], [1, 2]] )
203
- expect = [1, 2, [1, 2], 1, 2]
204
-
205
- assert_equal(expect, result)
206
- end
207
-
208
- # concatMap -- :: (a -> [b]) -> [a] -> [b]
209
- def test_concatMap
210
- result = ~concatMap(@a)
211
- expect = NOT_IMPLEMENTED_YET
212
-
213
- assert_equal(expect, result)
214
- end
215
-
216
- # and -- :: [Bool] -> Bool
217
- def test_and
218
- result = ~and_(@true_list)
219
- expect = true
220
-
221
- assert_equal(expect, result)
222
-
223
- result = ~and_(@mixed_list)
224
- expect = false
225
-
226
- assert_equal(expect, result)
227
-
228
- result = ~and_(@false_list)
229
- expect = false
230
-
231
- assert_equal(expect, result)
232
- end
233
-
234
- # or -- :: [Bool] -> Bool
235
- def test_or
236
- result = ~or_(@true_list)
237
- expect = true
238
-
239
- assert_equal(expect, result)
240
-
241
- result = ~or_(@mixed_list)
242
- expect = true
243
-
244
- assert_equal(expect, result)
245
-
246
- result = ~or_(@false_list)
247
- expect = false
248
-
249
- assert_equal(expect, result)
250
- end
251
-
252
- # any -- :: (a -> Bool) -> [a] -> Bool
253
- def test_any
254
- f1 = proc {|x| x>5}
255
- f2 = proc {|x| x<5}
256
-
257
- result = ~any(f1, @a)
258
- expect = false
259
-
260
- assert_equal(expect, result)
261
-
262
- result = ~any(f2, @a)
263
- expect = true
264
-
265
- assert_equal(expect, result)
266
- end
267
-
268
- # all -- :: (a -> Bool) -> [a] -> Bool
269
- def test_all
270
- result = ~all(proc {|x| x>3}, @a)
271
- expect = false
272
-
273
- assert_equal(expect, result)
274
-
275
- result = ~all(proc {|x| x>0}, @a)
276
- expect = true
277
-
278
- assert_equal(expect, result)
279
- end
280
-
281
- # sum -- :: (Num a) => [a] -> a
282
- def test_sum
283
- result = ~sum(@a)
284
- expect = NOT_IMPLEMENTED_YET
285
-
286
- assert_equal(expect, result)
287
- end
288
-
289
- # product -- :: (Num a) => [a] -> a
290
- def test_product
291
- result = ~product(@a)
292
- expect = NOT_IMPLEMENTED_YET
293
-
294
- assert_equal(expect, result)
295
- end
296
-
297
- # maximum -- :: (Ord a) => [a] -> a
298
- def test_maximum
299
- result = ~maximum(@a)
300
- expect = NOT_IMPLEMENTED_YET
301
-
302
- assert_equal(expect, result)
303
- end
304
-
305
- # minimum -- :: (Ord a) => [a] -> a
306
- def test_minimum
307
- result = ~minimum(@a)
308
- expect = NOT_IMPLEMENTED_YET
309
-
310
- assert_equal(expect, result)
311
- end
312
-
313
-
314
- # -- * Building lists
315
-
316
- # -- ** Scans
317
- # scanl -- :: (a -> b -> a) -> a -> [b] -> [a]
318
- def test_scanl
319
- result = ~scanl(lambda{ |x, y| x+y}, 0, @a)
320
- expect = NOT_IMPLEMENTED_YET #[0, 1, 3, 6, 10, 15]
321
-
322
- assert_equal(expect, result)
323
- end
324
-
325
- # scanl1 -- :: (a -> a -> a) -> [a] -> [a]
326
- def test_scanl1
327
- result = ~scanl1( lambda { |x, y| x+y }, @a)
328
- expect = NOT_IMPLEMENTED_YET #[1, 3, 6, 10, 15]
329
-
330
- assert_equal(expect, result)
331
- end
332
-
333
- # scanr -- :: (a -> b -> b) -> b -> [a] -> [b]
334
- def test_scanr
335
- result = ~scanr(lambda { |x, y| x+y }, 0, @a)
336
- expect = NOT_IMPLEMENTED_YET #[0, 1, 3, 6, 10, 15]
337
-
338
- assert_equal(expect, result)
339
- end
340
-
341
- # scanr1 -- :: (a -> a -> a) -> [a] -> [a]
342
- def test_scanr1
343
- result = ~scanr1(lambda { |x, y| x+y }, @a)
344
- expect = NOT_IMPLEMENTED_YET #[1, 3, 6, 10, 15]
345
-
346
- assert_equal(expect, result)
347
- end
348
-
349
-
350
- # -- ** Accumulating maps
351
- # mapAccumL -- :: (a -> b -> (a,c)) -> a -> [b] -> (a,[c])
352
- def test_mapAccumL
353
- result = ~mapAccumL(@a)
354
- expect = NOT_IMPLEMENTED_YET
355
-
356
- assert_equal(expect, result)
357
- end
358
-
359
- # mapAccumR -- :: (a -> b -> (a,c)) -> a -> [b] -> (a,[c])
360
- def test_mapAccumR
361
- result = ~mapAccumR(@a)
362
- expect = NOT_IMPLEMENTED_YET
363
-
364
- assert_equal(expect, result)
365
- end
366
-
367
-
368
- # -- ** Infinite lists
369
- # iterate -- :: (a -> a) -> a -> [a]
370
- def test_iterate
371
- result = ~iterate(@a)
372
- expect = NOT_IMPLEMENTED_YET
373
-
374
- assert_equal(expect, result)
375
- end
376
-
377
- # repeat -- :: a -> [a]
378
- def test_repeat
379
- result = ~repeat(@a)
380
- expect = NOT_IMPLEMENTED_YET
381
-
382
- assert_equal(expect, result)
383
- end
384
-
385
- # replicate -- :: Int -> a -> [a]
386
- def test_replicate
387
- result = ~replicate(@a)
388
- expect = NOT_IMPLEMENTED_YET
389
-
390
- assert_equal(expect, result)
391
- end
392
-
393
- # cycle -- :: [a] -> [a]
394
- def test_cycle
395
- result = ~cycle(@a)
396
- expect = NOT_IMPLEMENTED_YET
397
-
398
- assert_equal(expect, result)
399
- end
400
-
401
-
402
- # -- ** Unfolding
403
- # unfoldr -- :: (b -> Maybe (a, b)) -> b -> [a]
404
- def test_unfoldr
405
- result = ~unfoldr(@a)
406
- expect = NOT_IMPLEMENTED_YET
407
-
408
- assert_equal(expect, result)
409
- end
410
-
411
-
412
- # -- * Sublists
413
-
414
- # -- ** Extracting sublists
415
- # take -- :: Int -> [a] -> [a]
416
- def test_take
417
- result = ~take(2, @a)
418
- expect = [1, 2]
419
-
420
- assert_equal(expect, result)
421
- end
422
-
423
- # drop -- :: Int -> [a] -> [a]
424
- def test_drop
425
- result = ~drop(2, @a)
426
- expect = [3, 4, 5]
427
-
428
- assert_equal(expect, result)
429
- end
430
-
431
- # splitAt -- :: Int -> [a] -> ([a], [a])
432
- def test_split_at
433
- result = ~split_at(2, @a)
434
- expect = [[1, 2],[3, 4, 5]]
435
-
436
- assert_equal(expect, result)
437
- end
438
-
439
- # takeWhile -- :: (a -> Bool) -> [a] -> [a]
440
- def test_takeWhile
441
- result = ~takeWhile(lambda {|x| x<4}, @a)
442
- expect = [1, 2, 3]
443
-
444
- assert_equal(expect, result)
445
- end
446
-
447
- # dropWhile -- :: (a -> Bool) -> [a] -> [a]
448
- def test_dropWhile
449
- result = ~dropWhile(lambda {|x| x<4}, @a)
450
- expect = [4, 5]
451
-
452
- assert_equal(expect, result)
453
- end
454
-
455
- # span -- :: (a -> Bool) -> [a] -> ([a], [a])
456
- def test_span
457
- result = ~span(lambda {|x| x<3}, @a)
458
- expect = [[1, 2], [3, 4, 5]]
459
-
460
- assert_equal(expect, result)
461
- end
462
-
463
- # break -- :: (a -> Bool) -> [a] -> ([a], [a])
464
- def test_break_
465
- result = ~break_(@a)
466
- expect = NOT_IMPLEMENTED_YET
467
-
468
- assert_equal(expect, result)
469
- end
470
-
471
- # group -- :: Eq a => [a] -> [[a]]
472
- def test_group
473
- result = ~group(@a)
474
- expect = NOT_IMPLEMENTED_YET
475
-
476
- assert_equal(expect, result)
477
- end
478
-
479
- # inits -- :: [a] -> [[a]]
480
- def test_inits
481
- result = ~inits(@a)
482
- expect = NOT_IMPLEMENTED_YET
483
-
484
- assert_equal(expect, result)
485
- end
486
-
487
- # tails -- :: [a] -> [[a]]
488
- def test_tails
489
- result = ~tails(@a)
490
- expect = NOT_IMPLEMENTED_YET
491
-
492
- assert_equal(expect, result)
493
- end
494
-
495
- # -- ** Predicates
496
- # isPrefixOf -- :: (Eq a) => [a] -> [a] -> Bool
497
- def test_isPrefixOf
498
- result = ~isPrefixOf(@a)
499
- expect = NOT_IMPLEMENTED_YET
500
-
501
- assert_equal(expect, result)
502
- end
503
-
504
- # isSuffixOf -- :: (Eq a) => [a] -> [a] -> Bool
505
- def test_isSuffixOf
506
- result = ~isSuffixOf(@a)
507
- expect = NOT_IMPLEMENTED_YET
508
-
509
- assert_equal(expect, result)
510
- end
511
-
512
-
513
- # -- * Searching lists
514
-
515
- # -- ** Searching by equality
516
- # elem -- :: a -> [a] -> Bool
517
- def test_elem
518
- result = ~elem(@a)
519
- expect = NOT_IMPLEMENTED_YET
520
-
521
- assert_equal(expect, result)
522
- end
523
-
524
- # notElem -- :: a -> [a] -> Bool
525
- def test_notElem
526
- result = ~notElem(@a)
527
- expect = NOT_IMPLEMENTED_YET
528
-
529
- assert_equal(expect, result)
530
- end
531
-
532
- # lookup -- :: (Eq a) => a -> [(a,b)] -> Maybe b
533
- def test_lookup
534
- result = ~lookup(@a)
535
- expect = NOT_IMPLEMENTED_YET
536
-
537
- assert_equal(expect, result)
538
- end
539
-
540
- # -- ** Searching with a predicate
541
- # find -- :: (a -> Bool) -> [a] -> Maybe a
542
- def test_find
543
- result = ~find(lambda {|x| x==3}, @a)
544
- expect = NOT_IMPLEMENTED_YET
545
-
546
- assert_equal(expect, result)
547
- end
548
-
549
- # filter -- :: (a -> Bool) -> [a] -> [a]
550
- def test_filter
551
- result = ~filter(@a)
552
- expect = NOT_IMPLEMENTED_YET
553
-
554
- assert_equal(expect, result)
555
- end
556
-
557
- # partition -- :: (a -> Bool) -> [a] -> ([a], [a])
558
- def test_partition
559
- result = ~partition(lambda {|x| x>3}, @a)
560
- expect = NOT_IMPLEMENTED_YET
561
-
562
- assert_equal(expect, result)
563
- end
564
-
565
-
566
- # -- * Indexing lists
567
- # -- | These functions treat a list @xs@ as a indexed collection,
568
- # -- with indices ranging from 0 to @'length' xs - 1@.
569
-
570
- # (!!) -- :: [a] -> Int -> a
571
- # Don't know how to implement it in Ruby
572
-
573
-
574
- # elemIndex -- :: (Eq a) => a -> [a] -> Maybe Int
575
- def test_elemIndex
576
- result = ~elemIndex(@a)
577
- expect = NOT_IMPLEMENTED_YET
578
-
579
- assert_equal(expect, result)
580
- end
581
-
582
- # elemIndices -- :: (Eq a) => a -> [a] -> [Int]
583
- def test_elemIndices
584
- result = ~elemIndices(@a)
585
- expect = NOT_IMPLEMENTED_YET
586
-
587
- assert_equal(expect, result)
588
- end
589
-
590
-
591
- # findIndex -- :: (a -> Bool) -> [a] -> Maybe Int
592
- def test_findIndex
593
- result = ~findIndex(@a)
594
- expect = NOT_IMPLEMENTED_YET
595
-
596
- assert_equal(expect, result)
597
- end
598
-
599
- # findIndices -- :: (a -> Bool) -> [a] -> [Int]
600
- def test_findIndices
601
- result = ~findIndices(@a)
602
- expect = NOT_IMPLEMENTED_YET
603
-
604
- assert_equal(expect, result)
605
- end
606
-
607
-
608
- # -- * Zipping and unzipping lists
609
-
610
- # zip -- :: [a] -> [b] -> [(a,b)]
611
- def test_zip
612
- result = ~zip(@a, @a)
613
- expect = NOT_IMPLEMENTED_YET #[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5] ]
614
-
615
- assert_equal(expect, result)
616
- end
617
-
618
- # zip3
619
- def test_zip3
620
- result = ~zip3(@a)
621
- expect = NOT_IMPLEMENTED_YET
622
-
623
- assert_equal(expect, result)
624
- end
625
-
626
- # zip4, zip5, zip6, zip7
627
- def test_zip4
628
- result = ~zip4(@a)
629
- expect = NOT_IMPLEMENTED_YET
630
-
631
- assert_equal(expect, result)
632
- end
633
-
634
-
635
- # zipWith -- :: (a -> b -> c) -> [a] -> [b] -> [c]
636
- def test_zipWith
637
- result = ~zipWith(@a)
638
- expect = NOT_IMPLEMENTED_YET
639
-
640
- assert_equal(expect, result)
641
- end
642
-
643
- # zipWith3
644
- def test_zipWith3
645
- result = ~zipWith3(@a)
646
- expect = NOT_IMPLEMENTED_YET
647
-
648
- assert_equal(expect, result)
649
- end
650
-
651
- # zipWith4, zipWith5, zipWith6, zipWith7
652
- def test_zipWith4
653
- result = ~zipWith4(@a)
654
- expect = NOT_IMPLEMENTED_YET
655
-
656
- assert_equal(expect, result)
657
- end
658
-
659
-
660
- # unzip -- :: [(a,b)] -> ([a],[b])
661
- def test_unzip
662
- result = ~unzip(@a)
663
- expect = NOT_IMPLEMENTED_YET
664
-
665
- assert_equal(expect, result)
666
- end
667
-
668
- # unzip3
669
- def test_unzip3
670
- result = ~unzip3(@a)
671
- expect = NOT_IMPLEMENTED_YET
672
-
673
- assert_equal(expect, result)
674
- end
675
-
676
- # unzip4, unzip5, unzip6, unzip7
677
- def test_unzip4
678
- result = ~unzip4(@a)
679
- expect = NOT_IMPLEMENTED_YET
680
-
681
- assert_equal(expect, result)
682
- end
683
-
684
-
685
- # -- * Special lists
686
-
687
- # -- ** Functions on strings
688
- # lines -- :: String -> [String]
689
- def test_lines
690
- result = ~lines(@a)
691
- expect = NOT_IMPLEMENTED_YET
692
-
693
- assert_equal(expect, result)
694
- end
695
-
696
- # words -- :: String -> [String]
697
- def test_words
698
- result = ~words(@a)
699
- expect = NOT_IMPLEMENTED_YET
700
-
701
- assert_equal(expect, result)
702
- end
703
-
704
- # unlines -- :: [String] -> String
705
- def test_unlines
706
- result = ~unlines(@a)
707
- expect = NOT_IMPLEMENTED_YET
708
-
709
- assert_equal(expect, result)
710
- end
711
-
712
- # unwords -- :: [String] -> String
713
- def test_unwords
714
- result = ~unwords(@a)
715
- expect = NOT_IMPLEMENTED_YET
716
-
717
- assert_equal(expect, result)
718
- end
719
-
720
-
721
- # -- ** \"Set\" operations
722
-
723
- # nub -- :: (Eq a) => [a] -> [a]
724
- def test_nub
725
- result = ~nub(@a)
726
- expect = NOT_IMPLEMENTED_YET
727
-
728
- assert_equal(expect, result)
729
- end
730
-
731
-
732
- # delete -- :: (Eq a) => a -> [a] -> [a]
733
- def test_delete
734
- result = ~delete(3, @a)
735
- expect = NOT_IMPLEMENTED_YET
736
-
737
- assert_equal(expect, result)
738
- end
739
-
740
- # (\\) -- :: (Eq a) => [a] -> [a] -> [a]
741
- # Don't know how to implement it in Ruby
742
-
743
- # union -- :: (Eq a) => [a] -> [a] -> [a]
744
- def test_union
745
- result = ~union(@a)
746
- expect = NOT_IMPLEMENTED_YET
747
-
748
- assert_equal(expect, result)
749
- end
750
-
751
- # intersect -- :: (Eq a) => [a] -> [a] -> [a]
752
- def test_intersect
753
- result = ~intersect(@a)
754
- expect = NOT_IMPLEMENTED_YET
755
-
756
- assert_equal(expect, result)
757
- end
758
-
759
-
760
- # -- ** Ordered lists
761
-
762
- # sort -- :: (Ord a) => [a] -> [a]
763
- def test_sort
764
- result = ~sort(@a)
765
- expect = NOT_IMPLEMENTED_YET
766
-
767
- assert_equal(expect, result)
768
- end
769
-
770
- # insert -- :: (Ord a) => a -> [a] -> [a]
771
- def test_insert
772
- result = ~insert(3.5, @a)
773
- expect = NOT_IMPLEMENTED_YET
774
- assert_equal(expect, result)
775
- end
776
-
777
- end # TestList