Odd word problem/SimpleCoroutineSupportForJ: Difference between revisions

m
no edit summary
(Created page with "Here is a simplistic coroutine implementation for J. Note that this version does not support switching between coroutine contexts -- that would have been an unnecessary complica...")
 
mNo edit summary
Line 11:
context=. verb noun
select. (0 {:: context) * 1+*#stack
case. 0 do. NB. yield
stack=. stack, 2 { context
verb=. (3 { context)`:0
noun=. 1 {:: context
case. 1 do. NB. return (with empty stack)
1 {:: context return.
case. 2 do. NB. return (with work remaining on stack)
verb=. ({: stack)`:0
noun=. 1 {:: context
6,962

edits