diff options
-rw-r--r-- | README.md | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -106,7 +106,7 @@ example apears at the end of the document, following the tutorial. (mapcar #'seq (chunk n str)))))) -> (scramble 3 "this will be scrabled, ya dig?") +> (scramble 3 "this will be scrambled, ya dig?") "tsi rbdyd?h lbsal,ai iwlecme g " @@ -232,7 +232,7 @@ The three core transformation functions are: - `(map! fn gen &rest gens)` makes a new generator by mapping `fn` over other generators - `(filter! pred gen)` makes a new generator by discarding values that dont satisfy `pred` -- `(inflate! fn gen)` The function `fn` should make new generators using the values produced by the generator `gen`. The `inflate!` function combines all those "intermediate" generators into a single generator. +- `(inflate! fn gen)` The function `fn` should make new generators using the values produced by the generator `gen`. The `inflate!` function combines all those "intermediate" generators into a single generator. Admittedly, the behavior of `inflate!` is difficult to grok by reading a description. Once you begin to use it, however, it becomes indispensible. @@ -281,7 +281,7 @@ Here are some simple examples of their use: - `(indexed! gen)` is shorthand for `(zip! (range) gen)` - `(concat! gen &rest gens)` concatenates generators - `(skip! n gen)` produces a generator by skipping the first `n` values in `gen` -- `(skip-while! pred gen)` produces a generator by skippng elements of `gen` while `pred` is `t` +- `(skip-while! pred gen)` produces a generator by skipping elements of `gen` while `pred` is `t` - `(merge! comp gen1 gen2 &rest gens)` emulates the behavior of `merge` but for generators - `(truncate! n gen)` produces at most `n` of the values produced by `gen` - `(inject! fn gen)` shorthand for `(map! (lambda (x) (funcall fn x) x) gen)` @@ -320,7 +320,7 @@ will be signalled. _The general rule_ is: if you pass a generator to more than one combining function (those whose names end in `!`), or if you pass the -same generator to one such a function at two argument positions, then +same generator to one such function at two argument positions, then an error will be raised and new the generator will not be built. Internally, the library keeps track of whether or not generators have @@ -414,7 +414,7 @@ suitable for use in the binding form of a `DESTRUCTURING-BIND`, like On each iteration, the variables in the binding form are bound to successive values generated by the generator form. Notice that you do not need to inline your generator form, you can build it up and pass -it in as in the thrid example above. +it in as in the third example above. Finally, the body is evaluated for each iteration. @@ -546,7 +546,7 @@ Generators are subclasses of `gtwiwtg::generator!` that have at least two methods specialized on them: - `(gtwiwtg::next gen)` : advances the generator and gets its next value -- `(gtwiwtg::nas-next-p gen)` : checks whether or not the generator has a next value +- `(gtwiwtg::has-next-p gen)` : checks whether or not the generator has a next value Additionally, if your generator needs to perform cleanup after it is consumed, you can implement the `:after` method combination for the method @@ -589,7 +589,7 @@ A silly example: You can see that `next` ASSUMES that there is a next value. This is one of the reasons you are not ment to call `next` manually. The -`for` consumer automatcially checks that there is a next value before +`for` consumer automatically checks that there is a next value before trying to get it. ## The Permutations Example @@ -624,7 +624,7 @@ permutation generators for the subvectors of `vec` in a classic divide-and-conquer way, and then use `inflate!` to combine those "generated sub-generators" into a single generator, which we return. -The above code is made signifiantly noisier by the use of displaced +The above code is made significantly noisier by the use of displaced arrays. Displaced arrays let us share memory with the original vector. For each "sub permutation", we create a new generator using a |