[alexandria-devel] flatten depth param

Robert Smith quad at symbo1ics.com
Sat Feb 23 10:02:21 UTC 2013


I apologize all, I stupidly didn't realize that there was a patch
already written.

Well, it can't hurt to have another implementation to compare with, right? :)

Cheers,

Robert

On Sat, Feb 23, 2013 at 1:57 AM, Robert Smith <quad at symbo1ics.com> wrote:
> Hello:
>
> I've created a patch for this. The only difference is that instead of
> flattening to a particular depth, it flattens by a particular number
> of levels. I thought this was more in the spirit of FLATTEN. If we
> want to flatten to a particular depth, it is a trivial computation.
>
> I've attached a patch for the function, as well as tests.
>
> Cheers,
>
> Robert Smith
>
> On Sat, Jan 26, 2013 at 6:12 AM, Nikodemus Siivola
> <nikodemus at random-state.net> wrote:
>> On 16 January 2013 06:29, Garrett Kolpin <gkolpin at gmail.com> wrote:
>>> Hi,
>>>
>>> I've found it useful to be able to specify a depth when flattening a list
>>> structure. The attached patch adds a :to-depth keyword parameter to the
>>> flatten function. For instance,
>>>
>>> (flatten '((a b) (c (d)) :to-depth 1) => (a b c (d))
>>>
>>> Is this something that could be added?
>>
>> Possibly. Please explain it in the docstring and send the patch as
>> generated by git format-patch.
>>
>> Cheers,
>>
>>  -- Nikodemus
>>
>> _______________________________________________
>> alexandria-devel mailing list
>> alexandria-devel at common-lisp.net
>> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/alexandria-devel




More information about the alexandria-devel mailing list