tREADME.md - clic - Clic is an command line interactive client for gopher written in Common LISP
(HTM) git clone git://bitreich.org/clic/ git://hg6vgqziawt5s4dj.onion/clic/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) LICENSE
---
tREADME.md (3751B)
---
1 SPLIT-SEQUENCE
2 ==============
3
4 [SPLIT-SEQUENCE](http://cliki.net/split-sequence) is a member of the
5 [Common Lisp Utilities](http://cliki.net/Common%20Lisp%20Utilities)
6 family of programs, designed by community consensus.
7
8
9 _Function_ __SPLIT-SEQUENCE, SPLIT-SEQUENCE-IF, SPLIT-SEQUENCE-IF-NOT__
10
11
12 __Syntax:__
13
14 __split-sequence__ _delimiter sequence `&key` count
15 remove-empty-subseqs from-end start end test test-not key ⇒ list,
16 index_
17
18 __split-sequence-if__ _predicate sequence `&key` count
19 remove-empty-subseqs from-end start end key ⇒ list, index_
20
21 __split-sequence-if-not__ _predicate sequence `&key` count
22 remove-empty-subseqs from-end start end key ⇒ list, index_
23
24
25 __Arguments and Values:__
26
27 _delimiter_—an _object_.
28
29 _predicate_—a designator for a _function_ of one _argument_ that
30 returns a _generalized boolean_.
31
32 _sequence_—a _proper sequence_.
33
34 _count_—an _integer_ or __nil__. The default is __nil__.
35
36 _remove-empty-subseqs_—a _generalized boolean_. The default is
37 _false_.
38
39 _from-end_—a _generalized boolean_. The default is _false_.
40
41 _start, end_—_bounding index designators_ of _sequence_. The
42 defaults for _start_ and _end_ are __0__ and __nil__, respectively.
43
44 _test_—a _designator_ for a _function_ of two _arguments_ that
45 returns a _generalized boolean_.
46
47 _test-not_—a _designator_ for a _function_ of two _arguments_
48 that returns a _generalized boolean_.
49
50 _key_—a _designator_ for a _function_ of one _argument_, or
51 __nil__.
52
53 _list_—a _proper sequence_.
54
55 _index_—an _integer_ greater than or equal to zero, and less
56 than or equal to the _length_ of the _sequence_.
57
58
59 __Description:__
60
61 Splits _sequence_ into a list of subsequences delimited by objects
62 _satisfying the test_.
63
64 _List_ is a list of sequences of the same kind as _sequence_ that has
65 elements consisting of subsequences of _sequence_ that were delimited
66 in the argument by elements _satisfying the test_. Index is an index
67 into _sequence_ indicating the unprocessed region, suitable as an
68 argument to
69 [subseq](http://www.lispworks.com/documentation/HyperSpec/Body/f_subseq.htm)
70 to continue processing in the same manner if desired.
71
72 The _count_ argument, if supplied, limits the number of subsequences
73 in the first return value; if more than _count_ delimited subsequences
74 exist in _sequence_, the _count_ leftmost delimited subsequences will
75 be in order in the first return value, and the second return value
76 will be the index into _sequence_ at which processing stopped.
77
78 If _from-end_ is non-null, _sequence_ is conceptually processed from
79 right to left, accumulating the subsequences in reverse order;
80 _from-end_ only makes a difference in the case of a non-null _count_
81 argument. In the presence of _from-end_, the _count_ rightmost
82 delimited subsequences will be in the order that they are in
83 _sequence_ in the first return value, and the second is the index
84 indicating the end of the unprocessed region.
85
86 The _start_ and _end_ keyword arguments permit a certain subsequence
87 of the _sequence_ to be processed without the need for a copying
88 stage; their use is conceptually equivalent to partitioning the
89 subsequence delimited by _start_ and _end_, only without the need for
90 copying.
91
92 If _remove-empty-subseqs_ is null (the default), then empty
93 subsequences will be included in the result.
94
95 In all cases, the subsequences in the first return value will be in
96 the order that they appeared in _sequence_.
97
98
99 __Examples:__
100
101 <pre>
102 SPLIT-SEQUENCE> (split-sequence #\Space "A stitch in time saves nine.")
103 ⇒ ("A" "stitch" "in" "time" "saves" "nine.")
104 ⇒ 28
105
106 SPLIT-SEQUENCE> (split-sequence #\, "foo,bar ,baz, foobar , barbaz,")
107 ⇒ ("foo" "bar " "baz" " foobar " " barbaz" "")
108 ⇒ 30
109 </pre>