22 lines
711 B
Text
22 lines
711 B
Text
procedure main()
|
|
every OddWord(!["what,is,the;meaning,of:life.",
|
|
"we,are;not,in,kansas;any,more."])
|
|
end
|
|
|
|
procedure OddWord(stream) #: wrapper for demonstration
|
|
write("Input stream: ",stream)
|
|
writes("Output stream: ") & eWord(create !stream,'.,;:') & write()
|
|
end
|
|
|
|
procedure eWord(stream,marks) #: handle even words
|
|
repeat {
|
|
repeat
|
|
writes(@stream) ? if ="." then return else if any(marks) then break
|
|
if writes(oWord(stream,marks)) == '.' then return
|
|
}
|
|
end
|
|
|
|
procedure oWord(stream,marks) #: handle odd words (reverse)
|
|
if any(marks,s := @stream) then return s
|
|
return 1(oWord(stream,marks), writes(s))
|
|
end
|