-- -- INITIAL PROGRAM for experiment in 'Image classification by evolving bytecode' -- let SingleLoad data => { let addr => % ; WAIT addr $ ![ data ]; emit => [ LOAD addr | -- Load into public slot - ptr at split point. |> |> FLPD SPIN> SPIN ]; }; let defn passive_setup body => { let addr => % ; passive_setup SWAP FLIP $ ![ WAIT addr | body RTRN LOOP ]; emit => [ CALL addr | ]; }; let remote body => defn [] body; let add1 => defn [ INS1> ] [ ADDD ]; let forward2 => |> |> ; let back => SPIN> SPIN; let trim2 => DEL1> DEL1>; let forward_passive => SWAP> SWAP ; let back_passive => SWAP SPIN> SPIN SWAP ; let while passive_setup body => { let addr => % ; passive_setup SWAP WAIT addr | FLIP $ ![ body ]; emit => [ CALL addr | ]; }; let break => RTRN ; let continue => LOOP ; let magic_number => defn [ SingleLoad [ #d27 #d114 ] ] [ PULL> forward_passive PULL back_passive ] ; let get_57 => defn [ SingleLoad [ #d57 ] ] [ PULL> ] ; let mask_even => defn [ SingleLoad [ #b10101010 ] ] [ ANDD ] ; let mask_odd => defn [ SingleLoad [ #b01010101 ] ] [ ANDD ] ; let load_line => SWAP INJA INJA SPLC SWAP ; let reduce_along_row body => while [ SingleLoad [ #d1 #d13 ] ] [ body PULL> -- pulls iteration counter. forward_passive LEQD back_passive -- checks still less that #d12 COND FLIP break -- if looped through all pairs. ![ SWAP add1 SWAP -- increment iterator counter. FLIP ] continue ]; let first_reducer => |> SWAP PULL> add1 ROTL SWAP DEL1> DEL1> back ORRD SWAP DEL1 SWAP -- clean up after ORRD. DUP1> -- this is going to be the COND byte. SWAP get_57 SWAP COND FLIP mask_even ![ mask_odd FLIP ] ; INS1> NOTF -- initial accumulator. load_line -- injest first line. reduce_along_row [ remote [ first_reducer ] ] load_line reduce_along_row [ remote [ first_reducer ] ] load_line -- injest first line. reduce_along_row [ remote [ first_reducer ] ] load_line reduce_along_row [ remote [ first_reducer ] ] load_line reduce_along_row [ remote [ first_reducer ] ] load_line reduce_along_row [ remote [ first_reducer ] ] load_line -- injest first line. reduce_along_row [ remote [ first_reducer ] ] load_line reduce_along_row [ remote [ first_reducer ] ] load_line reduce_along_row [ remote [ first_reducer ] ] load_line reduce_along_row [ remote [ first_reducer ] ] load_line -- injest first line. reduce_along_row [ remote [ first_reducer ] ] load_line reduce_along_row [ remote [ first_reducer ] ] load_line reduce_along_row [ remote [ first_reducer ] ] SWAP magic_number |> SWAP back SPLC SWAP SCRA;