├── README.md
├── examples
├── dice.lisp
├── dickens.names
├── gnome.names
├── goblin.names
├── namer.lisp
└── us.names
├── src
├── any.lisp
├── character.lisp
├── contains.lisp
├── drop.lisp
├── file.lisp
├── filter.lisp
├── hash.lisp
├── leave.lisp
├── package.lisp
├── stream.lisp
├── string.lisp
├── tails.lisp
├── take.lisp
└── tap.lisp
└── taps.asd
/README.md:
--------------------------------------------------------------------------------
1 | # Taps
2 | A library of conveniences for working with SERIES
3 |
4 | ## Introduction
5 |
6 | Richard Waters' SERIES package for Common Lisp provides a powerful and interesting solution to working with sequences, collections, and streams. The **Taps** library adds a small number of functions that make SERIES more convenient to work with in many common situations.
7 |
8 | A **tap** in the real world is a device that opens and closes a valve, enabling a fluid to flow or preventing it from doing so. In the Taps library, a tap is a function that turns some data structure into a series of values. Taps provides functions that create series from streams, strings, and iterative computations, and provides convenient functions for mapping over, filtering, and collecting results.
9 |
10 | The workflow for which Taps is designed is this:
11 |
12 | 1. Call a function to tap a data structure, creating a flow of values
13 | 2. Select or filter the values of interest using another function
14 | 3. Map another function over the selected values to produce a series of outputs
15 | 4. Collect the results using a collector function
16 |
17 | Used judiciously, Taps can make many looping or iterative processes easier to write and easier to read.
18 |
19 | ## Taps Reference
20 |
21 | This section describes the functions that make up the Taps library. The generic function `tap` is the heart of the library, but several utility functions are also provided for mapping over series, collecting values from them, and so on.
22 |
23 | In most cases a function that operates on series also works if its arguments are Common Lisp sequences. For example, you can use `take` to collect values from a series, but it works just as well to collect values from lists, strings, or vectors.
24 |
25 | ### Variables
26 |
27 | **+line-break-characters+** *Special variable*
28 | The default set of characters used to break lines of text.
29 |
30 | **+whitespace-characters+** *Special variable*
31 | The default set of characters treated as whitespace.
32 |
33 | ### Functions
34 |
35 | **any** *Generic function*
36 |
37 | any (series) => value
38 |
39 | Returns an arbitrary element of `series`.
40 |
41 | **Warning:** `any` works only on sequences and finite series. If applied to an infinite series it will never return.
42 |
43 | **contains?** *Generic function*
44 |
45 | contains? (series value &key (test 'eql))=> Boolean
46 |
47 | Returns true if `value` is a member of the series. `test` is used to compare `value` to elements of the series.
48 |
49 | **Warning:** `contains?` works only on sequences and finite series. If applied to an infinite series it will never return.
50 |
51 | **drop** *Generic function*
52 |
53 | drop (n series) => series*
54 |
55 | Returns a new series containing all the elements of `series` except for the first `n` elements.
56 |
57 | **filter** *Function*
58 |
59 | filter (fn series) => series*
60 | Returns a new series, `series*` created by mapping `fn` over the elements of `series` and collecting those for which `fn` returns a true value.
61 |
62 | **leave** *Generic function*
63 |
64 | leave (n series) => series*
65 |
66 | Returns a new series containing the last `n` elements of `series`.
67 |
68 | **Warning:** `leave` works only on sequences and finite series. If applied to an infinite series it will never return.
69 |
70 | **tails** *Generic function*
71 |
72 | tails (series) => series*
73 | Returns a new series of series. Each member series is constructed by dropping the first element of the previous series. If `series` is finite, then each tail will be finite. If it's inifnite, then the tails will be, too. Be careful how you use it; for example, `(tails (tap-integers))` returns an infinite series of infinite series.
74 |
75 | **tails-by** *Generic function*
76 |
77 | tails-by (n series) => series*
78 | Returns a new series of series. Each member series is constructed by dropping the first `n` elements of the previous series. If `series` is finite, then each tail will be finite. If it's inifnite, then the tails will be, too. Be careful how you use it; for example, `(tails-by n (tap-integers))` returns an infinite series of infinite series.
79 |
80 | **take** *Generic function*
81 |
82 | take (n series) => series*
83 | Returns a new series that contains the first `n` elements of `series`.
84 |
85 | **take-by** *Generic function*
86 |
87 | take-by (n series) => series*
88 | Returns a new series created by splitting `series` into shorter series, each one containing `n` elements of `series`.
89 |
90 | **take-m-by-n** *Generic function*
91 |
92 | take-m-by-n (m n series) => series*
93 | Returns a new series created by repeatedly collecting `m` elements of `series`, starting with the first element of `series` and moving the starting point forward each time by `n`.
94 |
95 | **take-until** *Function*
96 |
97 | take-until (predicate series) => series*
98 | Returns a new series created by collecting elements from the start of `series` until applying `predicate` to an element returns a true value.
99 |
100 | **tap** *Generic function*
101 |
102 | tap (element-type source &key &allow-other-keys) => series
103 |
104 | Returns a new series created by computing a (possibly infinite) series of values from `source`. The type of values and the method used to compute them depends on both `element-type` and `source`.
105 |
106 | | element-type | source | Description |
107 | | ------ | ------ | ------ |
108 | | `:bytes` | `stream` | Returns a series of bytes read from the stream. |
109 | | `:bytes` | `pathname` | Returns a series of bytes read from the file. |
110 | | `:characters` | `stream` | Returns a series of characters read from the stream. |
111 | | `:characters` | `pathname` | Returns a series of character read from the file. |
112 | | `:characters` | `string` | Returns a series of characters read from the string. |
113 | | `:words` | `stream` | Returns a series of 'words' read from the stream.
Pass the keyword argument `:word-break-characters`
with a list of characters to control text is broken into words. |
114 | | `:words` | `pathname` | Returns a series of 'words' read from the file.
Pass the keyword argument `:word-break-characters`
with a list of characters to control text is broken into words. |
115 | | `:words` | `string` | Returns a series of 'words' read from the string.
Pass the keyword argument `:word-break-characters`
with a list of characters to control text is broken into words. |
116 | | `:lines` | `stream` | Returns a series of lines of text read from the stream.
Pass the keyword argument `:line-break-characters`
with a list of characters to control how text is broken into lines.|
117 | | `:lines` | `pathname` | Returns a series of lines of text read from the file.
Pass the keyword argument `:line-break-characters`
with a list of characters to control how text is broken into lines.|
118 | | `:lines` | `string` | Returns a series of lines of text read from the string.
Pass the keyword argument `:line-break-characters`
with a list of characters to control how text is broken into lines.|
119 | | `:objects` | `stream` | Returns a series of Lisp objects read from the stream. |
120 | | `:objects` | `pathname` | Returns a series of Lisp objects read from the file. |
121 | | `:objects` | `string` | Returns a series of Lisp objects read from the string. |
122 | | `:hash-entries` | `hash-table` | Returns two series as multiple values: a series of the keys in the hash-table, and a series of its corresponding values. |
123 | | `:keys` | `hash-table` | Returns a series containing the keys from the hash-table. |
124 | | `:values` | `hash-table` | Returns a series containing the values from the hash-table. |
125 |
126 | **tap-fn** *Function*
127 |
128 | tap-fn (fn series) => series
129 |
130 | Returns a new series of values computed by mapping the function `fn` over the elements of `series`.
131 |
132 | **tap-integers** *Function*
133 |
134 | tap-integers (&key from by upto below downto above) => series
135 |
136 | Returns a new series of integers. The first element of the series is
137 | `from`, whose default value is zero. Each successive element is
138 | obtained by adding the value of `by` to the previous one. THe default
139 | value of `by` is one. If `upto` is supplied then the series continues
140 | until the next element is greater than `upto`. If `below` is supplied,
141 | it continues until the next element is greater than or equal to
142 | `below`. If `downto` is supplied, it continues until the next element
143 | is less than `downto`. If `above` is supplied then it continues until
144 | the next element is less than or equal to `above`.
145 |
146 | The series returned by tap-integers may be of infinite length. For
147 | example, the expression
148 |
149 | (tap-integers)
150 |
151 | returns an infinite series that starts with
152 |
153 | #Z(0 1 2 3 ...
154 |
155 | **tap-random-integers** *Function*
156 |
157 | tap-random-integers (below &optional (random-state *random-state*)) => series
158 |
159 | Returns an infinite series of random integers, each less than `below`.
160 |
161 |
--------------------------------------------------------------------------------
/examples/dice.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: dice.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: how to use taps to roll dice
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defparameter *rolled-dice*
14 | (tap-random-integers 6))
15 |
16 | (defun roll-the-dice ()
17 | (let ((dice (map-fn t '1+ (take 2 *rolled-dice*))))
18 | (setf *rolled-dice*
19 | (drop 2 *rolled-dice*))
20 | dice))
21 |
22 | ;;; (roll-the-dice)
23 |
24 |
--------------------------------------------------------------------------------
/examples/dickens.names:
--------------------------------------------------------------------------------
1 | Abel
2 | Ada
3 | Adams
4 | Affery
5 | Aged
6 | Agnes
7 | Alexandre
8 | Alfred
9 | Alice
10 | Allan
11 | Allen
12 | Angelo
13 | Anne
14 | Annie
15 | Anthony
16 | Arabella
17 | Arthur
18 | Augustus
19 | Ayresleigh
20 | Badger
21 | Bagman
22 | Bagnet
23 | Bagstock
24 | Bamber
25 | Bantam
26 | Barbara
27 | Barbary
28 | Bardell
29 | Barkis
30 | Barley
31 | Barnaby
32 | Barnacle
33 | Barsad
34 | Bates
35 | Bayham
36 | Bazzard
37 | Belle
38 | Benjamin
39 | Bentley
40 | Bertha
41 | Betsy
42 | Betty
43 | Bevan
44 | Biddy
45 | Bill
46 | Bitzer
47 | Blackpool
48 | Blimber
49 | Bob
50 | Boffin
51 | Bounderby
52 | Boythorn
53 | Brass
54 | Bray
55 | Brick
56 | Brickmaker
57 | Browdie
58 | Brown
59 | Brownlow
60 | Bucket
61 | Bud
62 | Bumble
63 | Bunsby
64 | Buzfuz
65 | Caleb
66 | Carker
67 | Caroline
68 | Carstone
69 | Carton
70 | Casby
71 | Cavalletto
72 | Chadband
73 | Chancery
74 | Charity
75 | Charles
76 | Charley
77 | Charlie
78 | Charlotte
79 | Cheeryble
80 | Chester
81 | Chick
82 | Chickenstalker
83 | Chivery
84 | Chowser
85 | Christopher
86 | Chuzzlewit
87 | Clara
88 | Clare
89 | Claypole
90 | Clennam
91 | Compeyson
92 | Copperfield
93 | Cornelia
94 | Corney
95 | Cratchit
96 | Creakle
97 | Creevy
98 | Crewler
99 | Crimple
100 | Cripples
101 | Crisparkle
102 | Crummles
103 | Cruncher
104 | Cuttle
105 | Cyrus
106 | Daisy
107 | Daniel
108 | Darnay
109 | Dartle
110 | Datchery
111 | David
112 | Dawkins
113 | Dedlock
114 | Defarge
115 | Dennis
116 | Dick
117 | Dilber
118 | Dismal
119 | Diver
120 | Dodson
121 | Dolge
122 | Dolls
123 | Dombey
124 | Dora
125 | Dorrit
126 | Doyce
127 | Drood
128 | Drummle
129 | Duff
130 | Durdles
131 | Early
132 | Ebenezer
133 | Edith
134 | Edmund
135 | Edward
136 | Edwin
137 | Emily
138 | Ernest
139 | Estella
140 | Esther
141 | Fagin
142 | Fanny
143 | Feeder
144 | Fezziwig
145 | Fielding
146 | Finching
147 | Fizkin
148 | Flintwinch
149 | Flite
150 | Flora
151 | Fogg
152 | Frank
153 | Fred
154 | Gaffer
155 | Gamp
156 | Gargery
157 | Garland
158 | Gay
159 | General
160 | George
161 | Ghost
162 | Giles
163 | Gowan
164 | Grace
165 | Gradgrind
166 | Graham
167 | Grainger
168 | Granger
169 | Grayper
170 | Grewgious
171 | Gride
172 | Gridley
173 | Grimwig
174 | Grueby
175 | Gulpidge
176 | Gummidge
177 | Guppy
178 | Ham
179 | Harmon
180 | Harold
181 | Harriet
182 | Harris
183 | Harry
184 | Harthouse
185 | Havisham
186 | Hawdon
187 | Hawk
188 | Heep
189 | Helena
190 | Henrietta
191 | Henry
192 | Hexam
193 | Higden
194 | Hominy
195 | Honeythunder
196 | Honoria
197 | Horatio
198 | Hortense
199 | Hubbles
200 | Hugh
201 | Hunter
202 | Hutley
203 | Impetuous
204 | Isabella
205 | Jack
206 | Jacob
207 | Jaggers
208 | James
209 | Janet
210 | Jarndyce
211 | Jarvis
212 | Jasper
213 | Jeddler
214 | Jefferson
215 | Jellyby
216 | Jem
217 | Jemmy
218 | Jenny
219 | Jeremiah
220 | Jerry
221 | Jingle
222 | Job
223 | Joe
224 | John
225 | Jorkins
226 | Joseph
227 | Josiah
228 | Kate
229 | Kedgick
230 | Kenge
231 | Kenwigs
232 | Kidgerbury
233 | Kindly
234 | Kit
235 | Krook
236 | La
237 | Lammle
238 | Landless
239 | Langdale
240 | Larkins
241 | Lawrence
242 | Leeford
243 | Leicester
244 | Lenville
245 | Leo
246 | Lewsome
247 | Lightwood
248 | Lillian
249 | Lillyvick
250 | Linkinwater
251 | Littimer
252 | Lizzie
253 | Longford
254 | Lorry
255 | Losberne
256 | Louisa
257 | Lowten
258 | Lucie
259 | Lucretia
260 | Luke
261 | Lupin
262 | M'Choakumchild
263 | Madeline
264 | Maggy
265 | Magnus
266 | Magwitch
267 | Major
268 | Manette
269 | Mann
270 | Mantalini
271 | Marion
272 | Mark
273 | Marley
274 | Martha
275 | Marton
276 | Marwood
277 | Mary
278 | Maylie
279 | Meagles
280 | Mercy
281 | Merdle
282 | Micawber
283 | Milly
284 | Minia
285 | Minnie
286 | Molly
287 | Montigue
288 | Mortimer
289 | Mr
290 | Mulberry
291 | Murdstone
292 | Nancy
293 | Nathaniel
294 | Neckett
295 | Ned
296 | Nelly
297 | Nemo
298 | Neville
299 | Newman
300 | Nicholas
301 | Nickleby
302 | Nipper
303 | Noah
304 | Noddy
305 | Noggs
306 | Norris
307 | Nubbles
308 | Nupkins
309 | Oliver
310 | Omer
311 | Orlick
312 | Pancks
313 | Paul
314 | Pawkins
315 | Payne
316 | Pecksniff
317 | Peerybingle
318 | Peggotty
319 | Perker
320 | Peter
321 | Phil
322 | Philip
323 | Pickwick
324 | Pinch
325 | Pip
326 | Pirrip
327 | Plornish
328 | Plummer
329 | Polly
330 | Pott
331 | Prince
332 | Pross
333 | Pumblechook
334 | Quilp
335 | Quinion
336 | Rachael
337 | Radfoot
338 | Ralph
339 | Redlaw
340 | Resentfully
341 | Richard
342 | Riderhood
343 | Rigaud
344 | Rokesmith
345 | Rosa
346 | Rose
347 | Rouncewell
348 | Rudge
349 | Rugg
350 | Sairey
351 | Sally
352 | Sampson
353 | Samuel
354 | Sarah
355 | Scrooge
356 | Serjeant
357 | Seth
358 | Sikes
359 | Simon
360 | Skimpole
361 | Slammer
362 | Slowboy
363 | Slumkey
364 | Smallweed
365 | Smike
366 | Snagsby
367 | Snodgrass
368 | Solomon
369 | Sophy
370 | Sowerberry
371 | Sparkler
372 | Spenlow
373 | Spottletoe
374 | Squeers
375 | Squod
376 | Stagg
377 | Steerforth
378 | Stephen
379 | Stiltstalking
380 | Strong
381 | Summerson
382 | Susan
383 | Sweedlepipe
384 | Swidger
385 | Swiveller
386 | Sydney
387 | Tackleton
388 | Tapley
389 | Tappertit
390 | Tattycoram
391 | Tetterby
392 | Thomas
393 | Ticket
394 | Tiffey
395 | Tigg
396 | Tilly
397 | Tim
398 | Tiny
399 | Tisher
400 | Todgers
401 | Tom
402 | Tommy
403 | Tony
404 | Toodle
405 | Toots
406 | Tox
407 | Trabb
408 | Tracy
409 | Traddles
410 | Trent
411 | Trotter
412 | Trotwood
413 | Tulkinghorn
414 | Tupman
415 | Turveydrop
416 | Twist
417 | Uriah
418 | Vholes
419 | Vincent
420 | Volumnia
421 | Wackford
422 | Wade
423 | Walter
424 | Wardle
425 | Waterbrook
426 | Watt
427 | Weller
428 | Wemmick
429 | Westlock
430 | Whimple
431 | Wickfield
432 | Wigsby
433 | Wilkins
434 | William
435 | Winkle
436 | Witherfield
437 | Woodcourt
438 | Wopsle
439 | Yeoman
440 | York
441 | Zamiel
442 |
--------------------------------------------------------------------------------
/examples/gnome.names:
--------------------------------------------------------------------------------
1 | Ample
2 | Arvo
3 | Beppi
4 | Bilby
5 | Bink
6 | Binkie
7 | Binkly
8 | Bixel
9 | Blasto
10 | Boley
11 | Bolty
12 | Burto
13 | Carabonk
14 | Chadwin
15 | Eugus
16 | Eustus
17 | Fangly
18 | Farvo
19 | Fidney
20 | Finton
21 | Fixie
22 | Fizbert
23 | Fizz
24 | Fizzle
25 | Frelto
26 | Frensby
27 | Garliber
28 | Gedwig
29 | Gelbin
30 | Gemminy
31 | Glindy
32 | Gyratacus
33 | Gyrus
34 | Higsber
35 | Indus
36 | Lilbury
37 | Malvin
38 | Markle
39 | Mashley
40 | Mazzle
41 | Mickle
42 | Middley
43 | Morgle
44 | Morkle
45 | Mumble
46 | Nabulesto
47 | Nardo
48 | Orver
49 | Orvilbert
50 | Orvilbus
51 | Orvio
52 | Paulpidge
53 | Philber
54 | Plock
55 | Pock
56 | Pomble
57 | Pondy
58 | Pongy
59 | Raffy
60 | Razzle
61 | Splodey
62 | Spongo
63 | Sprightly
64 | Tilby
65 | Tinky
66 | Trilley
67 | Twidgel
68 | Twonky
69 | Vilby
70 | Widger
71 | Widgie
72 | Wilbert
73 | Wilton
74 | Wiz
75 | Wombelius
76 | Zilius
77 |
--------------------------------------------------------------------------------
/examples/goblin.names:
--------------------------------------------------------------------------------
1 | Abghat
2 | Adgulg
3 | Agugh
4 | Aguk
5 | Alog
6 | Ambilg
7 | Argha
8 | Argigoth
9 | Argug
10 | Arpigig
11 | Azhug
12 | Azog
13 | Bagdud
14 | Baghig
15 | Bandagh
16 | Barfu
17 | Bargulg
18 | Berbog
19 | Bidgug
20 | Bildud
21 | Bizbog
22 | Bog
23 | Boghak
24 | Bolg
25 | Borgol
26 | Borug
27 | Brugagh
28 | Budagh
29 | Bulgak
30 | Bumhug
31 | Bordud
32 | Buugug
33 | Cabugbu
34 | Cagank
35 | Carguk
36 | Carthurk
37 | Clog
38 | Corgak
39 | Croksu
40 | Cukgilug
41 | Curbag
42 | Dabub
43 | Dakgorm
44 | Dakgu
45 | Darfu
46 | Dakgu
47 | Dergu
48 | Derthag
49 | Digdug
50 | Diggu
51 | Dilgu
52 | Ditgur
53 | Dorgarg
54 | Dregu
55 | Dretkag
56 | Drigka
57 | Drikdrok
58 | Druthu
59 | Dudgog
60 | Dugroks
61 | Dugrim
62 | Dultag
63 | Durbag
64 | Egnug
65 | Eggat
66 | Epkag
67 | Ergoth
68 | Ertguth
69 | Ewkbonk
70 | Fagdud
71 | Fankagh
72 | Farfu
73 | Farthog
74 | Faugh
75 | Fidgug
76 | Fodgog
77 | Fogugh
78 | Fozhug
79 | Frakug
80 | Frug
81 | Frukag
82 | Fudbog
83 | Fudhagh
84 | Fupgugh
85 | Furbog
86 | Futgark
87 | Gaakt
88 | Garekk
89 | Glub
90 | Gholug
91 | Gilakt
92 | Ginug
93 | Gnabgag
94 | Gnadbug
95 | Gnalburg
96 | Gnarg
97 | Gnarlug
98 | Gnorl
99 | Gnort
100 | Gnoth
101 | Gnurl
102 | Golag
103 | Golub
104 | Gomag
105 | Gomok
106 | Gorbag
107 | Gorfang
108 | Gorgu
109 | Gorlag
110 | Gragrut
111 | Greevil
112 | Grikrug
113 | Grimgor
114 | Grishnakh
115 | Gurg
116 | Grukk
117 | Grung
118 | Gruul
119 | Guag
120 | Gubdag
121 | Gudhagh
122 | Gug
123 | Gujark
124 | Gurjek
125 | Gulm
126 | Gulrn
127 | Gunaakt
128 | Gunag
129 | Gunug
130 | Gurukk
131 | Guthag
132 | Guthug
133 | Hagob
134 | Hagbu
135 | Hagub
136 | Haguk
137 | Hebub
138 | Hegug
139 | Hibub
140 | Hig
141 | Hogug
142 | Hoknakh
143 | Hoknath
144 | Hoknug
145 | Hoklurk
146 | Holkurg
147 | Horknug
148 | Hrolkug
149 | Huggug
150 | Hugmug
151 | Hugolm
152 | Ig
153 | Igmug
154 | Ignorg
155 | Igbatch
156 | Igug
157 | Igurg
158 | Ignat
159 | Ikkatch
160 | Inkagh
161 | Jogug
162 | Jokgagu
163 | Jopkrank
164 | Jorgag
165 | Jregh
166 | Jreghug
167 | Jugag
168 | Jughog
169 | Jughragh
170 | Kabug
171 | Kaghed
172 | Kahigg
173 | Karfu
174 | Karguk
175 | Karthurg
176 | Kebub
177 | Keggoth
178 | Kegth
179 | Kerghug
180 | Kertug
181 | Kilug
182 | Klapdug
183 | Klog
184 | Klughig
185 | Knagh
186 | Knaraugh
187 | Knodagh
188 | Knorgh
189 | Knuguk
190 | Knurigg
191 | Kodagg
192 | Kog
193 | Kogan
194 | Komarg
195 | Korgak
196 | Korgulg
197 | Kughat
198 | Kraugug
199 | Krothu
200 | Krugbu
201 | Krugrim
202 | Kugbu
203 | Kukgilg
204 | Kulgha
205 | Kupgugh
206 | Kurbag
207 | Kurmbag
208 | Langug
209 | Lug
210 | Lugdush
211 | Mabub
212 | Magbob
213 | Malthug
214 | Marfurz
215 | Margulg
216 | Mazhug
217 | Merggoth
218 | Milug
219 | Morglum
220 | Mugrog
221 | Mughragh
222 | Mugrum
223 | Murbag
224 | Muzgash
225 | Naghat
226 | Naghig
227 | Naguk
228 | Nakgu
229 | Narfu
230 | Nargrogg
231 | Nargulg
232 | Narhbub
233 | Nodgog
234 | Nofhug
235 | Nogugh
236 | Nongulg
237 | Noogugh
238 | Nugbu
239 | Nughilg
240 | Numhug
241 | Nurbag
242 | Nurghed
243 | Ogungd
244 | Oakgu
245 | Obghat
246 | Oggha
247 | Oggugat
248 | Ogharod
249 | Oghuglat
250 | Oguk
251 | Ogkank
252 | Olagg
253 | Olaugh
254 | Oldagh
255 | Olog
256 | Omghed
257 | Omgulg
258 | Omgug
259 | Onog
260 | Onub
261 | Onugg
262 | Oodagh
263 | Oogrim
264 | Oogbag
265 | Oomgig
266 | Opghat
267 | Opkag
268 | Opguk
269 | Orgh
270 | Orgoth
271 | Orgug
272 | Orpgig
273 | Ortguth
274 | Otug
275 | Oogag
276 | Owkbank
277 | Pagrim
278 | Pahggoth
279 | Pahgrum
280 | Pakgu
281 | Parfu
282 | Pargu
283 | Pargbub
284 | Peghed
285 | Pekrak
286 | Pergu
287 | Perthag
288 | Pigdug
289 | Piggu
290 | Pitgurt
291 | Podgog
292 | Pofhug
293 | Pogmulg
294 | Poogugh
295 | Porgrag
296 | Pruthbug
297 | Pughlug
298 | Purbag
299 | Qog
300 | Quadagh
301 | Quimghig
302 | Quomagh
303 | Quugug
304 | Radbug
305 | Raghat
306 | Raguk
307 | Rakgu
308 | Rarfu
309 | Rebub
310 | Rilug
311 | Rodgog
312 | Rugboks
313 | Rugbu
314 | Rugrim
315 | Rurgbag
316 | Rurgig
317 | Saghig
318 | Saggoth
319 | Sahgrim
320 | Sakgu
321 | Salkhug
322 | Sargug
323 | Sargulg
324 | Sguk
325 | Shagrat
326 | Shomdub
327 | Shulhug
328 | Sildug
329 | Shinzbog
330 | Skarsnik
331 | Slaghig
332 | Slapdud
333 | Slaugh
334 | Slodagh
335 | Slog
336 | Slughig
337 | Smaghed
338 | Smegugh
339 | Smogulg
340 | Snog
341 | Snubub
342 | Snugug
343 | Sodagh
344 | Sog
345 | Sugrim
346 | Sogbu
347 | Sogugh
348 | Somgig
349 | Sorgulg
350 | Sornarg
351 | Sughat
352 | Speezbag
353 | Speghat
354 | Spoguk
355 | Squagan
356 | Stugbu
357 | Sudgog
358 | Sugrod
359 | Sugbu
360 | Suhgan
361 | Sulgh
362 | Sulmthu
363 | Sumhug
364 | Snodagh
365 | Snuguk
366 | Spaugh
367 | Supgugh
368 | Surbag
369 | Surghed
370 | Surgug
371 | Tagdud
372 | Taghig
373 | Tandagh
374 | Tarfu
375 | Targhed
376 | Targgoth
377 | Targod
378 | Taugh
379 | Tredgug
380 | Tidgug
381 | Todgog
382 | Tog
383 | Toghat
384 | Togugh
385 | Torgang
386 | Torug
387 | Tozhug
388 | Traugh
389 | Trilug
390 | Troughul
391 | Trugagh
392 | Trugug
393 | Tuggug
394 | Tulgan
395 | Turbag
396 | Ug
397 | Ugghrog
398 | Uggug
399 | Ughat
400 | Ugluk
401 | Ulgatch
402 | Ulmragh
403 | Ulmrogh
404 | Umragg
405 | Umrugg
406 | Unruggh
407 | Urag
408 | Uraugh
409 | Urg
410 | Urgan
411 | Urghat
412 | Urgran
413 | Urlgan
414 | Urmug
415 | Urug
416 | Urulg
417 | Vagbug
418 | Vagank
419 | Vagrunj
420 | Vagunj
421 | Vagkarg
422 | Vakgu
423 | Vakmul
424 | Valthurg
425 | Vambag
426 | Varbu
427 | Varbuk
428 | Varfu
429 | Vargand
430 | Varguk
431 | Varkgorr
432 | Varthurg
433 | Vergu
434 | Vorthag
435 | Vurthurg
436 | Vidark
437 | Vidgolg
438 | Vidgug
439 | Vigluk
440 | Vitgrat
441 | Vitgut
442 | Vlog
443 | Vlorg
444 | Vorgak
445 | Vorgarg
446 | Vregu
447 | Vretkag
448 | Vrigku
449 | Vrikdrak
450 | Vrogak
451 | Vrograg
452 | Vrothug
453 | Vruhag
454 | Vruthug
455 | Vublub
456 | Vugub
457 | Vultag
458 | Vukglug
459 | Vultog
460 | Vulug
461 | Vurbag
462 | Wakgut
463 | Wandrug
464 | Wapkut
465 | Warguk
466 | Wauktug
467 | Wegbub
468 | Welgub
469 | Wholug
470 | Wingug
471 | Wobdug
472 | Wogrod
473 | Woghulg
474 | Woglug
475 | Wokgant
476 | Womkug
477 | Worthag
478 | Wudgh
479 | Wudhagh
480 | Wudgog
481 | Wuglakh
482 | Wumank
483 | Wunkbank
484 | Wurgoth
485 | Wurtguth
486 | Wurthu
487 | Wutgark
488 | Xagok
489 | Xagu
490 | Xaguk
491 | Xarlug
492 | Xarpug
493 | Xegbug
494 | Xigg
495 | Xnath
496 | Xnarl
497 | Xnurl
498 | Xoknatch
499 | Xokruk
500 | Xolrag
501 | Xolkug
502 | Xomakh
503 | Xomkug
504 | Xomku
505 | Xorbag
506 | Xorakk
507 | Xorku
508 | Xoruk
509 | Xothkug
510 | Xruul
511 | Xuag
512 | Xug
513 | Xugag
514 | Xugarg
515 | Xugarf
516 | Xugorr
517 | Xugug
518 | Xujark
519 | Xuk
520 | Xulgag
521 | Xunaakt
522 | Xunag
523 | Xunug
524 | Xurek
525 | Xurlug
526 | Xurukk
527 | Xurtag
528 | Xuthak
529 | Yaghed
530 | Yagnar
531 | Yagnatz
532 | Yahg
533 | Yahigg
534 | Yakgnath
535 | Yakha
536 | Yalakgh
537 | Yargug
538 | Yarvix
539 | Yuggoth
540 | Yerghug
541 | Yerug
542 | Yokgag
543 | Yokgu
544 | Yolmarg
545 | Yonkthu
546 | Yregh
547 | Yrooh
548 | Ygsbarg
549 | Yughragh
550 | Yugug
551 | Yuknatch
552 | Yulakgh
553 | Yunkath
554 | Zabghat
555 | Zagbub
556 | Zaghig
557 | Zahgorm
558 | Zalthug
559 | Zargug
560 | Zarfu
561 | Zargulg
562 | Zguk
563 | Zildug
564 | Zilug
565 | Zlog
566 | Zlughig
567 | Zodagh
568 | Zog
569 | Zogbu
570 | Zogugh
571 | Zonagh
572 | Zorfu
573 | Zorgulg
574 | Zudgog
575 | Zugrod
576 | Zugbu
577 | Zulghun
578 | Zumhug
579 | Zunguk
580 | Zupaugh
581 | Zupgugh
582 | Zurbag
583 | Zurghed
584 | Zurgug
585 |
--------------------------------------------------------------------------------
/examples/namer.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: namer.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: a name generator using taps
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defparameter *name-starts* nil)
14 | (defparameter *name-parts* nil)
15 | (defparameter *name-ends* nil)
16 |
17 | (defun long-enough? (seq)
18 | (> (length seq) 2))
19 |
20 | (defun triples (str)
21 | (take-until (lambda (it)(not (long-enough? it)))
22 | (take-m-by-n 3 1 str)))
23 |
24 | (defun read-names (filename)
25 | (map-fn t #'triples
26 | (filter #'long-enough?
27 | (tap :lines (pathname filename)))))
28 |
29 | ;;; (time (read-names "dickens.names"))
30 |
31 | (defun name-starts (name-lists)
32 | (map-fn t #'first name-lists))
33 |
34 | ;;; (name-starts (read-names "dickens.names"))
35 |
36 | (defun remove-nil (series)
37 | (choose series series))
38 |
39 | (defun name-parts (name-lists)
40 | (scan
41 | (collect-append
42 | (remove-nil
43 | (map-fn t #'rest
44 | name-lists)))))
45 |
46 | ;;; (name-parts (read-names "dickens.names"))
47 |
48 | (defun name-ends (name-lists)
49 | (map-fn t #'(lambda (nm)(first (last nm))) name-lists))
50 |
51 | ;;; (name-ends (read-names "dickens.names"))
52 |
53 | (defun init-rules (sample-file)
54 | (let ((samples (read-names sample-file)))
55 | (setf *name-starts* (name-starts samples))
56 | (setf *name-parts* (name-parts samples))
57 | (setf *name-ends* (name-ends samples))
58 | nil))
59 |
60 | ;;; (init-rules "dickens.names")
61 |
62 | (defun mergeable? (left right)
63 | (equalp (leave 2 left)
64 | (take 2 right)))
65 |
66 | (defmethod merge-parts ((left string)(right string))
67 | (concatenate 'string
68 | left
69 | (drop 2 right)))
70 |
71 | (defun any-start ()
72 | (any *name-starts*))
73 |
74 | ;;; (time (any-start))
75 |
76 | (defun find-extension (start)
77 | (any (filter (lambda (part)(mergeable? start part))
78 | *name-parts*)))
79 |
80 | ;;; (init-rules "dickens.names")
81 | ;;; (defparameter $start (any-start))
82 | ;;; (find-extension $start)
83 |
84 | (defun extend-name (start)
85 | (let ((next (find-extension start)))
86 | (if next
87 | (if (contains? *name-ends* next :test #'equalp)
88 | (merge-parts start next)
89 | (extend-name (merge-parts start next)))
90 | start)))
91 |
92 | (defun generate-name (samples-file)
93 | (init-rules samples-file)
94 | (extend-name (any-start)))
95 |
96 | ;;; (generate-name "dickens.names")
97 |
98 | (defun generate-names (n samples-file)
99 | (init-rules samples-file)
100 | (take n
101 | (map-fn t (lambda (i)(extend-name (any-start)))
102 | (tap-integers))))
103 |
104 |
105 | ;;; (time (generate-names 100 "goblin.names"))
106 | ;;; (generate-names 10 "dickens.names")
107 | ;;; (generate-names 10 "us.names")
108 | ;;; (generate-names 10 "gnome.names")
109 | ;;; (generate-names 10 "goblin.names")
110 |
--------------------------------------------------------------------------------
/examples/us.names:
--------------------------------------------------------------------------------
1 | James
2 | John
3 | Robert
4 | Michael
5 | William
6 | David
7 | Richard
8 | Charles
9 | Joseph
10 | Thomas
11 | Christopher
12 | Daniel
13 | Paul
14 | Mark
15 | Donald
16 | George
17 | Kenneth
18 | Steven
19 | Edward
20 | Brian
21 | Ronald
22 | Anthony
23 | Kevin
24 | Jason
25 | Matthew
26 | Gary
27 | Timothy
28 | Jose
29 | Larry
30 | Jeffrey
31 | Frank
32 | Scott
33 | Eric
34 | Stephen
35 | Andrew
36 | Raymond
37 | Gregory
38 | Joshua
39 | Jerry
40 | Dennis
41 | Walter
42 | Patrick
43 | Peter
44 | Harold
45 | Douglas
46 | Henry
47 | Carl
48 | Arthur
49 | Ryan
50 | Roger
51 | Joe
52 | Juan
53 | Jack
54 | Albert
55 | Jonathan
56 | Justin
57 | Terry
58 | Gerald
59 | Keith
60 | Samuel
61 | Willie
62 | Ralph
63 | Lawrence
64 | Nicholas
65 | Roy
66 | Benjamin
67 | Bruce
68 | Brandon
69 | Adam
70 | Harry
71 | Fred
72 | Wayne
73 | Billy
74 | Steve
75 | Louis
76 | Jeremy
77 | Aaron
78 | Randy
79 | Howard
80 | Eugene
81 | Carlos
82 | Russell
83 | Bobby
84 | Victor
85 | Martin
86 | Ernest
87 | Phillip
88 | Todd
89 | Jesse
90 | Craig
91 | Alan
92 | Shawn
93 | Clarence
94 | Sean
95 | Philip
96 | Chris
97 | Johnny
98 | Earl
99 | Jimmy
100 | Antonio
101 | Danny
102 | Bryan
103 | Tony
104 | Luis
105 | Mike
106 | Stanley
107 | Leonard
108 | Nathan
109 | Dale
110 | Manuel
111 | Rodney
112 | Curtis
113 | Norman
114 | Allen
115 | Marvin
116 | Vincent
117 | Glenn
118 | Jeffery
119 | Travis
120 | Jeff
121 | Chad
122 | Jacob
123 | Lee
124 | Melvin
125 | Alfred
126 | Kyle
127 | Francis
128 | Bradley
129 | Jesus
130 | Herbert
131 | Frederick
132 | Ray
133 | Joel
134 | Edwin
135 | Don
136 | Eddie
137 | Ricky
138 | Troy
139 | Randall
140 | Barry
141 | Alexander
142 | Bernard
143 | Mario
144 | Leroy
145 | Francisco
146 | Marcus
147 | Micheal
148 | Theodore
149 | Clifford
150 | Miguel
151 | Oscar
152 | Jay
153 | Jim
154 | Tom
155 | Calvin
156 | Alex
157 | Jon
158 | Ronnie
159 | Bill
160 | Lloyd
161 | Tommy
162 | Leon
163 | Derek
164 | Warren
165 | Darrell
166 | Jerome
167 | Floyd
168 | Leo
169 | Alvin
170 | Tim
171 | Wesley
172 | Gordon
173 | Dean
174 | Greg
175 | Jorge
176 | Dustin
177 | Pedro
178 | Derrick
179 | Dan
180 | Lewis
181 | Zachary
182 | Corey
183 | Herman
184 | Maurice
185 | Vernon
186 | Roberto
187 | Clyde
188 | Glen
189 | Hector
190 | Shane
191 | Ricardo
192 | Sam
193 | Rick
194 | Lester
195 | Brent
196 | Ramon
197 | Charlie
198 | Tyler
199 | Gilbert
200 | Gene
201 | Marc
202 | Reginald
203 | Ruben
204 | Brett
205 | Angel
206 | Nathaniel
207 | Rafael
208 | Leslie
209 | Edgar
210 | Milton
211 | Raul
212 | Ben
213 | Chester
214 | Cecil
215 | Duane
216 | Franklin
217 | Andre
218 | Elmer
219 | Brad
220 | Gabriel
221 | Ron
222 | Mitchell
223 | Roland
224 | Arnold
225 | Harvey
226 | Jared
227 | Adrian
228 | Karl
229 | Cory
230 | Claude
231 | Erik
232 | Darryl
233 | Jamie
234 | Neil
235 | Jessie
236 | Christian
237 | Javier
238 | Fernando
239 | Clinton
240 | Ted
241 | Mathew
242 | Tyrone
243 | Darren
244 | Lonnie
245 | Lance
246 | Cody
247 | Julio
248 | Kelly
249 | Kurt
250 | Allan
251 | Nelson
252 | Guy
253 | Clayton
254 | Hugh
255 | Max
256 | Dwayne
257 | Dwight
258 | Armando
259 | Felix
260 | Jimmie
261 | Everett
262 | Jordan
263 | Ian
264 | Wallace
265 | Ken
266 | Bob
267 | Jaime
268 | Casey
269 | Alfredo
270 | Alberto
271 | Dave
272 | Ivan
273 | Johnnie
274 | Sidney
275 | Byron
276 | Julian
277 | Isaac
278 | Morris
279 | Clifton
280 | Willard
281 | Daryl
282 | Ross
283 | Virgil
284 | Andy
285 | Marshall
286 | Salvador
287 | Perry
288 | Kirk
289 | Sergio
290 | Marion
291 | Tracy
292 | Seth
293 | Kent
294 | Terrance
295 | Rene
296 | Eduardo
297 | Terrence
298 | Enrique
299 | Freddie
300 | Wade
301 | Austin
302 | Stuart
303 | Fredrick
304 | Arturo
305 | Alejandro
306 | Jackie
307 | Joey
308 | Nick
309 | Luther
310 | Wendell
311 | Jeremiah
312 | Evan
313 | Julius
314 | Dana
315 | Donnie
316 | Otis
317 | Shannon
318 | Trevor
319 | Oliver
320 | Luke
321 | Homer
322 | Gerard
323 | Doug
324 | Kenny
325 | Hubert
326 | Angelo
327 | Shaun
328 | Lyle
329 | Matt
330 | Lynn
331 | Alfonso
332 | Orlando
333 | Rex
334 | Carlton
335 | Ernesto
336 | Cameron
337 | Neal
338 | Pablo
339 | Lorenzo
340 | Omar
341 | Wilbur
342 | Blake
343 | Grant
344 | Horace
345 | Roderick
346 | Kerry
347 | Abraham
348 | Willis
349 | Rickey
350 | Jean
351 | Ira
352 | Andres
353 | Cesar
354 | Johnathan
355 | Malcolm
356 | Rudolph
357 | Damon
358 | Kelvin
359 | Rudy
360 | Preston
361 | Alton
362 | Archie
363 | Marco
364 | Wm
365 | Pete
366 | Randolph
367 | Garry
368 | Geoffrey
369 | Jonathon
370 | Felipe
371 | Bennie
372 | Gerardo
373 | Ed
374 | Dominic
375 | Robin
376 | Loren
377 | Delbert
378 | Colin
379 | Guillermo
380 | Earnest
381 | Lucas
382 | Benny
383 | Noel
384 | Spencer
385 | Rodolfo
386 | Myron
387 | Edmund
388 | Garrett
389 | Salvatore
390 | Cedric
391 | Lowell
392 | Gregg
393 | Sherman
394 | Wilson
395 | Devin
396 | Sylvester
397 | Kim
398 | Roosevelt
399 | Israel
400 | Jermaine
401 | Forrest
402 | Wilbert
403 | Leland
404 | Simon
405 | Guadalupe
406 | Clark
407 | Irving
408 | Carroll
409 | Bryant
410 | Owen
411 | Rufus
412 | Woodrow
413 | Sammy
414 | Kristopher
415 | Mack
416 | Levi
417 | Marcos
418 | Gustavo
419 | Jake
420 | Lionel
421 | Marty
422 | Taylor
423 | Ellis
424 | Dallas
425 | Gilberto
426 | Clint
427 | Nicolas
428 | Laurence
429 | Ismael
430 | Orville
431 | Drew
432 | Jody
433 | Ervin
434 | Dewey
435 | Al
436 | Wilfred
437 | Josh
438 | Hugo
439 | Ignacio
440 | Caleb
441 | Tomas
442 | Sheldon
443 | Erick
444 | Frankie
445 | Stewart
446 | Doyle
447 | Darrel
448 | Rogelio
449 | Terence
450 | Santiago
451 | Alonzo
452 | Elias
453 | Bert
454 | Elbert
455 | Ramiro
456 | Conrad
457 | Pat
458 | Noah
459 | Grady
460 | Phil
461 | Cornelius
462 | Lamar
463 | Rolando
464 | Clay
465 | Percy
466 | Dexter
467 | Bradford
468 | Merle
469 | Darin
470 | Amos
471 | Terrell
472 | Moses
473 | Irvin
474 | Saul
475 | Roman
476 | Darnell
477 | Randal
478 | Tommie
479 | Timmy
480 | Darrin
481 | Winston
482 | Brendan
483 | Toby
484 | Van
485 | Abel
486 | Dominick
487 | Boyd
488 | Courtney
489 | Jan
490 | Emilio
491 | Elijah
492 | Cary
493 | Domingo
494 | Santos
495 | Aubrey
496 | Emmett
497 | Marlon
498 | Emanuel
499 | Jerald
500 | Edmond
501 | Emil
502 | Dewayne
503 | Will
504 | Otto
505 | Teddy
506 | Reynaldo
507 | Bret
508 | Morgan
509 | Jess
510 | Trent
511 | Humberto
512 | Emmanuel
513 | Stephan
514 | Louie
515 | Vicente
516 | Lamont
517 | Stacy
518 | Garland
519 | Miles
520 | Micah
521 | Efrain
522 | Billie
523 | Logan
524 | Heath
525 | Rodger
526 | Harley
527 | Demetrius
528 | Ethan
529 | Eldon
530 | Rocky
531 | Pierre
532 | Junior
533 | Freddy
534 | Eli
535 | Bryce
536 | Antoine
537 | Robbie
538 | Kendall
539 | Royce
540 | Sterling
541 | Mickey
542 | Chase
543 | Grover
544 | Elton
545 | Cleveland
546 | Dylan
547 | Chuck
548 | Damian
549 | Reuben
550 | Stan
551 | August
552 | Leonardo
553 | Jasper
554 | Russel
555 | Erwin
556 | Benito
557 | Hans
558 | Monte
559 | Blaine
560 | Ernie
561 | Curt
562 | Quentin
563 | Agustin
564 | Murray
565 | Jamal
566 | Devon
567 | Adolfo
568 | Harrison
569 | Tyson
570 | Burton
571 | Brady
572 | Elliott
573 | Wilfredo
574 | Bart
575 | Jarrod
576 | Vance
577 | Denis
578 | Damien
579 | Joaquin
580 | Harlan
581 | Desmond
582 | Elliot
583 | Darwin
584 | Ashley
585 | Gregorio
586 | Buddy
587 | Xavier
588 | Kermit
589 | Roscoe
590 | Esteban
591 | Anton
592 | Solomon
593 | Scotty
594 | Norbert
595 | Elvin
596 | Williams
597 | Nolan
598 | Carey
599 | Rod
600 | Quinton
601 | Hal
602 | Brain
603 | Rob
604 | Elwood
605 | Kendrick
606 | Darius
607 | Moises
608 | Son
609 | Marlin
610 | Fidel
611 | Thaddeus
612 | Cliff
613 | Marcel
614 | Ali
615 | Jackson
616 | Raphael
617 | Bryon
618 | Armand
619 | Alvaro
620 | Jeffry
621 | Dane
622 | Joesph
623 | Thurman
624 | Ned
625 | Sammie
626 | Rusty
627 | Michel
628 | Monty
629 | Rory
630 | Fabian
631 | Reggie
632 | Mason
633 | Graham
634 | Kris
635 | Isaiah
636 | Vaughn
637 | Gus
638 | Avery
639 | Loyd
640 | Diego
641 | Alexis
642 | Adolph
643 | Norris
644 | Millard
645 | Rocco
646 | Gonzalo
647 | Derick
648 | Rodrigo
649 | Gerry
650 | Stacey
651 | Carmen
652 | Wiley
653 | Rigoberto
654 | Alphonso
655 | Ty
656 | Shelby
657 | Rickie
658 | Noe
659 | Vern
660 | Bobbie
661 | Reed
662 | Jefferson
663 | Elvis
664 | Bernardo
665 | Mauricio
666 | Hiram
667 | Donovan
668 | Basil
669 | Riley
670 | Ollie
671 | Nickolas
672 | Maynard
673 | Scot
674 | Vince
675 | Quincy
676 | Eddy
677 | Sebastian
678 | Federico
679 | Ulysses
680 | Heriberto
681 | Donnell
682 | Cole
683 | Denny
684 | Davis
685 | Gavin
686 | Emery
687 | Ward
688 | Romeo
689 | Jayson
690 | Dion
691 | Dante
692 | Clement
693 | Coy
694 | Odell
695 | Maxwell
696 | Jarvis
697 | Bruno
698 | Issac
699 | Mary
700 | Dudley
701 | Brock
702 | Sanford
703 | Colby
704 | Carmelo
705 | Barney
706 | Nestor
707 | Hollis
708 | Stefan
709 | Donny
710 | Art
711 | Linwood
712 | Beau
713 | Weldon
714 | Galen
715 | Isidro
716 | Truman
717 | Delmar
718 | Johnathon
719 | Silas
720 | Frederic
721 | Dick
722 | Kirby
723 | Irwin
724 | Cruz
725 | Merlin
726 | Merrill
727 | Charley
728 | Marcelino
729 | Lane
730 | Harris
731 | Cleo
732 | Carlo
733 | Trenton
734 | Kurtis
735 | Hunter
736 | Aurelio
737 | Winfred
738 | Vito
739 | Collin
740 | Denver
741 | Carter
742 | Leonel
743 | Emory
744 | Pasquale
745 | Mohammad
746 | Mariano
747 | Danial
748 | Blair
749 | Landon
750 | Dirk
751 | Branden
752 | Adan
753 | Numbers
754 | Clair
755 | Buford
756 | German
757 | Bernie
758 | Wilmer
759 | Joan
760 | Emerson
761 | Zachery
762 | Fletcher
763 | Jacques
764 | Errol
765 | Dalton
766 | Monroe
767 | Josue
768 | Dominique
769 | Edwardo
770 | Booker
771 | Wilford
772 | Sonny
773 | Shelton
774 | Carson
775 | Theron
776 | Raymundo
777 | Daren
778 | Tristan
779 | Houston
780 | Robby
781 | Lincoln
782 | Jame
783 | Genaro
784 | Gale
785 | Bennett
786 | Octavio
787 | Cornell
788 | Laverne
789 | Hung
790 | Arron
791 | Antony
792 | Herschel
793 | Alva
794 | Giovanni
795 | Garth
796 | Cyrus
797 | Cyril
798 | Ronny
799 | Stevie
800 | Lon
801 | Freeman
802 | Erin
803 | Duncan
804 | Kennith
805 | Carmine
806 | Augustine
807 | Young
808 | Erich
809 | Chadwick
810 | Wilburn
811 | Russ
812 | Reid
813 | Myles
814 | Anderson
815 | Morton
816 | Jonas
817 | Forest
818 | Mitchel
819 | Mervin
820 | Zane
821 | Rich
822 | Jamel
823 | Lazaro
824 | Alphonse
825 | Randell
826 | Major
827 | Johnie
828 | Jarrett
829 | Brooks
830 | Ariel
831 | Abdul
832 | Dusty
833 | Luciano
834 | Lindsey
835 | Tracey
836 | Seymour
837 | Scottie
838 | Eugenio
839 | Mohammed
840 | Sandy
841 | Valentin
842 | Chance
843 | Arnulfo
844 | Lucien
845 | Ferdinand
846 | Thad
847 | Ezra
848 | Sydney
849 | Aldo
850 | Rubin
851 | Royal
852 | Mitch
853 | Earle
854 | Abe
855 | Wyatt
856 | Marquis
857 | Lanny
858 | Kareem
859 | Jamar
860 | Boris
861 | Isiah
862 | Emile
863 | Elmo
864 | Aron
865 | Leopoldo
866 | Everette
867 | Josef
868 | Gail
869 | Eloy
870 | Dorian
871 | Rodrick
872 | Reinaldo
873 | Lucio
874 | Jerrod
875 | Weston
876 | Hershel
877 | Barton
878 | Parker
879 | Lemuel
880 | Lavern
881 | Burt
882 | Jules
883 | Gil
884 | Eliseo
885 | Ahmad
886 | Nigel
887 | Efren
888 | Antwan
889 | Alden
890 | Margarito
891 | Coleman
892 | Refugio
893 | Dino
894 | Osvaldo
895 | Les
896 | Deandre
897 | Normand
898 | Kieth
899 | Ivory
900 | Andrea
901 | Trey
902 | Norberto
903 | Napoleon
904 | Jerold
905 | Fritz
906 | Rosendo
907 | Milford
908 | Sang
909 | Deon
910 | Christoper
911 | Alfonzo
912 | Lyman
913 | Josiah
914 | Brant
915 | Wilton
916 | Rico
917 | Jamaal
918 | Dewitt
919 | Carol
920 | Brenton
921 | Yong
922 | Olin
923 | Foster
924 | Faustino
925 | Claudio
926 | Judson
927 | Gino
928 | Edgardo
929 | Berry
930 | Alec
931 | Tanner
932 | Jarred
933 | Donn
934 | Trinidad
935 | Tad
936 | Shirley
937 | Prince
938 | Porfirio
939 | Odis
940 | Maria
941 | Lenard
942 | Chauncey
943 | Chang
944 | Tod
945 | Mel
946 | Marcelo
947 | Kory
948 | Augustus
949 | Keven
950 | Hilario
951 | Bud
952 | Sal
953 | Rosario
954 | Orval
955 | Mauro
956 | Dannie
957 | Zachariah
958 | Olen
959 | Anibal
960 | Milo
961 | Jed
962 | Frances
963 | Thanh
964 | Dillon
965 | Amado
966 | Newton
967 | Connie
968 | Lenny
969 | Tory
970 | Richie
971 | Lupe
972 | Horacio
973 | Brice
974 | Mohamed
975 | Delmer
976 | Dario
977 | Reyes
978 | Dee
979 | Mac
980 | Jonah
981 | Jerrold
982 | Robt
983 | Hank
984 | Sung
985 | Rupert
986 | Rolland
987 | Kenton
988 | Damion
989 | Chi
990 | Antone
991 | Waldo
992 | Fredric
993 | Bradly
994 | Quinn
995 | Kip
996 | Burl
997 | Walker
998 | Tyree
999 | Jefferey
1000 | Ahmed
1001 | Willy
1002 | Stanford
1003 | Oren
1004 | Noble
1005 | Moshe
1006 | Mikel
1007 | Enoch
1008 | Brendon
1009 | Quintin
1010 | Jamison
1011 | Florencio
1012 | Darrick
1013 | Tobias
1014 | Minh
1015 | Hassan
1016 | Giuseppe
1017 | Demarcus
1018 | Cletus
1019 | Tyrell
1020 | Lyndon
1021 | Keenan
1022 | Werner
1023 | Theo
1024 | Geraldo
1025 | Lou
1026 | Columbus
1027 | Chet
1028 | Bertram
1029 | Markus
1030 | Huey
1031 | Hilton
1032 | Dwain
1033 | Donte
1034 | Tyron
1035 | Omer
1036 | Isaias
1037 | Hipolito
1038 | Fermin
1039 | Chung
1040 | Adalberto
1041 | Valentine
1042 | Jamey
1043 | Bo
1044 | Barrett
1045 | Whitney
1046 | Teodoro
1047 | Mckinley
1048 | Maximo
1049 | Garfield
1050 | Sol
1051 | Raleigh
1052 | Lawerence
1053 | Abram
1054 | Rashad
1055 | King
1056 | Emmitt
1057 | Daron
1058 | Chong
1059 | Samual
1060 | Paris
1061 | Otha
1062 | Miquel
1063 | Lacy
1064 | Eusebio
1065 | Dong
1066 | Domenic
1067 | Darron
1068 | Buster
1069 | Antonia
1070 | Wilber
1071 | Renato
1072 | Hoyt
1073 | Haywood
1074 | Ezekiel
1075 | Chas
1076 | Florentino
1077 | Elroy
1078 | Clemente
1079 | Arden
1080 | Neville
1081 | Kelley
1082 | Edison
1083 | Deshawn
1084 | Carrol
1085 | Shayne
1086 | Nathanial
1087 | Jordon
1088 | Danilo
1089 | Claud
1090 | Val
1091 | Sherwood
1092 | Raymon
1093 | Rayford
1094 | Cristobal
1095 | Ambrose
1096 | Titus
1097 | Hyman
1098 | Felton
1099 | Ezequiel
1100 | Erasmo
1101 | Stanton
1102 | Lonny
1103 | Len
1104 | Ike
1105 | Milan
1106 | Lino
1107 | Jarod
1108 | Herb
1109 | Andreas
1110 | Walton
1111 | Rhett
1112 | Palmer
1113 | Jude
1114 | Douglass
1115 | Cordell
1116 | Oswaldo
1117 | Ellsworth
1118 | Virgilio
1119 | Toney
1120 | Nathanael
1121 | Del
1122 | Britt
1123 | Benedict
1124 | Mose
1125 | Hong
1126 | Leigh
1127 | Johnson
1128 | Isreal
1129 | Gayle
1130 | Garret
1131 | Fausto
1132 | Asa
1133 | Arlen
1134 | Zack
1135 | Warner
1136 | Modesto
1137 | Francesco
1138 | Manual
1139 | Jae
1140 | Gaylord
1141 | Gaston
1142 | Filiberto
1143 | Deangelo
1144 | Michale
1145 | Granville
1146 | Wes
1147 | Malik
1148 | Zackary
1149 | Tuan
1150 | Nicky
1151 | Eldridge
1152 | Cristopher
1153 | Cortez
1154 | Antione
1155 | Malcom
1156 | Long
1157 | Korey
1158 | Jospeh
1159 | Colton
1160 | Waylon
1161 | Von
1162 | Hosea
1163 | Shad
1164 | Santo
1165 | Rudolf
1166 | Rolf
1167 | Rey
1168 | Renaldo
1169 | Marcellus
1170 | Lucius
1171 | Lesley
1172 | Kristofer
1173 | Boyce
1174 | Benton
1175 | Man
1176 | Kasey
1177 | Jewell
1178 | Hayden
1179 | Harland
1180 | Arnoldo
1181 | Rueben
1182 | Leandro
1183 | Kraig
1184 | Jerrell
1185 | Jeromy
1186 | Hobert
1187 | Cedrick
1188 | Arlie
1189 | Winford
1190 | Wally
1191 | Patricia
1192 | Luigi
1193 | Keneth
1194 | Jacinto
1195 | Graig
1196 | Franklyn
1197 | Edmundo
1198 | Sid
1199 | Porter
1200 | Leif
1201 | Lauren
1202 | Jeramy
1203 | Elisha
1204 | Buck
1205 | Willian
1206 | Vincenzo
1207 | Shon
1208 | Michal
1209 | Lynwood
1210 | Lindsay
1211 | Jewel
1212 | Jere
1213 | Hai
1214 | Elden
1215 | Dorsey
1216 | Darell
1217 | Broderick
1218 | Alonso
1219 |
--------------------------------------------------------------------------------
/src/any.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: any.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: collecting arbitrary elements
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | ;;; WARNING: any works only on finite sequences!
14 | (defmethod any ((series series::foundation-series))
15 | (let ((len (collect-length series)))
16 | (if (< len 1)
17 | nil
18 | (collect-nth (random len)
19 | series))))
20 |
21 | (defmethod any ((sequence sequence))
22 | (let ((len (length sequence)))
23 | (if (< len 1)
24 | nil
25 | (elt sequence
26 | (random len)))))
27 |
--------------------------------------------------------------------------------
/src/character.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: character.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: commonly-used character sets
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defparameter +whitespace-characters+
14 | '(#\space #\tab #\return #\newline #\vt #\formfeed))
15 |
16 | (defparameter +line-break-characters+
17 | '(#\return #\newline #\formfeed))
18 |
--------------------------------------------------------------------------------
/src/contains.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: contains.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: searching for elements
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | ;;; WARNING: contains? works only on finite series
14 | (defmethod contains? ((series series::foundation-series) val &key (test #'eql))
15 | (block searching
16 | (iterate ((it series))
17 | (when (funcall test val it)
18 | (return-from searching t)))
19 | nil))
20 |
21 | (defmethod contains? ((sequence sequence) val &key (test #'eql))
22 | (find val sequence :test test))
23 |
24 |
--------------------------------------------------------------------------------
/src/drop.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: drop.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: removing finite prefixes from series
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defmethod drop ((n integer)(series series::foundation-series))
14 | (subseries series n))
15 |
16 | (defmethod drop ((n integer)(sequence sequence))
17 | (subseq sequence n))
18 |
19 |
--------------------------------------------------------------------------------
/src/file.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: file.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: tapping files
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defmethod tap ((type (eql :bytes))(source pathname) &key &allow-other-keys)
14 | (with-open-file (in source :direction :input
15 | :element-type '(unsigned-byte 8))
16 | (tap :bytes in)))
17 |
18 | (defmethod tap ((type (eql :characters))(source pathname) &key &allow-other-keys)
19 | (with-open-file (in source :direction :input
20 | :element-type 'character)
21 | (tap :characters in)))
22 |
23 | (defmethod tap ((type (eql :words))(source pathname)
24 | &key (word-break-characters +whitespace-characters+)
25 | &allow-other-keys)
26 | (with-open-file (in source :direction :input
27 | :element-type 'character)
28 | (tap :words in)))
29 |
30 | (defmethod tap ((type (eql :lines))(source pathname)
31 | &key (line-break-characters +line-break-characters+)
32 | &allow-other-keys)
33 | (with-open-file (in source :direction :input
34 | :element-type 'character)
35 | (tap :lines in)))
36 |
37 | (defmethod tap ((type (eql :objects))(source pathname)
38 | &key &allow-other-keys)
39 | (with-open-file (in source :direction :input
40 | :element-type 'character)
41 | (tap :objects in)))
42 |
43 | ;;; (tap :bytes (pathname "/Users/mikel/.emacs"))
44 | ;;; (tap :characters (pathname "/Users/mikel/.emacs"))
45 | ;;; (tap :words (pathname "/Users/mikel/.emacs"))
46 | ;;; (tap :lines (pathname "/Users/mikel/.emacs"))
47 | ;;; (tap :objects (pathname "/Users/mikel/.emacs"))
48 |
--------------------------------------------------------------------------------
/src/filter.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: filter.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: collecting elements by predicate
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defmethod filter (fn (series series::foundation-series))
14 | (let ((flags (tap-fn fn series)))
15 | (choose flags series)))
16 |
17 | (defmethod filter (fn (sequence sequence))
18 | (remove-if-not fn sequence))
19 |
--------------------------------------------------------------------------------
/src/hash.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: hash.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: tapping strings
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defmethod tap ((type (eql :hash-entries))(source hash-table) &key &allow-other-keys)
14 | (scan-hash source))
15 |
16 | (defmethod tap ((type (eql :keys))(source hash-table) &key &allow-other-keys)
17 | (multiple-value-bind (keys vals)(scan-hash source)
18 | keys))
19 |
20 | (defmethod tap ((type (eql :values))(source hash-table) &key &allow-other-keys)
21 | (multiple-value-bind (keys vals)(scan-hash source)
22 | vals))
23 |
24 | ;;; (defparameter $tbl (make-hash-table))
25 | ;;; (setf (gethash :fred $tbl) '(:name "Fred" :color :orange :age 35))
26 | ;;; (setf (gethash :wilma $tbl) '(:name "Wilma" :color :white :age 35))
27 | ;;; (setf (gethash :barney $tbl) '(:name "Barney" :color :brown :age 34))
28 | ;;; (setf (gethash :betty $tbl) '(:name "Betty" :color :blue :age 34))
29 | ;;; (tap :hash-entries $tbl)
30 | ;;; (tap :keys $tbl)
31 | ;;; (tap :values $tbl)
32 |
--------------------------------------------------------------------------------
/src/leave.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: drop.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: removing finite prefixes from series
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | ;;; WARNING: leave works only with finite seres!
14 | (defmethod leave ((n integer)(series series::foundation-series))
15 | (let ((len (collect-length series)))
16 | (subseries series (- len n))))
17 |
18 | (defmethod leave ((n integer)(sequence sequence))
19 | (let ((len (length sequence)))
20 | (subseq sequence (- len n))))
21 |
22 |
--------------------------------------------------------------------------------
/src/package.lisp:
--------------------------------------------------------------------------------
1 | ;;;; package.lisp
2 |
3 | (defpackage #:taps
4 | (:use #:cl #:series)
5 | (:export
6 | #:+line-break-characters+
7 | #:+whitespace-characters+
8 | #:drop
9 | #:filter
10 | #:take
11 | #:take-by
12 | #:take-m-by-n
13 | #:take-until
14 | #:tap
15 | #:tap-fn
16 | #:tap-integers
17 | #:tap-random-integers
18 | ))
19 |
20 |
--------------------------------------------------------------------------------
/src/stream.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: stream.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: tapping streams
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defmethod tap ((type (eql :bytes))(source stream) &key &allow-other-keys)
14 | (scan-stream source #'read-byte))
15 |
16 | (defmethod tap ((type (eql :characters))(source stream) &key &allow-other-keys)
17 | (scan-stream source #'read-char))
18 |
19 | (defmethod tap ((type (eql :words))(source stream)
20 | &key (word-break-characters +whitespace-characters+)
21 | &allow-other-keys)
22 | (let* ((chars (scan-stream source #'read-char))
23 | (break-flags (map-fn t (lambda (ch)
24 | (member ch word-break-characters))
25 | chars))
26 | (break-positions (positions break-flags))
27 | (break-positions0 (catenate (scan '(-1))
28 | break-positions))
29 | (break-positions1 (catenate break-positions
30 | (scan '(nil))))
31 | (chunks (map-fn t (lambda (x y)
32 | (if y
33 | (subseries chars (1+ x) y)
34 | (subseries chars (1+ x))))
35 | break-positions0
36 | break-positions1)))
37 | (map-fn t (lambda (s)(collect 'string s))
38 | chunks)))
39 |
40 | (defmethod tap ((type (eql :lines))(source stream)
41 | &key (line-break-characters +line-break-characters+)
42 | &allow-other-keys)
43 | (scan-stream source #'read-line))
44 |
45 | (defmethod tap ((type (eql :objects))(source stream)
46 | &key &allow-other-keys)
47 | (scan-stream source #'read))
48 |
49 |
50 | #|
51 | (with-input-from-string (in "Hello there, world")
52 | (tap :characters in))
53 | (with-input-from-string (in "Hello there, world")
54 | (tap :words in))
55 | (with-input-from-string (in "0 1.0 \"Two\" :three (4 5)")
56 | (tap :objects in))
57 |
58 | (with-open-file (in "/Users/mikel/.emacs" :element-type '(unsigned-byte 8))
59 | (tap :bytes in))
60 | (with-open-file (in "/Users/mikel/.emacs")
61 | (tap :characters in))
62 | (with-open-file (in "/Users/mikel/.emacs")
63 | (tap :words in))
64 | (with-open-file (in "/Users/mikel/.emacs")
65 | (tap :lines in))
66 | |#
67 |
--------------------------------------------------------------------------------
/src/string.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: string.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: tapping strings
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defmethod tap ((type (eql :characters))(source string) &key &allow-other-keys)
14 | (scan source))
15 |
16 | (defmethod tap ((type (eql :words))(source string)
17 | &key (word-break-characters +whitespace-characters+)
18 | &allow-other-keys)
19 | (with-input-from-string (in source)
20 | (tap :words in)))
21 |
22 | (defmethod tap ((type (eql :lines))(source string)
23 | &key (line-break-characters +line-break-characters+)
24 | &allow-other-keys)
25 | (with-input-from-string (in source)
26 | (tap :lines in)))
27 |
28 |
29 | (defmethod tap ((type (eql :objects))(source string)
30 | &key &allow-other-keys)
31 | (with-input-from-string (in source)
32 | (tap :objects in)))
33 |
34 | ;;; (tap :characters "This is a string to use for testing")
35 | ;;; (tap :words "This is a string to use for testing")
36 | ;;; (tap :lines (format nil "~%This is a string ~%to use for testing"))
37 | ;;; (tap :objects "0 1.0 \"Two\" :three (4 5)")
38 |
--------------------------------------------------------------------------------
/src/tails.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: tails.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: generating the tails of series and sequences
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defmethod tails ((sequence sequence))
14 | (let ((len (length sequence)))
15 | (loop for i from 0 below len
16 | collect (subseq sequence i))))
17 |
18 | (defmethod tails ((series series::foundation-series))
19 | (let ((indexes (take-until #'null (positions series))))
20 | (map-fn t (lambda (i)(subseries series i))
21 | indexes)))
22 |
23 | (defmethod tails-by ((n integer)(sequence sequence))
24 | (let ((len (length sequence)))
25 | (loop for i from 0 below len by n
26 | collect (subseq sequence i))))
27 |
28 | (defmethod tails-by ((n integer)(series series::foundation-series))
29 | (let ((indexes (tap-integers :by n)))
30 | (map-fn t (lambda (i)(subseries series i))
31 | indexes)))
32 |
--------------------------------------------------------------------------------
/src/take.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: take.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: collecting subsets of taps
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defmethod take ((n integer)(series series::foundation-series))
14 | (subseries series 0 n))
15 |
16 | (defmethod take ((n integer)(sequence sequence))
17 | (subseq sequence 0 n))
18 |
19 | (defmethod take-until (fn (series series::foundation-series))
20 | (let ((flags (tap-fn fn series)))
21 | (until flags series)))
22 |
23 | (defmethod take-until (fn (sequence sequence))
24 | (let ((end (position-if fn sequence)))
25 | (if end
26 | (subseq sequence 0 end)
27 | sequence)))
28 |
29 | (defmethod take-by ((n integer)(series series::foundation-series))
30 | (let* ((starts (scan-range :by n)))
31 | (map-fn t
32 | (lambda (x)(subseries series x (+ x n)))
33 | starts)))
34 |
35 | (defmethod take-by ((n integer)(sequence sequence))
36 | (let ((len (length sequence)))
37 | (loop
38 | for start from 0 by n
39 | for end = (+ start n) then (+ start n)
40 | until (>= start len)
41 | collect (if (>= end len)
42 | (subseq sequence start)
43 | (subseq sequence start end)))))
44 |
45 | (defmethod take-m-by-n ((m integer)(n integer)(series series::foundation-series))
46 | (let* ((starts (scan-range :by n)))
47 | (map-fn t
48 | (lambda (x)(subseries series x (+ x m)))
49 | starts)))
50 |
51 | (defmethod take-m-by-n ((m integer)(n integer)(sequence sequence))
52 | (let ((len (length sequence)))
53 | (loop
54 | for start from 0 by n
55 | for end = (+ start m) then (+ start m)
56 | until (>= start len)
57 | collect (if (>= end len)
58 | (subseq sequence start)
59 | (subseq sequence start end)))))
60 |
61 |
--------------------------------------------------------------------------------
/src/tap.lisp:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: tap.lisp
4 | ;;;; Project: taps
5 | ;;;; Purpose: creating series
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:taps)
12 |
13 | (defgeneric tap (element-type source &key &allow-other-keys))
14 |
15 | (defun tap-integers (&key (from 0)(by 1) upto below downto above)
16 | (scan-range :type 'integer
17 | :from from
18 | :by by
19 | :upto upto
20 | :below below
21 | :downto downto
22 | :above above))
23 |
24 | (defun tap-random-integers (below &optional (random-state *random-state*))
25 | (let ((iota (scan-range :from 0 :by 1)))
26 | (map-fn t (lambda (i)(random below random-state))
27 | iota)))
28 |
29 | (defun tap-fn (fn series)
30 | (map-fn t fn series))
31 |
32 |
--------------------------------------------------------------------------------
/taps.asd:
--------------------------------------------------------------------------------
1 | ;;;; ***********************************************************************
2 | ;;;;
3 | ;;;; Name: taps.asd
4 | ;;;; Project: taps
5 | ;;;; Purpose: the system definitions for the taps system
6 | ;;;; Author: mikel evins
7 | ;;;; Copyright: 2015 by mikel evins
8 | ;;;;
9 | ;;;; ***********************************************************************
10 |
11 | (in-package #:cl-user)
12 |
13 | (asdf:defsystem #:taps
14 | :description "A library of conveniences for using series"
15 | :author "mikel evins "
16 | :license "Apache 2.0"
17 | :serial t
18 | :depends-on (:series :split-sequence :closer-mop)
19 | :components ((:module "src"
20 | :serial t
21 | :components ((:file "package")
22 | (:file "drop")
23 | (:file "filter")
24 | (:file "any")
25 | (:file "contains")
26 | (:file "take")
27 | (:file "leave")
28 | (:file "tap")
29 | (:file "character")
30 | (:file "stream")
31 | (:file "file")
32 | (:file "string")
33 | (:file "hash")))))
34 |
35 | ;;; (asdf:load-system :taps)
36 |
--------------------------------------------------------------------------------