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

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

RE: [External] : Re: Keywords as function arguments for control flow


From: Heime
Subject: RE: [External] : Re: Keywords as function arguments for control flow
Date: Fri, 29 Nov 2024 21:26:08 +0000

On Saturday, November 30th, 2024 at 9:06 AM, Drew Adams <drew.adams@oracle.com> 
wrote:

> > Your example uses symbols not keywords.

Correct.  But because there was the suggestion of keywords, I thought
of looking into them as well.  It seems that the only difference in
using :this rather than 'this.  Symbol checking with pcase is 

(pcase some-variable

  ('this (do-something))

and for keywords it would be

(pcase some-variable

  (:this (do-something))

Can one just pass :tabtail as an argument to a function?

In my case, would this be as so?

  (poulatuk '(72 :tabtrail :global)) 

> And one can Ask Emacs. This is what the Elisp manual
> has to say about keywords:
> 
> A symbol whose name starts with a colon (':') is
> called a keyword symbol. These symbols automatically
> act as constants, and are normally used only by
> comparing an unknown symbol with a few specific
> alternatives. See "Variables that Never Change".
> 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Symbol-Type.html
> 
> That "Variables that Never Change" link takes you here:
> 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Constant-Variables.html
> 
> where it says this:
> 
> Function: keywordp object ΒΆ
> function returns t if object is a symbol whose
> name starts with ':', interned in the standard
> obarray, and returns nil otherwise.



reply via email to

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