public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Jamison Hope <jrh@theptrgroup.com>
To: kawa@sourceware.org
Subject: Re: srfi-14 char-set<= problem
Date: Mon, 01 Dec 2014 06:02:00 -0000	[thread overview]
Message-ID: <DBAE053A-F6F4-4375-A471-D1E0C1FA14FE@theptrgroup.com> (raw)
In-Reply-To: <54776323.4000101@hungry.com>

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

On Nov 27, 2014, at 12:45 PM, Seth Alves <alves@hungry.com> wrote:

> (import (scheme base) (scheme write) (srfi 14))
> (write (char-set<= (char-set #\u) (char-set #\u)))
> (newline)
> (write (char-set<= (char-set #\u) (char-set #\u #\a)))
> (newline)
> 
> This prints:
> 
> #t
> #f
> 
>    -seth

Yup, there was a bug in the char-set<= logic.  The attached patch should fix it.  Per, if you would do the honors..

--
Jamison Hope
The PTR Group
www.theptrgroup.com



[-- Attachment #2: srfi14-fix.patch --]
[-- Type: application/octet-stream, Size: 2227 bytes --]

Index: gnu/kawa/slib/ChangeLog
===================================================================
--- gnu/kawa/slib/ChangeLog	(revision 8186)
+++ gnu/kawa/slib/ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2014-12-01  Jamison Hope  <jrh@theptrgroup.com>
+
+	* srfi14.scm (char-set<=): Fix bug reported by Seth Alves.
+
 2014-11-27  Seth Alves <alves@hungry.com>
 
 	* srfi60.scm: Add more aliases.
Index: gnu/kawa/slib/srfi14.scm
===================================================================
--- gnu/kawa/slib/srfi14.scm	(revision 8186)
+++ gnu/kawa/slib/srfi14.scm	(working copy)
@@ -483,6 +483,9 @@
            ((= (inversion-list (- ai 1))
                (cs:inversion-list (- bi 1)))
             (loop (- ai 2) (- bi 2)))
+           ((> (inversion-list ai)
+               (cs:inversion-list (- bi 1)))
+            (loop ai (- bi 2)))
            (else #f))))
 
   ((contains? (char ::character)) ::boolean
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 8186)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2014-12-01  Jamison Hope  <jrh@theptrgroup.com>
+
+	* lib-test.scm: Add test for char-set<= bug reported by Seth
+	Alves.
+
 2014-11-26   Seth Alves <alves@hungry.com>
 	     Per Bothner  <per@bothner.com>
 
Index: testsuite/lib-test.scm
===================================================================
--- testsuite/lib-test.scm	(revision 8186)
+++ testsuite/lib-test.scm	(working copy)
@@ -1,6 +1,6 @@
 ;; -*- coding: utf-8 -*-
 
-(test-begin "libs" 257)
+(test-begin "libs" 259)
 
 (test-begin "vectors")
 (test-equal '(dah dah didah)
@@ -509,7 +509,7 @@
 
 (test-end)
 
-(test-begin "char-sets" 89)
+(test-begin "char-sets" 91)
 
 (import (srfi :14 char-sets))
 (import (rnrs sorting))
@@ -526,6 +526,8 @@
 (test-equal #t (char-set<= char-set:empty char-set:full))
 (test-equal #t (char-set<= char-set:empty char-set:lower-case
                            char-set:full))
+(test-equal #t (char-set<= (char-set #\u) (char-set #\u)))
+(test-equal #t (char-set<= (char-set #\u) (char-set #\u #\a)))
 ; char-set-hash
 (test-equal #t (= (char-set-hash char-set:empty)
                   (char-set-hash (char-set))))

  reply	other threads:[~2014-12-01  6:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27 17:45 Seth Alves
2014-12-01  6:02 ` Jamison Hope [this message]
2014-12-01 21:51   ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DBAE053A-F6F4-4375-A471-D1E0C1FA14FE@theptrgroup.com \
    --to=jrh@theptrgroup.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).