pack t (n:ns) =
    let t' = if (member n t)
             then update (\v -> Just(v+1)) n t
             else insert n 1 t
    in
        pack t' ns
pack t (n:ns) =
    let t' = if (member n t)
             then update (\v -> Just(v+1)) n t
             else insert n 1 t
    in
        pack t' ns
pack t (n:ns) =
    let t' = if (member n t)
             then update (\v -> Just(v+1)) n t
             else insert n 1 t
    in
        pack t' ns