-
Notifications
You must be signed in to change notification settings - Fork 3
/
library.dylan
104 lines (92 loc) · 3.64 KB
/
library.dylan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
module: dylan-user
//======================================================================
//
// Copyright (c) 1994 Carnegie Mellon University
// Copyright (c) 1998, 1999, 2000 Gwydion Dylan Maintainers
// All rights reserved.
//
// Use and copying of this software and preparation of derivative
// works based on this software are permitted, including commercial
// use, provided that the following conditions are observed:
//
// 1. This copyright notice must be retained in full on any copies
// and on appropriate parts of any derivative works.
// 2. Documentation (paper or online) accompanying any system that
// incorporates this software, or any part of it, must acknowledge
// the contribution of the Gwydion Project at Carnegie Mellon
// University, and the Gwydion Dylan Maintainers.
//
// This software is made available "as is". Neither the authors nor
// Carnegie Mellon University make any warranty about the software,
// its performance, or its conformity to any specification.
//
// Bug reports should be sent to <gd-bugs@gwydiondylan.org>; questions,
// comments and suggestions are welcome at <gd-hackers@gwydiondylan.org>.
// Also, see http://www.gwydiondylan.org/ for updates and documentation.
//
//======================================================================
// The library "collection-extensions" contains a variety of small modules
// which are not in the core language but are expected to be generally useful.
// These include new collection classes implementing heaps (i.e. priority
// queues), "self organizing" lists, and subsequences (also known as
// "slices"), and a routines for efficient search and replace on
// <byte-string>s. Documentation for these routines may be found in
// collection-extension.doc.
define library collection-extensions
use dylan;
use common-dylan, import: { byte-vector };
export heap, self-organizing-list, vector-search, subseq, sequence-diff;
export sde-vector;
export collection-utilities;
export sequence-utilities;
end library collection-extensions;
define module self-organizing-list
use dylan;
// use extensions, import: {<dictionary>};
export <self-organizing-list>;
end module self-organizing-list;
define module subseq
use dylan;
use byte-vector;
use dylan-extensions, import: { \copy-down-method-definer };
export subsequence, <subsequence>, <byte-vector-subsequence>;
end module subseq;
define module vector-search
use dylan;
use subseq;
export find-first-key, find-last-key;
end module vector-search;
define module heap
// Since "<heap>" is a subclass of "<sequence>", most methods are simply
// added to existing generic functions. The only "new" operation is
// "random-iteration-protocol".
use dylan;
export <heap>, heap-pop, heap-push, random-iteration-protocol;
end module heap;
define module SDE-vector
use dylan;
export <SDE-vector>;
end module SDE-vector;
define module sequence-diff
use dylan;
use SDE-vector;
export sequence-diff,
<script-entry>, <insert-entry>, <delete-entry>,
element-count, source-index, dest-index;
end module sequence-diff;
define module collection-utilities
use dylan;
export singleton?, key-exists?;
end module collection-utilities;
define module sequence-utilities
use dylan;
export push!, pop!;
export pair?, null?, list?;
export xpair, tabulate, list*, take, drop, last-pair;
export reverse-append, unfold, unfold/tail;
export foldl, foldr, pair-foldl, pair-foldr;
export reduce-l, reduce-r, heads, tails;
export concatenate-map, pair-do, choose-map;
export partition, assoc, apair, alist-copy, alist-delete;
export satisfies, index, find, find-tail, precedes?;
end module sequence-utilities;