From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Egli Subject: [PATCH 1/3] Replace recursive implementation with an iterative one Date: Mon, 21 Mar 2011 16:11:06 +0100 Message-ID: <1300720268-9375-2-git-send-email-christian.egli@alumni.ethz.ch> References: <1300720268-9375-1-git-send-email-christian.egli@alumni.ethz.ch> Return-path: Received: from [140.186.70.92] (port=39875 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1gn5-0003WN-P1 for emacs-orgmode@gnu.org; Mon, 21 Mar 2011 11:13:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1gn3-0002Uq-Hl for emacs-orgmode@gnu.org; Mon, 21 Mar 2011 11:13:07 -0400 Received: from mail.sbszh.ch ([217.162.18.84]:37234) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1gn3-00029z-BD for emacs-orgmode@gnu.org; Mon, 21 Mar 2011 11:13:05 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.sbszh.ch (Postfix) with ESMTP id AEE9886D0 for ; Mon, 21 Mar 2011 16:11:16 +0100 (CET) Received: from mail.sbszh.ch ([127.0.0.1]) by localhost (mail01.dmz.sbszh.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BNodoqIZhPoR for ; Mon, 21 Mar 2011 16:11:13 +0100 (CET) Received: from s05.sbszh.ch (s05.sbszh.ch [10.0.9.9]) by mail.sbszh.ch (Postfix) with ESMTP id 33CF986E8 for ; Mon, 21 Mar 2011 16:11:13 +0100 (CET) In-Reply-To: <1300720268-9375-1-git-send-email-christian.egli@alumni.ethz.ch> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Christian Egli From: Christian Egli * 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) -- 1.7.1