From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Prince Subject: Re: Elisp programming style Date: Fri, 28 Oct 2011 13:43:14 -0400 Message-ID: <8739edf1vx.fsf@hermes.hocat.ca> References: <86obx2gvmd.fsf@googlemail.com> <8762j94dz0.fsf@gmail.com> <86obx1qkcc.fsf@googlemail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:39408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJqSj-0001lY-Cb for emacs-orgmode@gnu.org; Fri, 28 Oct 2011 13:43:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJqSi-0000Zm-9J for emacs-orgmode@gnu.org; Fri, 28 Oct 2011 13:43:25 -0400 Received: from socrates.hocat.ca ([76.10.188.53]:55830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJqSi-0000Za-0u for emacs-orgmode@gnu.org; Fri, 28 Oct 2011 13:43:24 -0400 In-Reply-To: <86obx1qkcc.fsf@googlemail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Thorsten , emacs-orgmode@gnu.org Perhaps ,----------------------------------------------------------- | (defun main-function (args) | (let ((var (assoc :key1 args))) ; extracting var once | ... | (helper-function1 ... var ...) ; inside let using var | (helper-function2 ... var ...) ; inside let using var | )) | | (defun helper-function1 (var') | ... | ) | | (defun helper-function2 (var') | ... | ) `----------------------------------------------------------- or ,------------------------------------------------------------- | (defun get-key1 (args) (assoc :key1 args)) | (defun main-function (args) | (let ((value (get-key1 args)) ; extracting var 1st time | ... | ) | (helper-function1 ...) ; outside let | (helper-function2 ...) ; outside let | ) | | (defun helper-function1 (args) | (let ((value (get-key1 args)) ; extracting var 2nd time | ... | )) | | (defun helper-function2 (args) | (let ((value (get-key1 args)) ; extracting var 3rd time | ... | )) `------------------------------------------------------------- I likely wouldn't suggest the second, unless get-key1 was actually something more complicated than your example. Tom