SketchyLISP Reference |
Copyright (C) 2006 Nils M Holm |
<<[string-ref] | [Index] | [string<=?]>> |
Conformance: R5RS
Purpose: Test whether two strings are in ascending lexical order.
Arguments:
X - string
Y - string
Implementation:
(define (string<? x y) (letrec ((lt? (lambda (x y) (cond ((null? x) (not (null? y))) ((null? y) #f) ((char<? (car x) (car y)) #t) ((char>? (car x) (car y)) #f) (#t (lt? (cdr x) (cdr y))))))) (lt? (string->list x) (string->list y))))
Example:
(string<? "abc" "xyz") => #t
See also:
string-ci<?,
string=?,
string>?,
string<=?,
string>=?,
char<?,
equal?.
<<[string-ref] | [Index] | [string<=?]>> |