11.fs (593B) - raw
1 begin-structure monkey 2 16 +field items 3 \ all xts 4 field: operation 5 field: test 6 field: next-monkey 7 end-structure 8 9 : monkeyarr ( u -- ) create monkey * allot 10 does> ( u -- a ) swap monkey * + ; 11 12 8 monkeyarr monkeys 13 14 variable monkeyptr 15 : Monkey [char] : word number monkeys monkeyptr ! ; 16 : Starting 0 bl word drop begin [char] , word number drop 0= until drop ; 17 18 variable (old) 19 : old (old) @ ; 20 : = noop ; 21 \ make operators infix (lol) 22 : + bl word number + ; 23 : * bl word number * ; 24 : Operation: ( build execution token ) monkeyptr operation !; 25 : Test: ; 26 : If ; 27 28 include sample.txt 29 30 : run ; 31 run