September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
15
Task/Odd-word-problem/Zkl/odd-word-problem-1.zkl
Normal file
15
Task/Odd-word-problem/Zkl/odd-word-problem-1.zkl
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
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();
|
||||
}
|
||||
2
Task/Odd-word-problem/Zkl/odd-word-problem-2.zkl
Normal file
2
Task/Odd-word-problem/Zkl/odd-word-problem-2.zkl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
oddly("what,is,the;meaning,of:life.");
|
||||
oddly(Data(0,String,"we,are;not,in,kansas;any,more."));
|
||||
Loading…
Add table
Add a link
Reference in a new issue