15 lines
566 B
Text
15 lines
566 B
Text
var [const] delim=",:;/?!@#$%^&*()_+", stop=".";
|
|
fcn oddly(inStream){
|
|
inStream=inStream.walker(3); // character iterator: string, file, etc
|
|
doWord:=fcn(inStream,rev,f){ // print next word forewards or reverse
|
|
c:=inStream.next();
|
|
if(not rev) c.print();
|
|
if(not (c==stop or delim.holds(c)))
|
|
return(self.fcn(inStream,rev,'{ c.print(); f(); }));
|
|
if(rev){ f(); c.print(); }
|
|
return(c!=stop);
|
|
};
|
|
tf:=Walker.cycle(False,True); // every other word printed backwords
|
|
while(doWord(inStream, tf.next(), Void)) {}
|
|
println();
|
|
}
|