unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [Doc] Patch: eq? and friends accepts more than two arguments
@ 2022-11-06 14:47 Thomas Morley
  2022-11-06 14:58 ` Jean Abou Samra
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Morley @ 2022-11-06 14:47 UTC (permalink / raw)
  To: Guile Devel

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

Hi,

please find attached a doc-patch, clearifying eq?/eqv?/equal? are
working with more than two arguments.

Cheers,
  Harm

[-- Attachment #2: 0001-Document-eq-and-friends-accepts-more-than-two-argume.patch --]
[-- Type: text/x-patch, Size: 2260 bytes --]

From 23691d4ec8485169cbed0cdf64fb4d36f7daf343 Mon Sep 17 00:00:00 2001
From: Thomas Morley <thomasmorley65@gmail.com>
Date: Sun, 6 Nov 2022 15:41:50 +0100
Subject: [PATCH] Document eq? and friends accepts more than two arguments

---
 doc/ref/api-utility.texi | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/doc/ref/api-utility.texi b/doc/ref/api-utility.texi
index cb7e32f2b..435fbddd2 100644
--- a/doc/ref/api-utility.texi
+++ b/doc/ref/api-utility.texi
@@ -55,7 +55,7 @@ made up of the same pairs.  Such lists look the same (when printed),
 and @code{equal?} will consider them the same.
 
 @sp 1
-@deffn {Scheme Procedure} eq? x y
+@deffn {Scheme Procedure} eq? x y ...
 @deffnx {C Function} scm_eq_p (x, y)
 @rnindex eq?
 Return @code{#t} if @var{x} and @var{y} are the same object, except
@@ -96,6 +96,13 @@ compared with @code{eq?},
 (define x (string->symbol "foo"))
 (eq? x 'foo) @result{} #t
 @end example
+
+@code{eq?} accepts more than two arguments:
+
+@example
+(eq? 'foo 'foo 'foo) @result{} #t
+(eq? 'foo 'bar 'buzz) @result{} #f
+@end example
 @end deffn
 
 @deftypefn {C Function} int scm_is_eq (SCM x, SCM y)
@@ -109,7 +116,7 @@ The @code{==} operator should not be used on @code{SCM} values, an
 @end deftypefn
 
 @sp 1
-@deffn {Scheme Procedure} eqv? x y
+@deffn {Scheme Procedure} eqv? x y ...
 @deffnx {C Function} scm_eqv_p (x, y)
 @rnindex eqv?
 Return @code{#t} if @var{x} and @var{y} are the same object, or for
@@ -127,10 +134,12 @@ inexact number (even if their value is the same).
 (eqv? 3 (+ 1 2)) @result{} #t
 (eqv? 1 1.0)     @result{} #f
 @end example
+
+As @code{eq?}, @code{eqv?} accepts more than two arguments.
 @end deffn
 
 @sp 1
-@deffn {Scheme Procedure} equal? x y
+@deffn {Scheme Procedure} equal? x y ...
 @deffnx {C Function} scm_equal_p (x, y)
 @rnindex equal?
 Return @code{#t} if @var{x} and @var{y} are the same type, and their
@@ -155,6 +164,8 @@ even if their value is the same).
 (equal? 1 1.0)     @result{} #f
 @end example
 
+As @code{eq?} and @code{eqv?}, @code{equal?} accepts more than two arguments.
+
 Hash tables are currently only compared as per @code{eq?}, so two
 different tables are not @code{equal?}, even if their contents are the
 same.
-- 
2.34.1


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

* Re: [Doc] Patch: eq? and friends accepts more than two arguments
  2022-11-06 14:47 [Doc] Patch: eq? and friends accepts more than two arguments Thomas Morley
@ 2022-11-06 14:58 ` Jean Abou Samra
  2022-11-06 15:17   ` Thomas Morley
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Abou Samra @ 2022-11-06 14:58 UTC (permalink / raw)
  To: Thomas Morley, Guile Devel


[-- Attachment #1.1: Type: text/plain, Size: 3418 bytes --]

Le 06/11/2022 à 15:47, Thomas Morley a écrit :
> Hi,
>
> please find attached a doc-patch, clearifying eq?/eqv?/equal? are
> working with more than two arguments.


Well, but the signature

eq? x y ...

is still not correct, because (eq?) and (eq? x) are also valid.
eq? takes *any* number of arguments.

Probably better to do:



 From 09177dab48dabee4b6b6ac5fe110cd56e3e6e261 Mon Sep 17 00:00:00 2001
From: Jean Abou Samra <jean@abou-samra.fr>
Date: Sun, 6 Nov 2022 15:55:24 +0100
Subject: [PATCH] Doc: document that eq?, eqv? and equal? take any number of
  arguments

---
  doc/ref/api-utility.texi | 29 ++++++++++++++++-------------
  1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/doc/ref/api-utility.texi b/doc/ref/api-utility.texi
index cb7e32f2b..27c6b42f7 100644
--- a/doc/ref/api-utility.texi
+++ b/doc/ref/api-utility.texi
@@ -55,11 +55,12 @@ made up of the same pairs.  Such lists look the same 
(when printed),
  and @code{equal?} will consider them the same.

  @sp 1
-@deffn {Scheme Procedure} eq? x y
+@deffn {Scheme Procedure} eq? @dots{}
  @deffnx {C Function} scm_eq_p (x, y)
  @rnindex eq?
-Return @code{#t} if @var{x} and @var{y} are the same object, except
-for numbers and characters.  For example,
+The Scheme procedure returns @code{#t} if all of its arguments are the
+same object, except for numbers and characters.  The C function does the
+same but takes exactly two arguments.  For example,

  @example
  (define x (vector 1 2 3))
@@ -109,18 +110,19 @@ The @code{==} operator should not be used on 
@code{SCM} values, an
  @end deftypefn

  @sp 1
-@deffn {Scheme Procedure} eqv? x y
+@deffn {Scheme Procedure} eqv? @dots{}
  @deffnx {C Function} scm_eqv_p (x, y)
  @rnindex eqv?
-Return @code{#t} if @var{x} and @var{y} are the same object, or for
-characters and numbers the same value.
+The Scheme procedure returns @code{#t} if all of its arguments are the
+same object, or for characters and numbers the same value.  The C function
+is similar but takes exactly two arguments.

  On objects except characters and numbers, @code{eqv?} is the same as
-@code{eq?} above, it's true if @var{x} and @var{y} are the same
-object.
+@code{eq?} above.  @code{(eqv? x y)} is true if @var{x} and @var{y} are
+the same object.

-If @var{x} and @var{y} are numbers or characters, @code{eqv?} compares
-their type and value.  An exact number is not @code{eqv?} to an
+If @var{x} and @var{y} are numbers or characters, @code{(eqv? x y)}
+compares their type and value.  An exact number is not @code{eqv?} to an
  inexact number (even if their value is the same).

  @example
@@ -130,11 +132,12 @@ inexact number (even if their value is the same).
  @end deffn

  @sp 1
-@deffn {Scheme Procedure} equal? x y
+@deffn {Scheme Procedure} equal? @dots{}
  @deffnx {C Function} scm_equal_p (x, y)
  @rnindex equal?
-Return @code{#t} if @var{x} and @var{y} are the same type, and their
-contents or value are equal.
+The Scheme procedure returns @code{#t} if all of its arguments are the
+same type, and their contents or value are equal.  The C function is
+similar, but takes exactly two arguments.

  For a pair, string, vector, array or structure, @code{equal?} compares the
  contents, and does so using the same @code{equal?} recursively,
-- 
2.37.3



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: [Doc] Patch: eq? and friends accepts more than two arguments
  2022-11-06 14:58 ` Jean Abou Samra
@ 2022-11-06 15:17   ` Thomas Morley
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Morley @ 2022-11-06 15:17 UTC (permalink / raw)
  To: Jean Abou Samra; +Cc: Guile Devel

Am So., 6. Nov. 2022 um 15:58 Uhr schrieb Jean Abou Samra <jean@abou-samra.fr>:
>
> Le 06/11/2022 à 15:47, Thomas Morley a écrit :
> > Hi,
> >
> > please find attached a doc-patch, clearifying eq?/eqv?/equal? are
> > working with more than two arguments.
>
>
> Well, but the signature
>
> eq? x y ...
>
> is still not correct, because (eq?) and (eq? x) are also valid.
> eq? takes *any* number of arguments.
>
> Probably better to do:
>
>
>
>  From 09177dab48dabee4b6b6ac5fe110cd56e3e6e261 Mon Sep 17 00:00:00 2001
> From: Jean Abou Samra <jean@abou-samra.fr>
> Date: Sun, 6 Nov 2022 15:55:24 +0100
> Subject: [PATCH] Doc: document that eq?, eqv? and equal? take any number of
>   arguments
>
> ---
>   doc/ref/api-utility.texi | 29 ++++++++++++++++-------------
>   1 file changed, 16 insertions(+), 13 deletions(-)
>
> diff --git a/doc/ref/api-utility.texi b/doc/ref/api-utility.texi
> index cb7e32f2b..27c6b42f7 100644
> --- a/doc/ref/api-utility.texi
> +++ b/doc/ref/api-utility.texi
> @@ -55,11 +55,12 @@ made up of the same pairs.  Such lists look the same
> (when printed),
>   and @code{equal?} will consider them the same.
>
>   @sp 1
> -@deffn {Scheme Procedure} eq? x y
> +@deffn {Scheme Procedure} eq? @dots{}
>   @deffnx {C Function} scm_eq_p (x, y)
>   @rnindex eq?
> -Return @code{#t} if @var{x} and @var{y} are the same object, except
> -for numbers and characters.  For example,
> +The Scheme procedure returns @code{#t} if all of its arguments are the
> +same object, except for numbers and characters.  The C function does the
> +same but takes exactly two arguments.  For example,
>
>   @example
>   (define x (vector 1 2 3))
> @@ -109,18 +110,19 @@ The @code{==} operator should not be used on
> @code{SCM} values, an
>   @end deftypefn
>
>   @sp 1
> -@deffn {Scheme Procedure} eqv? x y
> +@deffn {Scheme Procedure} eqv? @dots{}
>   @deffnx {C Function} scm_eqv_p (x, y)
>   @rnindex eqv?
> -Return @code{#t} if @var{x} and @var{y} are the same object, or for
> -characters and numbers the same value.
> +The Scheme procedure returns @code{#t} if all of its arguments are the
> +same object, or for characters and numbers the same value.  The C function
> +is similar but takes exactly two arguments.
>
>   On objects except characters and numbers, @code{eqv?} is the same as
> -@code{eq?} above, it's true if @var{x} and @var{y} are the same
> -object.
> +@code{eq?} above.  @code{(eqv? x y)} is true if @var{x} and @var{y} are
> +the same object.
>
> -If @var{x} and @var{y} are numbers or characters, @code{eqv?} compares
> -their type and value.  An exact number is not @code{eqv?} to an
> +If @var{x} and @var{y} are numbers or characters, @code{(eqv? x y)}
> +compares their type and value.  An exact number is not @code{eqv?} to an
>   inexact number (even if their value is the same).
>
>   @example
> @@ -130,11 +132,12 @@ inexact number (even if their value is the same).
>   @end deffn
>
>   @sp 1
> -@deffn {Scheme Procedure} equal? x y
> +@deffn {Scheme Procedure} equal? @dots{}
>   @deffnx {C Function} scm_equal_p (x, y)
>   @rnindex equal?
> -Return @code{#t} if @var{x} and @var{y} are the same type, and their
> -contents or value are equal.
> +The Scheme procedure returns @code{#t} if all of its arguments are the
> +same type, and their contents or value are equal.  The C function is
> +similar, but takes exactly two arguments.
>
>   For a pair, string, vector, array or structure, @code{equal?} compares the
>   contents, and does so using the same @code{equal?} recursively,
> --
> 2.37.3
>
>

Agreed, far better.

Thanks,
  Harm



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

end of thread, other threads:[~2022-11-06 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-06 14:47 [Doc] Patch: eq? and friends accepts more than two arguments Thomas Morley
2022-11-06 14:58 ` Jean Abou Samra
2022-11-06 15:17   ` Thomas Morley

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