Odd word problem: Difference between revisions

Added Quackery.
(Added Delphi example)
(Added Quackery.)
Line 2,256:
break
coro = coro.send(c)</lang>
 
=={{header|Quackery}}==
 
It is not possible to comply with the requirements of this task ''to the letter'' as the task presumes the existence of an ''implicit'' stack, e.g. a stack frame storing state information during subroutine calls, including recursive calls. In Quackery such information is stored on a second stack (usually referred to as ''the stack'') which is ''explicit''.
 
Also, there is no character-at-a-time input stream mechanism implemented in Quackery. To approximate this, the word <code>behead</code> returns successive characters from a string. Comparing the string to an empty string is equivalent to testing for end-of-input-stream.
 
Therefore this solution is in the spirit of the requirements, if not the letter.
 
<lang Quackery>[ upper dup lower != ] is letter ( c --> b )
 
forward is backwords ( $ --> $ )
 
[ dup $ "" = if done
[ behead dup letter while
emit again ]
emit backwords ] is forwords ( $ --> $ )
 
[ dup $ "" = if done
[ behead dup letter while
swap recurse
rot emit ]
emit forwords ] resolves backwords ( $ --> $ )
 
[ forwords drop cr ] is oddwords ( $ --> )
 
$ "we,are;not,in,kansas;any,more." oddwords
$ "what,is,the;meaning,of:life." oddwords</lang>
 
{{out}}
 
<pre>we,era;not,ni,kansas;yna,more.
what,si,the;gninaem,of:efil.</pre>
 
=={{header|Racket}}==
1,496

edits