pop s n =
  if (length (tmp s)) < n
    then Stack (stack s) [] ((gap s) - (n - (length (tmp s))))
    else Stack (stack s) (drop n (tmp s)) (gap s)
pop s n =
  if (length (tmp s)) < n
    then Stack (stack s) [] ((gap s) - (n - (length (tmp s))))
    else Stack (stack s) (drop n (tmp s)) (gap s)
pop s n =
  if (length (tmp s)) < n
    then Stack (stack s) [] ((gap s) - (n - (length (tmp s))))
    else Stack (stack s) (drop n (tmp s)) (gap s)