P
Peter Bunyan
Once again, a problem with my Befunge interpreter. I'm trying to
implement the ~ and & functions - get a character and a number,
respectively. My & function looks like this:
instructions["&"] = lambda { print "Number: "; stack.push
gets().strip.to_i}
But it complains about gets() being nil. as soon as the function is run.
Well, of course it is. It has let me type. Is there anyway to make it
halt?
Why does Ruby keep picking on me? Oh, wait. The principle of least
surprise - all programming languages infuriate me, therefore it would
surprise me least if Ruby did too.
Attachments:
http://www.ruby-forum.com/attachment/1108/befunge.rb
implement the ~ and & functions - get a character and a number,
respectively. My & function looks like this:
instructions["&"] = lambda { print "Number: "; stack.push
gets().strip.to_i}
But it complains about gets() being nil. as soon as the function is run.
Well, of course it is. It has let me type. Is there anyway to make it
halt?
Why does Ruby keep picking on me? Oh, wait. The principle of least
surprise - all programming languages infuriate me, therefore it would
surprise me least if Ruby did too.
Attachments:
http://www.ruby-forum.com/attachment/1108/befunge.rb