SetDirectory["C:/drorbn/AcademicPensieve/Projects/Arrow_Diagrams_and_gl(N)"];
<< "Arrow_Diagrams_and_gl(N).m"

diag = Diag[ar[1,8],ar[3,5],ar[6,4],ar[7,2]]

FromDigits[Cases[diag, _Integer, Infinity], sbase]

SaveUSO[diag_Diag] := Module[
{fname},
fname= StringJoin[
"USOFor",
ToString[FromDigits[Cases[diag, _Integer, Infinity], sbase]],
".m"
];
Print["Saving ", fname, " ..."];
Put[{diag, USO[diag]}, fname];
]

BasisAArrow[2]

SaveUSO /@ BasisAArrow[2]

BasisAArrow[3] // First

SaveUSO[Diag[ar[4,1],ar[5,3],ar[6,2]]]

SaveUSO[Diag[ar[1,8],ar[3,5],ar[6,4],ar[7,2]]]

Union[USO /@ BasisAArrow[2] /. n^4 -> 1 /. n -> 0]

Union[(USO /@ BasisAArrow[2]) /. {h[i_] :> x h[i], rsw_RSW :> x^Length[rsw]rsw} /. x^4 -> 1 /. x-> 0]

LeafCount[USO /@ BasisAArrow[2]]

LeafCount[(USO /@ BasisAArrow[2]) /. rsw_RSW /; Length[rsw]==4 :> 0]

(BasisAArrow[2] // First // USO) /. {h[i_] :> x h[i], rsw_RSW :> x^Length[rsw]rsw} /. x^4 -> 0 /. x-> 1

LeafCount[(USO /@ BasisAArrow[2]) /. {h[i_] :> x h[i], rsw_RSW :> x^Length[rsw]rsw} /. x^4 -> 0 /. x-> 1]

LeafCount[USO[BasisAArrow[3][[1]]]]

LeafCount[USO[BasisAArrow[3][[1]]] /. {h[i_] :> x h[i], rsw_RSW :> x^Length[rsw]rsw} /. x^6 -> 0 /. x-> 1]