unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* is there an existing negate function ?
@ 2009-03-09 23:38 Mike Mattie
  2009-03-10  0:22 ` Juanma Barranquero
  2009-03-10  6:36 ` Drew Adams
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Mattie @ 2009-03-09 23:38 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 297 bytes --]

is there an existing negate function ? something like this
that I have no found ?

(defun negate ( value )
  "negate VALUE

   Invert the boolean sense of VALUE

   0 -> 1
   1 -> 0
  "
  (if value
    nil
    t))

-- 
GnuPG Key: B9012279 is available from HKP server pgp.mit.edu

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: is there an existing negate function ?
  2009-03-09 23:38 is there an existing negate function ? Mike Mattie
@ 2009-03-10  0:22 ` Juanma Barranquero
  2009-03-10  6:36 ` Drew Adams
  1 sibling, 0 replies; 3+ messages in thread
From: Juanma Barranquero @ 2009-03-10  0:22 UTC (permalink / raw)
  To: Mike Mattie; +Cc: help-gnu-emacs

> is there an existing negate function ? something like this
> that I have no found ?
>
> (defun negate ( value )
>  (if value
>    nil
>    t))

`null' (or its alias, `not').

    Juanma




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: is there an existing negate function ?
  2009-03-09 23:38 is there an existing negate function ? Mike Mattie
  2009-03-10  0:22 ` Juanma Barranquero
@ 2009-03-10  6:36 ` Drew Adams
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2009-03-10  6:36 UTC (permalink / raw)
  To: 'Mike Mattie', help-gnu-emacs

> is there an existing negate function ? something like this
> that I have no found ?
> 
> (defun negate ( value )
>   "negate VALUE - Invert the boolean sense of VALUE
>    0 -> 1
>    1 -> 0"
>   (if value nil t))

I'll bite. ;-)

Is `not' (aka `null') what you mean?
(not nil) -> t
(not 'non-nil) -> nil





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-10  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-09 23:38 is there an existing negate function ? Mike Mattie
2009-03-10  0:22 ` Juanma Barranquero
2009-03-10  6:36 ` Drew Adams

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).