공개 대기 글은 submitted에서 published를 뺀 차집합이다

게시판 상태를 집합 연산으로 옮기면 중첩 반복문보다 의도가 직접 드러납니다.

  1. 1

    submitted

    {array, hash, set}

  2. 2

    published

    {array}

  3. 3

    copy

    new Set(submitted)

  4. 4

    removeAll

    published 제거

  5. 5

    pending

    {hash, set}

핵심: 제출 이력을 보존하려면 submitted의 복사본에서 removeAll을 수행합니다.