unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] wrong description of string-rindex
@ 2013-09-10  8:22 Nala Ginrut
  2013-09-10 10:49 ` Ian Price
  0 siblings, 1 reply; 6+ messages in thread
From: Nala Ginrut @ 2013-09-10  8:22 UTC (permalink / raw)
  To: guile-devel

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

- Scheme Procedure: string-rindex s char_pred [start [end]]
     Search through the string S from right to left, returning the index
     of the last occurrence of a character which
------
It's actually 'first occurrence', according to the activity of function.
And it's nonsense for 'last occurrence' since string-index does the same
work.

Here's a simple patch for that.

[-- Attachment #2: 0001-Fixed-typo-of-string-rindex-document.patch --]
[-- Type: text/x-patch, Size: 847 bytes --]

From 31fe00d36c834c8ca47f60af90ebf6b0b5a598a5 Mon Sep 17 00:00:00 2001
From: Nala Ginrut <nalaginrut@gmail.com>
Date: Tue, 10 Sep 2013 16:17:40 +0800
Subject: [PATCH] Fixed typo of string-rindex document

---
 doc/ref/api-data.texi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 7603180..f33a3cd 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -3715,7 +3715,7 @@ Return @code{#f} if no match is found.
 @deffn {Scheme Procedure} string-rindex s char_pred [start [end]]
 @deffnx {C Function} scm_string_rindex (s, char_pred, start, end)
 Search through the string @var{s} from right to left, returning
-the index of the last occurrence of a character which
+the index of the first occurrence of a character which
 
 @itemize @bullet
 @item
-- 
1.7.10.4


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

* re: [PATCH] wrong description of string-rindex
@ 2013-09-10  8:29 Nala Ginrut
  0 siblings, 0 replies; 6+ messages in thread
From: Nala Ginrut @ 2013-09-10  8:29 UTC (permalink / raw)
  To: guile-devel

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

Sorry I forget to update doc-string.
Here's the correct patch.

[-- Attachment #2: 0001-Fixed-typo-of-string-rindex-document.patch --]
[-- Type: text/x-patch, Size: 1592 bytes --]

From cd317b42291871ecae4d0f62e68adf4ace3b4b5b Mon Sep 17 00:00:00 2001
From: Nala Ginrut <nalaginrut@gmail.com>
Date: Tue, 10 Sep 2013 16:17:40 +0800
Subject: [PATCH] Fixed typo of string-rindex document

*   doc/ref/api-data.texi (string-rindex)
*   libguile/srfi-13.c (string-rindex): fixed the wrong description in document
---
 doc/ref/api-data.texi |    2 +-
 libguile/srfi-13.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 7603180..f33a3cd 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -3715,7 +3715,7 @@ Return @code{#f} if no match is found.
 @deffn {Scheme Procedure} string-rindex s char_pred [start [end]]
 @deffnx {C Function} scm_string_rindex (s, char_pred, start, end)
 Search through the string @var{s} from right to left, returning
-the index of the last occurrence of a character which
+the index of the first occurrence of a character which
 
 @itemize @bullet
 @item
diff --git a/libguile/srfi-13.c b/libguile/srfi-13.c
index 4e5d572..62f6e1d 100644
--- a/libguile/srfi-13.c
+++ b/libguile/srfi-13.c
@@ -1774,7 +1774,7 @@ SCM_DEFINE (scm_string_index_right, "string-index-right", 2, 2, 0,
 SCM_DEFINE (scm_string_rindex, "string-rindex", 2, 2, 0,
 	    (SCM s, SCM char_pred, SCM start, SCM end),
 	    "Search through the string @var{s} from right to left, returning\n"
-	    "the index of the last occurrence of a character which\n"
+	    "the index of the first occurrence of a character which\n"
 	    "\n"
 	    "@itemize @bullet\n"
 	    "@item\n"
-- 
1.7.10.4


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

* re: [PATCH] wrong description of string-rindex
@ 2013-09-10  8:38 Nala Ginrut
  2013-09-10  9:26 ` Taylan Ulrich B.
  0 siblings, 1 reply; 6+ messages in thread
From: Nala Ginrut @ 2013-09-10  8:38 UTC (permalink / raw)
  To: guile-devel

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

oops, I realized that string-index-right which is introduced in srfi-13 has the same issue too, and patch update here.


[-- Attachment #2: 0001-Fixed-typo-of-string-rindex-and-string-index-right-d.patch --]
[-- Type: text/x-patch, Size: 2543 bytes --]

From 9911b0f9b51358d9f96b23c924b4597b8bc5f5e5 Mon Sep 17 00:00:00 2001
From: Nala Ginrut <nalaginrut@gmail.com>
Date: Tue, 10 Sep 2013 16:17:40 +0800
Subject: [PATCH] Fixed typo of string-rindex and string-index-right document

*   doc/ref/api-data.texi (string-rindex, string-index-right)
*   libguile/srfi-13.c (string-rindex, string-index-right):
    fixed the wrong description in document
---
 doc/ref/api-data.texi |    4 ++--
 libguile/srfi-13.c    |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 7603180..ebf3069 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -3715,7 +3715,7 @@ Return @code{#f} if no match is found.
 @deffn {Scheme Procedure} string-rindex s char_pred [start [end]]
 @deffnx {C Function} scm_string_rindex (s, char_pred, start, end)
 Search through the string @var{s} from right to left, returning
-the index of the last occurrence of a character which
+the index of the first occurrence of a character which
 
 @itemize @bullet
 @item
@@ -3778,7 +3778,7 @@ Is @var{s1} a suffix of @var{s2}, ignoring character case?
 @deffn {Scheme Procedure} string-index-right s char_pred [start [end]]
 @deffnx {C Function} scm_string_index_right (s, char_pred, start, end)
 Search through the string @var{s} from right to left, returning
-the index of the last occurrence of a character which
+the index of the first occurrence of a character which
 
 @itemize @bullet
 @item
diff --git a/libguile/srfi-13.c b/libguile/srfi-13.c
index 4e5d572..d979a49 100644
--- a/libguile/srfi-13.c
+++ b/libguile/srfi-13.c
@@ -1709,7 +1709,7 @@ SCM_DEFINE (scm_string_index, "string-index", 2, 2, 0,
 SCM_DEFINE (scm_string_index_right, "string-index-right", 2, 2, 0,
 	    (SCM s, SCM char_pred, SCM start, SCM end),
 	    "Search through the string @var{s} from right to left, returning\n"
-	    "the index of the last occurrence of a character which\n"
+	    "the index of the first occurrence of a character which\n"
 	    "\n"
 	    "@itemize @bullet\n"
 	    "@item\n"
@@ -1774,7 +1774,7 @@ SCM_DEFINE (scm_string_index_right, "string-index-right", 2, 2, 0,
 SCM_DEFINE (scm_string_rindex, "string-rindex", 2, 2, 0,
 	    (SCM s, SCM char_pred, SCM start, SCM end),
 	    "Search through the string @var{s} from right to left, returning\n"
-	    "the index of the last occurrence of a character which\n"
+	    "the index of the first occurrence of a character which\n"
 	    "\n"
 	    "@itemize @bullet\n"
 	    "@item\n"
-- 
1.7.10.4


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

* Re: [PATCH] wrong description of string-rindex
  2013-09-10  8:38 Nala Ginrut
@ 2013-09-10  9:26 ` Taylan Ulrich B.
  0 siblings, 0 replies; 6+ messages in thread
From: Taylan Ulrich B. @ 2013-09-10  9:26 UTC (permalink / raw)
  To: Nala Ginrut; +Cc: guile-devel

I see `string-rindex' is equivalent to (and implemented via)
`string-index-right'.  The latter is the SRFI-13 name, the former I
suppose Guile-specific; is there a reason not to deprecate the former?



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

* Re: [PATCH] wrong description of string-rindex
  2013-09-10  8:22 [PATCH] wrong description of string-rindex Nala Ginrut
@ 2013-09-10 10:49 ` Ian Price
  2013-09-10 11:05   ` Nala Ginrut
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Price @ 2013-09-10 10:49 UTC (permalink / raw)
  To: Nala Ginrut; +Cc: guile-devel

Nala Ginrut <nalaginrut@gmail.com> writes:

> - Scheme Procedure: string-rindex s char_pred [start [end]]
>      Search through the string S from right to left, returning the index
>      of the last occurrence of a character which
> ------
> It's actually 'first occurrence', according to the activity of function.
> And it's nonsense for 'last occurrence' since string-index does the same
> work.
I'm going to be honest, I don't think either of these are particularly
great wordings. They are both misleading in different ways, I feel.
Rather than 'first' or 'last', it would be better to use 'leftmost' and 'rightmost'

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"



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

* Re: [PATCH] wrong description of string-rindex
  2013-09-10 10:49 ` Ian Price
@ 2013-09-10 11:05   ` Nala Ginrut
  0 siblings, 0 replies; 6+ messages in thread
From: Nala Ginrut @ 2013-09-10 11:05 UTC (permalink / raw)
  To: Ian Price; +Cc: guile-devel

On Tue, 2013-09-10 at 11:49 +0100, Ian Price wrote:
> Nala Ginrut <nalaginrut@gmail.com> writes:
> 
> > - Scheme Procedure: string-rindex s char_pred [start [end]]
> >      Search through the string S from right to left, returning the index
> >      of the last occurrence of a character which
> > ------
> > It's actually 'first occurrence', according to the activity of function.
> > And it's nonsense for 'last occurrence' since string-index does the same
> > work.
> I'm going to be honest, I don't think either of these are particularly
> great wordings. They are both misleading in different ways, I feel.
> Rather than 'first' or 'last', it would be better to use 'leftmost' and 'rightmost'
> 

It's the word used in srfi-13
----------------------------------cut--------------------------------
string-index (string-index-right) searches through the string from the
left (right), returning the index of the first occurrence of a character
which
----------------------------------end--------------------------------




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

end of thread, other threads:[~2013-09-10 11:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-10  8:22 [PATCH] wrong description of string-rindex Nala Ginrut
2013-09-10 10:49 ` Ian Price
2013-09-10 11:05   ` Nala Ginrut
  -- strict thread matches above, loose matches on Subject: below --
2013-09-10  8:29 Nala Ginrut
2013-09-10  8:38 Nala Ginrut
2013-09-10  9:26 ` Taylan Ulrich B.

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