func (s Account) Subtract(s2 Account) Account {
	out := Account{}

	// iterate over keys in 1st
	for ident, sAmount := range s {
		if s2Amount, ok := s2[ident]; ok {
			out[ident] = sAmount.Subtract(s2Amount)
		} else {
			out[ident] = sAmount
		}
	}

	// iterate over missed keys in 2nd
	for ident, s2Amount := range s2 {
		if _, ok := out[ident]; !ok {
			out[ident] = s2Amount.Inverse()
		}
	}

	return out
}
// Subtract one bank of currencies from another (piecewise)
Subtract one bank of currencies from another (piecewise)
// Subtract one bank of currencies from another ( piecewise )
func (s Account) Subtract(s2 Account) Account {
	out := Account{}
	for ident, sAmount := range s {
		if s2Amount, ok := s2[ident]; ok {
			out[ident] = sAmount.Subtract(s2Amount)
		} else {
			out[ident] = sAmount
		}
	}
	for ident, s2Amount := range s2 {
		if _, ok := out[ident]; !ok {
			out[ident] = s2Amount.Inverse()
		}
	}
	return out
}
func ( s Account ) Subtract ( s2 Account ) Account { out := Account { } for ident , sAmount := range s { if s2Amount , ok := s2 [ ident ] ; ok { out [ ident ] = sAmount . Subtract ( s2Amount ) } else { out [ ident ] = sAmount } } for ident , s2Amount := range s2 { if _ , ok := out [ ident ] ; ! ok { out [ ident ] = s2Amount . Inverse ( ) } } return out }
Subtract one bank of currencies from another (piecewise)
Subtract one bank of currencies from another ( piecewise )
// iterate over keys in 1st // iterate over missed keys in 2nd