The Twelve Days of Christmas: Difference between revisions
m
→{{header|Scheme}}: Reformat; removed square brackets which are not part of standard Scheme
(→{{header|Scheme}}: Add implementation) |
m (→{{header|Scheme}}: Reformat; removed square brackets which are not part of standard Scheme) |
||
Line 4,851:
=={{header|Scheme}}==
Without Common Lisp's <tt>format</tt>, we sadly have to hard-code the list of ordinals.
<lang scheme>(define take (lambda
(let
((days '("first" "second" "third" "fourth" "fifth" "sixth" "seventh"
"eighth" "ninth" "tenth" "eleventh" "twelfth"))
(gifts '("A partridge in a pear tree." "Two turtle doves, and"
"Three French hens," "Four calling birds,"
Line 4,863 ⟶ 4,865:
"Seven swans a-swimming," "Eight maids a-milking,"
"Nine ladies dancing," "Ten lords a-leaping,"
"Eleven pipers piping," "Twelve drummers drumming,"
(day 1 (
(display (car left))▼
(display (car
(display " day of Christmas, my true love sent to me:")
(do ((daily (reverse (take day gifts)) (
(
(newline))
(newline)))
(exit)</lang>
|