Quoted By:
The challenge is to write a Brainfuck interpreter in the fewest number of characters possible.
Stolen example was 280 characters in Clojure.
http://www.muppetlabs.com/~breadbox/bf/
Array size of 300 instead of 30,000.
> move to the next cell
< move to the previous cell
+ increment value in the current cell
- decrement value in the current cell
. print char with ascii value of current cell
, read ascii value for input char to the current cell
[ start loop until value of pointer is not zero
] finish loop
wc -c to count chars
Stolen example was 280 characters in Clojure.
(fn[a p k c](let[h #(nth %1@%2)e #(h a p)s #(swap! %1%2 1)t
#(aset a@p(%(e)1))l #(do(s k %)(case(h c k)\]()\[()(recur %)
))](while(>(count c)@k)(do(case(h c k)\>(s p +)\<(s p -)\+
(t +)\-(t -)\.(print(char(e)))\,(aset a@p(.read *in*))\[(if
(=(e)0)(l +))\](if(>(e)0)(l -)))(s k +)))))
http://www.muppetlabs.com/~breadbox/bf/
Array size of 300 instead of 30,000.
> move to the next cell
< move to the previous cell
+ increment value in the current cell
- decrement value in the current cell
. print char with ascii value of current cell
, read ascii value for input char to the current cell
[ start loop until value of pointer is not zero
] finish loop
wc -c to count chars