[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [Accepted] [O, 1/3] Replace recursive implementation with an iterati
From: |
Bastien Guerry |
Subject: |
[O] [Accepted] [O, 1/3] Replace recursive implementation with an iterative one |
Date: |
Tue, 22 Mar 2011 10:44:55 +0100 (CET) |
Patch 707 (http://patchwork.newartisans.com/patch/707/) is now "Accepted".
Maintainer comment: none
This relates to the following submission:
http://mid.gmane.org/%3C1300720268-9375-2-git-send-email-christian.egli%40alumni.ethz.ch%3E
Here is the original message containing the patch:
> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O,1/3] Replace recursive implementation with an iterative one
> Date: Mon, 21 Mar 2011 20:11:06 -0000
> From: Christian Egli <address@hidden>
> X-Patchwork-Id: 707
> Message-Id: <address@hidden>
> To: address@hidden
> Cc: Christian Egli <address@hidden>
>
> From: Christian Egli <address@hidden>
>
> * org-taskjuggler.el (org-taskjuggler-assign-resource-ids): Replace
> recursive implementation with an iterative one.
>
> That way we can avoid to have ask users to increase
> `max-lisp-eval-depth'.
>
> ---
> lisp/org-taskjuggler.el | 16 +++++++---------
> 1 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
> index 9c88f5d..279f46d 100644
> --- a/lisp/org-taskjuggler.el
> +++ b/lisp/org-taskjuggler.el
> @@ -418,15 +418,13 @@ deeper), then it's not a leaf."
> (defun org-taskjuggler-assign-resource-ids (resources)
> "Given a list of resources return the same list, assigning a
> unique id to each resource."
> - (cond
> - ((null resources) nil)
> - (t
> - (let* ((resource (car resources))
> - (unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
> - (push (cons "unique-id" unique-id) resource)
> - (cons resource
> - (org-taskjuggler-assign-resource-ids (cdr resources)
> - (cons unique-id
> unique-ids)))))))
> + (let (unique-ids new-list)
> + (dolist (resource resources new-list)
> + (let ((unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
> + (push (cons "unique-id" unique-id) resource)
> + (push unique-id unique-ids)
> + (push resource new-list)))
> + (nreverse new-list)))
>
> (defun org-taskjuggler-resolve-dependencies (tasks)
> (let ((previous-level 0)
>