// Choose the earliest nonexpired lot with sufficient stock for an unsplit order. Ties preserve input order. pub fn shelf_life_pick(expires: vector, stock: vector, day: f64, need: f64) -> i64 { if len(expires)!=len(stock) || need <= 0.0 { return -1; } let mut choice = -1; let mut i = 0; while i=day && at(stock,i)>=need { if choice<0 { choice = i; } else { if at(expires,i)