Old lady swallowed a fly: Difference between revisions

Content added Content deleted
(→‎{{header|TXR}}: Compressed pieces of text a bit using abbreviations expanded by a filter.)
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>).
 
<lang txr>@(binddeffilter lastverseabbr
("IK" "I know an old lady who swallowed a") ("SW" "She swallowed cowthe")
("SS" "Sheshe swallowed") the dog("CA" "to catch the") ("XX" "Perhaps she'll catdie")
"I don't know how she swallowed the cow"
("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
"She swallowed the dog to catch the cat"
("IK C"
"She swallowed the cat to catch the bird"
"SheI swalloweddon't the birdknow tohow catchSS the spiderC"
"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"
"PerhapsSW she'llD dieCA T"
"SW T CA B"
"SW B CA S"
"SW S CA F"
"But I don't know how she swallowedwhy theSS cowF"
"XX"
""
"I know an old lady who swallowed aIK horse"
"She's alive and well of course!"))
@(bind animal_line
("goatG: Opened her throat and down went the goatG!"
"dogD: What a hog to swallow a dogD!"
"catT: Imagine that! She swallowed a catT!"
"birdB: How absurd to swallow a birdB!"
"spiderS: That wriggled and jiggled and tickled inside her"
"flyF: But I don't know why she swallowedSS the flyF"))
@(define expand_backwards (song lengthened_song done))
@ (local line2 line3 verse rest animal previous_animal previous_animal_verse)
@ (next :list song)
@ (cases)
IK @animal
I know an old lady who swallowed a @animal
@line2
She swallowed theSW @animal to catch theCA @previous_animal
@ (maybe)
But I don't@(skip)flyF
@ (end)
@ (collect)
Line 701 ⟶ 706:
@previous_animal: @previous_animal_verse
@ (output :into lengthened_song)
I know an old lady who swallowed aIK @previous_animal
@previous_animal_verse
@ (repeat)
Line 713 ⟶ 718:
@ (bind done nil)
@ (or)
I know an old ladyIK @(skip)
@line2
XX
Perhaps she'll die
@ (bind lengthened_song song)
@ (bind done t)
Line 731 ⟶ 736:
@(end)
@(expand_song lastverse song)
@(output :filter abbr)
@ (repeat)
@song