[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Partition for Emacs Lisp
From: |
Andreas Röhler |
Subject: |
Re: Partition for Emacs Lisp |
Date: |
Mon, 29 Jun 2009 10:56:06 +0200 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081227) |
Vassil Nikolov wrote:
>> On Jun 28, 6:26 am, Marc Tfardy <b...@cyk.cyk> wrote:
>>
>>> ...
>>> (partition '(a b c d e f) 2)
>>>
>>> should return:
>>> ((a b) (c d) (e f))
>>>
>>> Is there something ready out from the box?
>>>
>
> (Define "out from the box"...)
>
> (when (and (fboundp 'featurep) (featurep 'emacs)) ;seen in comp.lang.lisp
> (require 'cl))
>
> (defun partition (l n) ;"demo" grade, cursorily tested
> "Return a list of L's consecutive sublists of length N."
> (assert (zerop (mod (length l) n)))
> (loop for l on l by #'(lambda (l) (nthcdr n l)) collect (subseq l 0 n)))
>
> (partition '(a b c d e f) 2)
> => ((a b) (c d) (e f))
>
> ---Vassil.
>
>
>
Hi,
I'm wondering for some time how to preserve all this
interesting snippets of code conveniently.
Thanks all participants BTW.
Digging the mail archive user by user seems not the
best method, so I tried to extract some matter.
Please have a look at
http://repo.or.cz/w/elbb.git?a=blob;f=code/help-gnu-emacs.el
Emacs Lisp Bill Board still isn't in the shape
qualifying for Βeta, principle should be visible
nonetheless.
Comments welcome.
Thanks again
Andreas Röhler