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:
"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>@(
("IK" "I know an old lady who swallowed a") ("SW" "She swallowed
"I don't know how she swallowed the cow"▼
("C" "cow") ("G" "goat") ("D" "dog") ("T" "cat") ("B" "bird")
("S" "spider") ("F" "fly"))
@(bind lastverse
▲ "She swallowed the dog to catch the cat"
("IK C"
"
"SW C CA G"
"SW G CA D"
"
"SW T CA B"
"SW B CA S"
"SW S CA F"
"XX"
""
"
"She's alive and well of course!"))
@(bind animal_line
("
"
"
"
"
"
@(define expand_backwards (song lengthened_song done))
@ (local line2 line3 verse rest animal previous_animal previous_animal_verse)
@ (next :list song)
@ (cases)
IK @animal
@line2
@ (maybe)
But
@ (end)
@ (collect)
Line 701 ⟶ 706:
@previous_animal: @previous_animal_verse
@ (output :into lengthened_song)
@previous_animal_verse
@ (repeat)
Line 713 ⟶ 718:
@ (bind done nil)
@ (or)
@line2
XX
@ (bind lengthened_song song)
@ (bind done t)
Line 731 ⟶ 736:
@(end)
@(expand_song lastverse song)
@(output :filter abbr)
@ (repeat)
@song
|