Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Gray-code/K/gray-code-1.k
Normal file
8
Task/Gray-code/K/gray-code-1.k
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
xor: {~x=y}
|
||||
gray:{x[0],xor':x}
|
||||
|
||||
/ variant: using shift
|
||||
gray1:{(x[0],xor[1_ x;-1_ x])}
|
||||
|
||||
/ variant: iterative
|
||||
gray2:{x[0],{:[x[y-1]=1;~x[y];x[y]]}[x]'1+!(#x)-1}
|
||||
1
Task/Gray-code/K/gray-code-2.k
Normal file
1
Task/Gray-code/K/gray-code-2.k
Normal file
|
|
@ -0,0 +1 @@
|
|||
g2b:xor\
|
||||
9
Task/Gray-code/K/gray-code-3.k
Normal file
9
Task/Gray-code/K/gray-code-3.k
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
gray\1 0 0 0 0
|
||||
(1 0 0 0 0
|
||||
1 1 0 0 0
|
||||
1 0 1 0 0
|
||||
1 1 1 1 0
|
||||
1 0 0 0 1
|
||||
1 1 0 0 1
|
||||
1 0 1 0 1
|
||||
1 1 1 1 1)
|
||||
1
Task/Gray-code/K/gray-code-4.k
Normal file
1
Task/Gray-code/K/gray-code-4.k
Normal file
|
|
@ -0,0 +1 @@
|
|||
g2b1:*|{gray x}\
|
||||
1
Task/Gray-code/K/gray-code-5.k
Normal file
1
Task/Gray-code/K/gray-code-5.k
Normal file
|
|
@ -0,0 +1 @@
|
|||
g2b2:{c:#x;b:c#0;b[0]:x[0];i:1;do[#x;b[i]:xor[x[i];b[i-1]];i+:1];b}
|
||||
7
Task/Gray-code/K/gray-code-6.k
Normal file
7
Task/Gray-code/K/gray-code-6.k
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
gray:{x[0],xor':x}
|
||||
g2b:xor\
|
||||
/ using allcomb instead of 2_vs'!32 for nicer presentation
|
||||
allcomb:{+(x#y)_vs!_ y^x}
|
||||
a:(+allcomb . 5 2)
|
||||
`0:,/{n:2_sv x;gg:gray x;gb:g2b gg;n2:2_sv gb;
|
||||
,/$((2$n)," : ",$x," -> ",$gg," -> ",$gb," : ",(2$n2),"\n") }'a
|
||||
Loading…
Add table
Add a link
Reference in a new issue