[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Elisp programming style
From: |
Tom Prince |
Subject: |
Re: [O] Elisp programming style |
Date: |
Fri, 28 Oct 2011 13:43:14 -0400 |
User-agent: |
Notmuch/0.9 (http://notmuchmail.org) Emacs/23.3.3 (x86_64-pc-linux-gnu) |
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