Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
#lang racket
|
||||
|
||||
;; Using a combination of the two comparisons
|
||||
(define (sort1 words)
|
||||
(sort words (λ(x y)
|
||||
(define xl (string-length x)) (define yl (string-length y))
|
||||
(or (> xl yl) (and (= xl yl) (string-ci<? x y))))))
|
||||
(sort1 '("Some" "pile" "of" "words"))
|
||||
;; -> '("words" "pile" "Some" "of")
|
||||
|
||||
;; Doing two sorts, relying on `sort's stability
|
||||
(define (sort2 words)
|
||||
(sort (sort words string-ci<?) > #:key string-length))
|
||||
(sort2 '("Some" "pile" "of" "words"))
|
||||
;; -> '("words" "pile" "Some" "of")
|
||||
Loading…
Add table
Add a link
Reference in a new issue