emacs-devel
[Top][All Lists]
Advanced

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

Re: cond* Examples


From: Trevor Arjeski
Subject: Re: cond* Examples
Date: Thu, 09 Jan 2025 16:35:46 +0300
User-agent: Gnus/5.13 (Gnus v5.13)

No constructive comments from me, but this thread got me tinkering with `cond*'.

I'm embarassed to say that I spent too much time on this little snippet:

(cond*
 ((bind* (foo 1)
         (bar 2)) :non-exit)
 ((eq foo bar) :eq)
 ((< foo bar) :lt)
 (t :nothing))

In my mind, this should return `:lt', but it returns `:nothing'. After 
scratching my head, I looked
at the code and it seems that it conflicts with the manual entry:

"If a clause has only one element, or if its first element is ‘t’,
 or if it ends with the keyword ‘:non-exit’, then this clause never
 exits the ‘cond*’ construct."

Apparently, if a clause returns any keyword, it does a passthrough (see 
`cond*-non-exit-clause-p' ?)

Changing to this works:

(cond*
 ((bind* (foo 1)
         (bar 2)) :non-exit) ; works with and without :non-exit
 ((eq foo bar) "eq")
 ((< foo bar) "lt")
 (t :nothing))
;; returns "lt"

Anyway, sorry if this is off-topic.




reply via email to

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