// Yes the nomenclature is a bit illogical
static Chain chainPlus(Chain chain, A a) {
ret Chain(a, chain);
}
static Chain chainPlus(Chain chain, A... l) {
fOr (A a : l)
chain = chainPlus(chain, a);
ret chain;
}
static ReverseChain chainPlus(ReverseChain chain, A a) {
ret ReverseChain(chain, a);
}
static ReverseChain chainPlus(ReverseChain chain, A... l) {
fOr (A a : l)
chain = chainPlus(chain, a);
ret chain;
}
ifclass AppendableChain
static AppendableChain chainPlus(AppendableChain chain, A a) {
if (chain == null) ret new AppendableChain(a);
chain.add(a);
ret chain;
}
static AppendableChain chainPlus(AppendableChain chain, A... l) {
fOr (A a : l)
chain = chainPlus(chain, a);
ret chain;
}
endif