< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous (in thread)
N :the next (in thread)
|<:the top of this thread
>|:the next thread
^ :the parent (reply-to)
_:the child (an article replying to this)
>:the elder article having the same parent
<:the youger article having the same parent
---:split window and show thread lists
| :split window (vertically) and show thread lists
~ :close the thread frame
.:the index
..:the index of indices
I'll resubmit my entry,
- fixed typo "initialize"
- cleaner exit from message passing code
regards,
-tom
#!/usr/bin/env ruby
# vim:et:ts=4:sw=4
$n = 0 if $DEBUG
class RLWP
def initialize
@nxt = nil
end
attr_accessor :nxt
def makecont
passesleft, message = callcc { |cont|
return cont
}
if passesleft <= 0
puts $n if $DEBUG
throw :DONE
end
$n += 1 if $DEBUG
@nxt.call(passesleft - 1, message)
end
end
def run(n, cycles, msg)
catch(:DONE) {
process = Array.new(n) { RLWP.new }
cont = process.collect { |p| p.makecont }
process.each_with_index { |p,i| p.nxt = cont[(i+1) % n] }
cont[0].call(n * cycles, msg)
}
end
run ARGV[0].to_i, ARGV[1].to_i, "xyzzy"