[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Elisp programming style
From: |
Thorsten |
Subject: |
Re: [O] Elisp programming style |
Date: |
Fri, 28 Oct 2011 20:05:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Tom Prince <address@hidden> writes:
> 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.
hmm ... I feel quite convinced now that having a standalone function is
worth a bit of code duplication, and I start do discover that the cl
package does have some nice functions (like flet).
cheers
--
Thorsten
- Re: [O] Elisp programming style, (continued)
- Re: [O] Elisp programming style, Thorsten, 2011/10/28
- Re: [O] Elisp programming style, Nick Dokos, 2011/10/28
- Re: [O] Elisp programming style, Thorsten, 2011/10/28
- Re: [O] Elisp programming style, Eric Abrahamsen, 2011/10/28
- Re: [O] Elisp programming style, Tassilo Horn, 2011/10/28
- Re: [O] Elisp programming style, Eric Schulte, 2011/10/28
- Re: [O] Elisp programming style, Thorsten, 2011/10/28
- Re: [O] Elisp programming style, Eric Schulte, 2011/10/28
- Re: [O] Elisp programming style, Thorsten, 2011/10/28
- Re: [O] Elisp programming style, Tom Prince, 2011/10/28
- Re: [O] Elisp programming style,
Thorsten <=
- Re: [O] Elisp programming style, Tassilo Horn, 2011/10/29