help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invoking a function from a list of functions


From: Marcin Borkowski
Subject: Re: Invoking a function from a list of functions
Date: Fri, 09 Nov 2018 11:30:25 +0100
User-agent: mu4e 1.1.0; emacs 27.0.50

On 2018-11-09, at 07:03, Tim Johnson <tim@akwebsoft.com> wrote:

> * Eric Abrahamsen <eric@ericabrahamsen.net> [181108 16:28]:
>> Tim Johnson <tim@akwebsoft.com> writes:
>> 
>> > Given a list of functions:
>> > (setq funcs '(scroll-up-line scroll-down-line))
>> >
>> > And assuming that these functions have a similar argument list, 
>> > I can invoke a function as:
>> >
>> > (funcall (nth 1 funcs))
>> > ;; or optionally 
>> > (funcall (nth 1 funcs) 2)
>> >
>> > That approach is sufficient for my needs at the moment, an example
>> > of which might be to cycle through color themes invoked by my own
>> > functions.
>> >
>> > However, in the quest for futher edification I'd welcome URLs to
>> > documentation or discussion, as well as any contributions other
>> > emacsen might choose to make. Keywords also.
>> >
>> > I had a heck of a time getting relevant responses from google. I
>> > actually don't know what keywords to search with. 
>> 
>> It isn't clear to me, at least, what else you might be trying to achieve
>> here. Is it more accurately selecting a function from within a list,
>> using a keyword? Or cycling through functions in a list?
>> 
>> You'll have a heck of a time getting relevant responses on this list,
>> too, unless you tell us what you're after! :)
>   Thanks for the reply Eric: As I demonstrated on my code examples,
>   I know how to extract a function from a list and invoke it.
>
>   ... So that's done. Now, iterating thru a list of functions that
>   might invoke a particular color theme is an example of such an
>   application and I think I grok that.
>
>   What I am interested in is further discussion whether it be from
>   replies to this topic or more general topics in this area. I'm
>   restating that I've had a difficult time finding results from
>   google. 
>
>     --------------------------------------------------------
>     That is probably because I don't know the right keywords
>     or domain-specific terms to use
>     --------------------------------------------------------
>
>   This isn't just difficult for emacs/elisp, I've found it difficult
>   for python functions invoked from lists or dictionaries. (altho
>   I've employed such methods for years in python)
>
>   So I'm sorry to be so unclear: let me restate the nut and kernel
>   of my question: 
>
>   If I wished to further research this topic using a search engine
>   what are the keywords that I might feed to google?
>
>   I hope that you now understand what I'm after.

Just guessing:

first-class functions/closures?
functions as data?
dynamic function calling?

Hth,

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]