unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: cond construct for situation when a variable is t
Date: Tue, 22 Aug 2023 21:29:23 +0200	[thread overview]
Message-ID: <877cpm98q4.fsf@dataswamp.org> (raw)
In-Reply-To: fGnRvqkdkFuisqCMc-Q6vHXCCGPfK9HO7K7-95Y_61DGLU3MvVpo7kmPGzhugkdO_ThXbinJqUeE98gC7JxCtDPWgIccs4hGCkPznUUoU4Y=@protonmail.com

Heime wrote:

>>> How can I use the 'cond' construct for the case when
>>> a variable is 't' ?
>> 
>> It could look like this but in practice one would probably
>> put it in another way, that looks better.
>> 
>> (setq var nil)
>> 
>> (cond
>> (var 1)
>> ((not var) 0) )
>
> Which one looks better, the one you wrote with 0 and 1 ?

No, that was for demonstration purposes only, that what you
asked for is possible to do with `cond'.

In practice I think most people would find another solution to
express the same thing, but it is as valid so if you like it,
that is up to you.

>> You can, you totally can. Just don't `setq' t to anything :)
>
> Right, because one can set the letter t to something which
> would then screw up the idea that t means a truth condition.

And all code that relies on that idea :)

-- 
underground experts united
https://dataswamp.org/~incal




  parent reply	other threads:[~2023-08-22 19:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18 14:00 cond construct for situation when a variable is t Heime
2023-08-19 22:04 ` Emanuel Berg
2023-08-22 12:18   ` Heime
2023-08-22 16:10     ` [External] : " Drew Adams
2023-08-22 19:31       ` Emanuel Berg
2023-08-23 19:49         ` Drew Adams
2023-08-22 19:29     ` Emanuel Berg [this message]
2023-08-22 12:32   ` Heime
2023-08-22 16:17     ` [External] : " Drew Adams
2023-08-22 20:21       ` Heime
2023-08-22 21:07         ` Drew Adams
2023-08-19 22:43 ` Rudolf Adamkovič

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877cpm98q4.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).