RosettaCodeData/Task/Gray-code/Ursala/gray-code.ursala

13 lines
339 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
#import std
#import nat
xor = ~&Y&& not ~&B # either and not both
btog = xor*+ zipp0@iitBX # map xor over the argument zipped with its shift
gtob = ~&y+ =><0> ^C/xor@lrhPX ~&r # fold xor over the next input with previous output
#show+
test = mat` * 2-$'01'***K7xSS pad0*K7 <.~&,btog,gtob+ btog>* iota32