all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Anti-ignore?
@ 2015-09-10 21:24 Marcin Borkowski
  2015-09-10 21:28 ` Anti-ignore? Drew Adams
  2015-09-15 11:14 ` Anti-ignore? Nicolas Richard
  0 siblings, 2 replies; 6+ messages in thread
From: Marcin Borkowski @ 2015-09-10 21:24 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

the `ignore' function accepts any number of arguments and returns nil.
Is there a `canonical' function which would accept any number of
arguments and return t?  (Note: I /can/ implement it myself;-), I'm just
curious whether this exists - I couldn't find it.)

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* RE: Anti-ignore?
  2015-09-10 21:24 Anti-ignore? Marcin Borkowski
@ 2015-09-10 21:28 ` Drew Adams
  2015-09-15 11:14 ` Anti-ignore? Nicolas Richard
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2015-09-10 21:28 UTC (permalink / raw)
  To: Marcin Borkowski, Help Gnu Emacs mailing list

> the `ignore' function accepts any number of arguments and returns nil.
> Is there a `canonical' function which would accept any number of
> arguments and return t?  (Note: I /can/ implement it myself;-), I'm just
> curious whether this exists - I couldn't find it.)

Not that I'm aware of.



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

* Re: Anti-ignore?
       [not found] <mailman.876.1441920312.19560.help-gnu-emacs@gnu.org>
@ 2015-09-10 22:20 ` Pascal J. Bourguignon
  2015-09-11  1:10   ` Anti-ignore? Emanuel Berg
       [not found]   ` <mailman.887.1441933829.19560.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Pascal J. Bourguignon @ 2015-09-10 22:20 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski <mbork@mbork.pl> writes:

> the `ignore' function accepts any number of arguments and returns nil.
> Is there a `canonical' function which would accept any number of
> arguments and return t?  (Note: I /can/ implement it myself;-), I'm just
> curious whether this exists - I couldn't find it.)

(funcall (constantly t) 'what 'ever) --> t

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: Anti-ignore?
  2015-09-10 22:20 ` Anti-ignore? Pascal J. Bourguignon
@ 2015-09-11  1:10   ` Emanuel Berg
       [not found]   ` <mailman.887.1441933829.19560.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Emanuel Berg @ 2015-09-11  1:10 UTC (permalink / raw)
  To: help-gnu-emacs

"Pascal J. Bourguignon" <pjb@informatimago.com>
writes:

>> the `ignore' function accepts any number of
>> arguments and returns nil. Is there a `canonical'
>> function which would accept any number of arguments
>> and return t? (Note: I /can/ implement it
>> myself;-), I'm just curious whether this exists -
>> I couldn't find it.)
>
> (funcall (constantly t) 'what 'ever) --> t

That yields:

    (void-function constantly) in funcall

How about:

    (defun always-t (&rest args) t)

I suppose this can be useful when you are submitting
a function as an argument and you want it to be `t'.
You can't just submit `t' because it isn't a function.

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: Anti-ignore?
       [not found]   ` <mailman.887.1441933829.19560.help-gnu-emacs@gnu.org>
@ 2015-09-11  2:08     ` Pascal J. Bourguignon
  0 siblings, 0 replies; 6+ messages in thread
From: Pascal J. Bourguignon @ 2015-09-11  2:08 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> "Pascal J. Bourguignon" <pjb@informatimago.com>
> writes:
>
>>> the `ignore' function accepts any number of
>>> arguments and returns nil. Is there a `canonical'
>>> function which would accept any number of arguments
>>> and return t? (Note: I /can/ implement it
>>> myself;-), I'm just curious whether this exists -
>>> I couldn't find it.)
>>
>> (funcall (constantly t) 'what 'ever) --> t
>
> That yields:
>
>     (void-function constantly) in funcall
>
> How about:

Indeed, you are missing this function; it's in pjb-emacs.el

;; with lexical-binding:t of course:
(defun constantly (value)
  (lambda (&rest arguments)
    (declare (ignore arguments))
    value))

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: Anti-ignore?
  2015-09-10 21:24 Anti-ignore? Marcin Borkowski
  2015-09-10 21:28 ` Anti-ignore? Drew Adams
@ 2015-09-15 11:14 ` Nicolas Richard
  1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Richard @ 2015-09-15 11:14 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

Marcin Borkowski <mbork@mbork.pl> writes:
> the `ignore' function accepts any number of arguments and returns nil.
> Is there a `canonical' function which would accept any number of
> arguments and return t?  (Note: I /can/ implement it myself;-), I'm just
> curious whether this exists - I couldn't find it.)

FWIW I once had the great idea of doing

(fset nil (lambda (&rest _) nil))
(fset t (lambda (&rest _) t))

but that didn't work quite as I wanted...

-- 
Nico.



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

end of thread, other threads:[~2015-09-15 11:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.876.1441920312.19560.help-gnu-emacs@gnu.org>
2015-09-10 22:20 ` Anti-ignore? Pascal J. Bourguignon
2015-09-11  1:10   ` Anti-ignore? Emanuel Berg
     [not found]   ` <mailman.887.1441933829.19560.help-gnu-emacs@gnu.org>
2015-09-11  2:08     ` Anti-ignore? Pascal J. Bourguignon
2015-09-10 21:24 Anti-ignore? Marcin Borkowski
2015-09-10 21:28 ` Anti-ignore? Drew Adams
2015-09-15 11:14 ` Anti-ignore? Nicolas Richard

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.