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

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

Re: apply function


From: Karan Ahlawat
Subject: Re: apply function
Date: Mon, 7 Aug 2023 11:42:09 +0530
User-agent: Mozilla Thunderbird

On 07/08/23 11:15, Heime wrote:

I have seem code that calls a function in the following way

   (apply 'nemboss-estring (pp-to-string object) bfname))

than the usual

   (emboss-estring (pp-to-string object) bfname)

What might be the reasons for doing so ?

The most common use case I've seen for this is that apply can take in a list as the arguments to the function, where a list would not work, and then spread the elements of the list as individual arguments. So

    (+ (list 1 2 3))

doesn't work, but doing

    (apply #'+ (list 1 2 3)) ; outputs 6

does work, since it essentially reduces it to (+ 1 2 3)


reply via email to

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