[alexandria-devel] flatten depth param

Robert Smith quad at symbo1ics.com
Sat Feb 23 09:57:21 UTC 2013


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flatten-depth.diff
Type: application/octet-stream
Size: 2368 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/alexandria-devel/attachments/20130223/18a0cc7b/attachment.obj>


More information about the alexandria-devel mailing list