]> gitweb.factorcode.org Git - factor.git/blob - basis/delegate/protocols/protocols.factor
sets: adding ?delete that returns a boolean if elt was deleted from set.
[factor.git] / basis / delegate / protocols / protocols.factor
1 ! Copyright (C) 2007 Daniel Ehrenberg
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs delegate io sequences sequences.private sets ;
4 IN: delegate.protocols
5
6 PROTOCOL: sequence-protocol
7 like new-sequence new-resizable nth nth-unsafe
8 set-nth set-nth-unsafe length set-length
9 lengthen ;
10
11 PROTOCOL: assoc-protocol
12 at* assoc-size >alist set-at assoc-clone-like
13 delete-at clear-assoc new-assoc assoc-like ;
14
15 PROTOCOL: set-protocol
16 adjoin ?adjoin in? delete ?delete set-like fast-set members
17 union intersect intersects? diff subset? set= duplicates
18 all-unique? null? cardinality clear-set ;
19
20 PROTOCOL: input-stream-protocol
21 stream-read1 stream-read-unsafe stream-read-partial-unsafe
22 stream-readln stream-read-until stream-contents* ;
23
24 PROTOCOL: output-stream-protocol
25 stream-flush stream-write1 stream-write stream-nl ;