[plt-scheme] srfi 13

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Apr 1 08:09:09 EDT 2009

So this should be the contracts:


   (define si string-index)
   (define si-right string-index-right)

   ;; --- signature ---

   (require scheme/contract)

   (define (no-c-in c sel)
     (lambda (i)
       (and (integer? i) (>= i 0) (boolean? (member c (string->list  
(sel i)))))))

   (provide/contract
    [si       (->d ((s string?) (c char?)) ()
                   (i (no-c-in c (λ (i) (substring s 0 i)))))]
    [si-right (->d ((s string?) (c char?)) ()
                   (i (no-c-in c (λ (i) (substring s (+ i 1))))))])

?? -- Matthias



On Apr 1, 2009, at 7:39 AM, Sam TH wrote:

> I believe that behavior is correct.  I think the difference is:
>
> (require srfi/13)
>
> (string-index "bob" #\b) ; => 0
> (string-index-right "bob" #\b) ; => 2
>
> sam th
>
> On Wed, Apr 1, 2009 at 6:17 AM, nik gaffney <nik at fo.am> wrote:
>>
>> I've just noticed a small bug in srfi 13, as the following 2  
>> functions
>> appear to return the same result (in PLT 4.1.5)
>>
>> (require srfi/13)
>>
>> (string-index "abcde" #\d)
>> (string-index-right "abcde" #\d)
>>
>>
>>
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>
>
>
> -- 
> sam th
> samth at ccs.neu.edu
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.