Old lady swallowed a fly: Difference between revisions
Content added Content deleted
(→{{header|TXR}}: Added.) |
(→{{header|TXR}}: Compressed pieces of text a bit using abbreviations expanded by a filter.) |
||
Line 658: | Line 658: | ||
"that fly" not "the fly". So we do a lookup on the fly also to substitute the appropriate line, and in the fly case we skip the original line (see the first <code>@(maybe)</code>). |
"that fly" not "the fly". So we do a lookup on the fly also to substitute the appropriate line, and in the fly case we skip the original line (see the first <code>@(maybe)</code>). |
||
<lang txr>@( |
<lang txr>@(deffilter abbr |
||
("I know an old lady who swallowed a |
("IK" "I know an old lady who swallowed a") ("SW" "She swallowed the") |
||
⚫ | |||
⚫ | |||
("C" "cow") ("G" "goat") ("D" "dog") ("T" "cat") ("B" "bird") |
|||
"She swallowed the cow to catch the goat" |
|||
("S" "spider") ("F" "fly")) |
|||
"She swallowed the goat to catch the dog" |
|||
@(bind lastverse |
|||
⚫ | |||
("IK C" |
|||
"She swallowed the cat to catch the bird" |
|||
" |
"I don't know how SS the C" |
||
"SW C CA G" |
|||
"She swallowed the spider to catch the fly" |
|||
"SW G CA D" |
|||
"But I don't know why she swallowed that fly" |
|||
" |
"SW D CA T" |
||
"SW T CA B" |
|||
"SW B CA S" |
|||
"SW S CA F" |
|||
⚫ | |||
"XX" |
|||
"" |
"" |
||
" |
"IK horse" |
||
"She's alive and well of course!")) |
"She's alive and well of course!")) |
||
@(bind animal_line |
@(bind animal_line |
||
(" |
("G: Opened her throat and down went the G!" |
||
" |
"D: What a hog to swallow a D!" |
||
" |
"T: Imagine that! She swallowed a T!" |
||
" |
"B: How absurd to swallow a B!" |
||
" |
"S: That wriggled and jiggled and tickled inside her" |
||
" |
"F: But I don't know why SS the F")) |
||
@(define expand_backwards (song lengthened_song done)) |
@(define expand_backwards (song lengthened_song done)) |
||
@ (local line2 line3 verse rest animal previous_animal previous_animal_verse) |
@ (local line2 line3 verse rest animal previous_animal previous_animal_verse) |
||
@ (next :list song) |
@ (next :list song) |
||
@ (cases) |
@ (cases) |
||
IK @animal |
|||
I know an old lady who swallowed a @animal |
|||
@line2 |
@line2 |
||
SW @animal CA @previous_animal |
|||
@ (maybe) |
@ (maybe) |
||
But |
But @(skip)F |
||
@ (end) |
@ (end) |
||
@ (collect) |
@ (collect) |
||
Line 701: | Line 706: | ||
@previous_animal: @previous_animal_verse |
@previous_animal: @previous_animal_verse |
||
@ (output :into lengthened_song) |
@ (output :into lengthened_song) |
||
IK @previous_animal |
|||
@previous_animal_verse |
@previous_animal_verse |
||
@ (repeat) |
@ (repeat) |
||
Line 713: | Line 718: | ||
@ (bind done nil) |
@ (bind done nil) |
||
@ (or) |
@ (or) |
||
IK @(skip) |
|||
@line2 |
@line2 |
||
XX |
|||
Perhaps she'll die |
|||
@ (bind lengthened_song song) |
@ (bind lengthened_song song) |
||
@ (bind done t) |
@ (bind done t) |
||
Line 731: | Line 736: | ||
@(end) |
@(end) |
||
@(expand_song lastverse song) |
@(expand_song lastverse song) |
||
@(output) |
@(output :filter abbr) |
||
@ (repeat) |
@ (repeat) |
||
@song |
@song |