This is how I did it where the argument to the canned/passed in function is
supplied as a symbol...
(de x2 (Num) (setq Res (* Num 2)))
(de fnfn (Canned_fn)
#(setq X (car (cdr Canned_fn))) ((car Canned_fn) (eval X)))
#replaced by single stage...
((car Canned_fn) (eval (car (cdr Canned_fn)))))
(setq Some_num 4)
(prinl (fnfn '(x2 Some_num))) #->8
Hope this is ok
On 20 January 2017 at 19:20, dean <deangwillia...@gmail.com> wrote:
> Thank you Alex...that's great.
> I just came back to say that the above worked well for both strings and
> numbers entered directly as the passed functions argument but not (it seems
> :) ) for when the argument is supplied in a symbol. eval might well cope
> with that and if not...I'll work on it.
> Note, btw, that (car (cdr X)) can be simplified to (cadr X)
> I thought that initially too but as you can see here (cdr Canned_fn) gives
> a problem
> whereas (car (cdr Canned_fn)) removes the parens that get put around Num.
> I don't need the car for a string argument in another example so...
> there could well be something wrong with this example
> (de x2 (Num) (setq Res (* Num 2)))
> (de fnfn (Canned_fn) (wait 1000)
> ((car Canned_fn) (cdr Canned_fn))) #calling a canned fn passed as arg
> (prinl (x2 3)) #testing straight fn call -> 6
> (prinl (fnfn '(x2 4))) #calling x2 as canned fn->8
> Best Regards
> On 20 January 2017 at 18:55, Alexander Burger <a...@software-lab.de> wrote:
>> On Fri, Jan 20, 2017 at 06:26:14PM +0000, dean wrote:
>> > I seem to be able to do this by....
>> > (de some_fn (Canned_fn_and_arg......
>> > and then executing the Canned_fn_and_arg inside some_fn by doing....
>> > ((car Canned_fn) (car (cdr Canned_fn)))
>> > Is this the right way or is there a slicker one?
>> It depends on how 'Canned_fn_and_arg' looks like.
>> I suspect that instead of
>> ((car Canned_fn) (car (cdr Canned_fn)))
>> you could just call
>> (eval Canned_fn)
>> ♪♫ Alex
>> Note, btw, that (car (cdr X)) can be simplified to (cadr X)
>> UNSUBSCRIBE: mailto:firstname.lastname@example.org?subject=Unsubscribe