[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New version of todo-mode.el (announcement + user guide)

From: Wolfgang Jenkner
Subject: Re: New version of todo-mode.el (announcement + user guide)
Date: Wed, 12 Jun 2013 20:30:45 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

On Tue, Jun 11 2013, Stephen Berman wrote:

> - The code makes use of a powerset function, which Emacs doesn't have.
>   I tried but couldn't come up with my own algorithm but found a
>   recursive Common Lisp implementation and an iterative one in C

The straightforward recursive implementation can be rewritten as an
iterative one by conceptually doing left- instead of right-folding.

(defun my-powerset (list)
  "Return the powerset of LIST."
  (let ((powerset (list nil)))
    (dolist (elt list (mapcar 'reverse powerset))
      (nconc powerset (mapcar (apply-partially 'cons elt) powerset)))))

Here are some other (more or less serious) variations on the theme:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]