RosettaCodeData/Task/String-matching/TXR/string-matching-1.txr

17 lines
607 B
Plaintext

(tree-case *args*
((big small)
(cond
((< (length big) (length small))
(put-line `@big is shorter than @small`))
((str= big small)
(put-line `@big and @small are equal`))
((starts-with small big)
(put-line `@small is a prefix of @big`))
((ends-with small big)
(put-line `@small is a suffix of @big`))
(t (iflet ((pos (search-str big small)))
(put-line `@small occurs in @big at position @pos`)
(put-line `@small does not occur in @big`)))))
(otherwise
(put-line `usage: @(ldiff *full-args* *args*) <bigstring> <smallstring>`)))