require 'noofakku'
input = -> { 0 }
produced = ''
output = ->value { produced << value }
# will print "Hello World!\n"
program = '++++++++++[>+++++++>++++++++++>+++>'
program << '+<<<<-]>++.>+.+++++++..+++.>++.<<++'
program << '+++++++++++++.>.+++.------.--------.>+.>.'
Noofakku::VM.start(program, input, output)
p produced #=> "Hello World!\n"
require 'noofakku'
to_be_sorted = [5, 3, 2, 6, 0].each
input = -> { to_be_sorted.next }
produced = []
output = ->value { produced << value }
# will sort the zero-ended array in input
program = '>>,[>>,]<< [[-<+<]>[>[>>]<[.[-]<[[>>+<<-]<]>>]>]<<]'
Noofakku::VM.start(program, input, output)
p produced #=> [2, 3, 5, 6]
Other usage samples can be found in https://github.com/mcodella/noofakku/blob/master/test/noofakku_smoke_test.rb