parent
798618f6a6
commit
e7f2331663
|
@ -125,3 +125,40 @@
|
|||
(check-equal? (f 1 0 3 4) (list 1 0 3 4))
|
||||
(check-equal? (f 0 2 3 4) (list 0 2 3 4))
|
||||
(check-equal? (f 0 2 3 4) (list 0 2 3 4))
|
||||
|
||||
(check-equal? (n->th 0) "0th")
|
||||
(check-equal? (n->th 1) "1st")
|
||||
(check-equal? (n->th 2) "2nd")
|
||||
(check-equal? (n->th 3) "3rd")
|
||||
(check-equal? (n->th 4) "4th")
|
||||
(check-equal? (n->th 5) "5th")
|
||||
(check-equal? (n->th 10) "10th")
|
||||
(check-equal? (n->th 11) "11th")
|
||||
(check-equal? (n->th 12) "12th")
|
||||
(check-equal? (n->th 13) "13th")
|
||||
(check-equal? (n->th 14) "14th")
|
||||
(check-equal? (n->th 15) "15th")
|
||||
(check-equal? (n->th 20) "20th")
|
||||
(check-equal? (n->th 21) "21st")
|
||||
(check-equal? (n->th 22) "22nd")
|
||||
(check-equal? (n->th 23) "23rd")
|
||||
(check-equal? (n->th 24) "24th")
|
||||
(check-equal? (n->th 25) "25th")
|
||||
(check-equal? (n->th 100) "100th")
|
||||
(check-equal? (n->th 101) "101st")
|
||||
(check-equal? (n->th 102) "102nd")
|
||||
(check-equal? (n->th 103) "103rd")
|
||||
(check-equal? (n->th 104) "104th")
|
||||
(check-equal? (n->th 105) "105th")
|
||||
(check-equal? (n->th 110) "110th")
|
||||
(check-equal? (n->th 111) "111th")
|
||||
(check-equal? (n->th 112) "112th")
|
||||
(check-equal? (n->th 113) "113th")
|
||||
(check-equal? (n->th 114) "114th")
|
||||
(check-equal? (n->th 115) "115th")
|
||||
(check-equal? (n->th 120) "120th")
|
||||
(check-equal? (n->th 121) "121st")
|
||||
(check-equal? (n->th 122) "122nd")
|
||||
(check-equal? (n->th 123) "123rd")
|
||||
(check-equal? (n->th 124) "124th")
|
||||
(check-equal? (n->th 125) "125th")
|
||||
|
|
|
@ -961,11 +961,14 @@
|
|||
(define (n->th n)
|
||||
(string-append
|
||||
(number->string n)
|
||||
(case (remainder n 100)
|
||||
[(11 12 13) "th"]
|
||||
[else
|
||||
(case (modulo n 10)
|
||||
[(1) "st"]
|
||||
[(2) "nd"]
|
||||
[(3) "rd"]
|
||||
[else "th"])))
|
||||
[else "th"])])))
|
||||
|
||||
(define (nth-element-of/alloc n)
|
||||
(format "the ~a element of" (n->th n)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user