unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual
@ 2023-02-05 12:01 Ihor Radchenko
  2023-02-05 12:11 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2023-02-05 12:01 UTC (permalink / raw)
  To: 61293

Hi,

would it make sense to mention `proper-list-p' and `plistp' in the Elisp
manual? I got to know about these function by accident and
`proper-list-p' in particular is extremely useful in some situations.

Also, what about `alistp'? Would it make sense to add such function?

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, cairo version
 1.17.6) of 2023-02-03 built on localhost
Repository revision: ac7ec87a7a0db887e4ae7fe9005aea517958b778
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101006
System Description: Gentoo Linux

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual
  2023-02-05 12:01 bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual Ihor Radchenko
@ 2023-02-05 12:11 ` Eli Zaretskii
  2023-02-05 12:34   ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2023-02-05 12:11 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 61293

> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Sun, 05 Feb 2023 12:01:17 +0000
> 
> would it make sense to mention `proper-list-p' and `plistp' in the Elisp
> manual? I got to know about these function by accident and
> `proper-list-p' in particular is extremely useful in some situations.

proper-list-p was already documented.  I added plistp.

> Also, what about `alistp'? Would it make sense to add such function?

I don't know.  When would it be useful?





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

* bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual
  2023-02-05 12:11 ` Eli Zaretskii
@ 2023-02-05 12:34   ` Ihor Radchenko
  2023-02-05 13:02     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2023-02-05 12:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 61293

Eli Zaretskii <eliz@gnu.org> writes:

> proper-list-p was already documented.  I added plistp.

Thanks! Note that `proper-list-p' is not listed in section 2.7.

>> Also, what about `alistp'? Would it make sense to add such function?
>
> I don't know.  When would it be useful?

I mostly expected it is exist, but it does not.
Also, there is `nested-alist-p'. So, not having `alistp' feels awkward.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual
  2023-02-05 12:34   ` Ihor Radchenko
@ 2023-02-05 13:02     ` Eli Zaretskii
  2023-02-06  9:20       ` Robert Pluim
  2023-02-06 14:21       ` Ihor Radchenko
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2023-02-05 13:02 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 61293

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: 61293@debbugs.gnu.org
> Date: Sun, 05 Feb 2023 12:34:00 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > proper-list-p was already documented.  I added plistp.
> 
> Thanks! Note that `proper-list-p' is not listed in section 2.7.

I don't think this should bother us.  If you type "i proper list RET",
you will land in the node which describes that term; the very next
section documents proper-list-p.  So I think everything here is fine.

> >> Also, what about `alistp'? Would it make sense to add such function?
> >
> > I don't know.  When would it be useful?
> 
> I mostly expected it is exist, but it does not.
> Also, there is `nested-alist-p'. So, not having `alistp' feels awkward.

Most probably because no one needed it, at least not too frequently.





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

* bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual
  2023-02-05 13:02     ` Eli Zaretskii
@ 2023-02-06  9:20       ` Robert Pluim
  2023-02-06 10:19         ` Ihor Radchenko
  2023-02-06 14:21       ` Ihor Radchenko
  1 sibling, 1 reply; 8+ messages in thread
From: Robert Pluim @ 2023-02-06  9:20 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Eli Zaretskii, 61293

>>>>> On Sun, 05 Feb 2023 15:02:05 +0200, Eli Zaretskii <eliz@gnu.org> said:
    >> I mostly expected it is exist, but it does not.
    >> Also, there is `nested-alist-p'. So, not having `alistp' feels awkward.

    Eli> Most probably because no one needed it, at least not too frequently.

One point here: Emacs allows 'improper' alists without complaining:

(alist-get 1 '((2 . 4)
               5
               (3 . 1)
               (1 . 7)))

=> 7

so weʼd have to be careful about how we defined `alistp'

Robert
-- 





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

* bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual
  2023-02-06  9:20       ` Robert Pluim
@ 2023-02-06 10:19         ` Ihor Radchenko
  2023-02-06 10:43           ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2023-02-06 10:19 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Eli Zaretskii, 61293

Robert Pluim <rpluim@gmail.com> writes:

> One point here: Emacs allows 'improper' alists without complaining:
>
> (alist-get 1 '((2 . 4)
>                5
>                (3 . 1)
>                (1 . 7)))
>
> => 7
>
> so weʼd have to be careful about how we defined `alistp'

This is no different from plists:

(plistp '(1 2 3)) ; => nil
(plist-get '(1 2 3) 1) ; => 2

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual
  2023-02-06 10:19         ` Ihor Radchenko
@ 2023-02-06 10:43           ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 8+ messages in thread
From: Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-02-06 10:43 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Robert Pluim, 61293, Eli Zaretskii

Ihor Radchenko [2023-02-06 10:19 +0000] wrote:

> Robert Pluim <rpluim@gmail.com> writes:
>
>> One point here: Emacs allows 'improper' alists without complaining:
>>
>> (alist-get 1 '((2 . 4)
>>                5
>>                (3 . 1)
>>                (1 . 7)))
>>
>> => 7
>>
>> so weʼd have to be careful about how we defined `alistp'
>
> This is no different from plists:
>
> (plistp '(1 2 3)) ; => nil
> (plist-get '(1 2 3) 1) ; => 2

Exactly, hence why there is no 'standard' alistp, or why there was no
plistp for a very long time: every application has a different notion of
/ heuristic for what is permissible as an alist or plist.  It is
impossible to cover them all, and usually quite easy to write an
application-specific predicate (not that I object to adding alistp).

-- 
Basil





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

* bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual
  2023-02-05 13:02     ` Eli Zaretskii
  2023-02-06  9:20       ` Robert Pluim
@ 2023-02-06 14:21       ` Ihor Radchenko
  1 sibling, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2023-02-06 14:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 61293

Eli Zaretskii <eliz@gnu.org> writes:

>> Thanks! Note that `proper-list-p' is not listed in section 2.7.
>
> I don't think this should bother us.  If you type "i proper list RET",
> you will land in the node which describes that term; the very next
> section documents proper-list-p.  So I think everything here is fine.

I actually had difficulties because I did not recall if it should be
"proper" or "true" or maybe "real". But "i list predicate" also works,
so I also do not see anything wrong.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

end of thread, other threads:[~2023-02-06 14:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-05 12:01 bug#61293: 30.0.50; [FR] Add `proper-list-p' and `plistp' to 2.7 Type Predicates section of the manual Ihor Radchenko
2023-02-05 12:11 ` Eli Zaretskii
2023-02-05 12:34   ` Ihor Radchenko
2023-02-05 13:02     ` Eli Zaretskii
2023-02-06  9:20       ` Robert Pluim
2023-02-06 10:19         ` Ihor Radchenko
2023-02-06 10:43           ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-06 14:21       ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

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

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