Hi Vasilij. VS wrote, 2018-09-11 09:26: >> > (string-ci<=? "test" "tes") >> #t >> > (string-ci>=? "test" "tes") >> #f > > This is odd. Here's some source code: > > (set! scheme#string-ci<=? (lambda (s1 s2) > (compare > s1 s2 'string-ci<=? > (lambda (len1 len2 cmp) > (if (eq? cmp 0) > (fx>= len1 len2) > (fx< cmp 0) ) ) ) ) ) > (set! scheme#string-ci>=? (lambda (s1 s2) > (compare > s1 s2 'string-ci>=? > (lambda (len1 len2 cmp) > (if (eq? cmp 0) > (fx<= len1 len2) > (fx> cmp 0) ) ) ) ) ) > > From what I can tell, `cmp` ends up being zero if the `memcmp` called by > `compare` returns zero for both strings, with the smaller length as last > argument. This happens when they share the same prefix, so in this case > you'd run into that branch, then compare `len1` against `len2`. As > `len1` is larger, `string-ci<=?` returns #t. The question is, what > should the correct comparator be here?
The line (fx>= len1 len2) should be moved down to scheme#string-ci>=?, and the line (fx<= len1 len2) should be moved to to scheme#string-ci<=? Am I missing something? Ciao Sven _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
