1; SketchyLISP Library 2; Copyright (C) 2005,2006,2007 Nils M Holm. All rights reserved. 3; See the file LICENSE of the SketchyLISP distribution 4; for conditions of use. 5 6; ---name--- 7; string<? 8 9; ---conformance--- 10; R5RS 11 12; ---purpose--- 13; Test whether a sequence of strings is in 14; lexically ascending order. 15 16; ---args--- 17; X - string 18; Y... - strings 19 20; ---keywords--- 21; STRING<? function, strings, comparison, lexical order, 22; ascending 23 24; ---see-also--- 25; string-ci<?, string=?, string>?, string<=?, string>=?, char<?, equal? 26 27; ---example--- 28; (string<? "abc" "xyz" "zzz") => #t 29 30(define sltp #t) 31 32; (require "cgtp.scm") ; char>? 33; (require "cltp.scm") ; char<? 34; (load "nullp.scm") ; null? 35(load "not.scm") 36(require "pred-iter.scm") ; predicate-iterator 37 38; ---code--- 39(define string<? 40 (letrec 41 ((lt? 42 (lambda (x y) 43 (cond ((null? x) (not (null? y))) 44 ((null? y) #f) 45 ((char<? (car x) (car y)) #t) 46 ((char>? (car x) (car y)) #f) 47 (else (lt? (cdr x) (cdr y))))))) 48 (predicate-iterator 49 (lambda (x y) 50 (lt? (string->list x) 51 (string->list y)))))) 52