Hello all,

Sjamaan and Mario on the channel brought up an interesting issue with
substring=?. The current semantics check only to the length of the
shorter string, so:

(and (substring=? "foo" "foobar") (substring=? "foobar" "foo")) => #t


I submit that this behaviour is conceptually broken.


substring is an instance of a subset operation, and

(and (subset? a b) (subset? b a)) => #t

always implies that a = b.


I think the correct behaviour would be adding a check to the beginning
of the substring=? procedure, such that

(if (> (length a) (length b)) #f ...)


That said, I can understand the point of a string comparator that only
tests up to the length of the shortest argument, but I submit that it
shouldn't be named substring, which has different normal semantics. :)

Thoughts, ideas, changes, flames?

-elf


_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to