Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,23 @@
import "io" for Stdin, Stdout
import "/pattern" for Pattern
import "/seq" for Lst
System.print("Please enter a multi-line story template terminated by a blank line:\n")
Stdout.flush()
var story = ""
while (true) {
var line = Stdin.readLine()
if (line.isEmpty) break
story = story + line + "\n" // preserve line breaks
}
// identify blanks
var p = Pattern.new("<+0^>>")
var blanks = Lst.distinct(p.findAll(story).map { |m| m.text }.toList)
System.print("Please enter your replacements for the following 'blanks' in the story:")
for (blank in blanks) {
System.write(" %(blank[1..-2]) : ")
Stdout.flush()
var repl = Stdin.readLine()
story = story.replace(blank, repl)
}
System.print("\n%(story)")