[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: How to temporarily alter function definition
From: |
Drew Adams |
Subject: |
RE: How to temporarily alter function definition |
Date: |
Sun, 21 Feb 2010 11:33:33 -0800 |
> (let* ((condition t)
> (f (if condition f-new f)))
> (f 1 2))
Change (if condition f-new f) to (if condition 'f-new 'f).
Change (f 1 2) to (funcall f 1 2).
I would also bind a different variable from `f' in the let, just for clarity.
IOW:
(let ((ff (if condition 'f-new 'f)))
(funcall ff 1 2))
The value of `ff' is a symbol, either `f-new' or `f'. `funcall' applies the
`symbol-function' of that symbol to the args 1 and 2.