Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Gray-code/Quackery/gray-code.quackery
Normal file
22
Task/Gray-code/Quackery/gray-code.quackery
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[ dup 1 >> ^ ] is encodegray ( n --> n )
|
||||
|
||||
[ dup
|
||||
[ dip [ 1 >> ]
|
||||
over ^
|
||||
over 0 = until ]
|
||||
nip ] is decodegray ( n --> n )
|
||||
|
||||
[ [] unrot times
|
||||
[ 2 /mod char 0 +
|
||||
rot join swap ]
|
||||
drop echo$ ] is echobin ( n n --> )
|
||||
|
||||
|
||||
say "number encoded decoded" cr
|
||||
say "------ ------- -------" cr
|
||||
32 times
|
||||
[ sp i^ 5 echobin
|
||||
say " -> "
|
||||
i^ encodegray dup 5 echobin
|
||||
say " -> "
|
||||
decodegray 5 echobin cr ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue