#!/usr/bin/env python3
#
#  Remove duplicate lines.
#
#  Similar to the Unix "uniq" command, read lines from stdin and
#  output if it is not the same as the previous line.

import spawk
import sys

t = spawk.Spawk(sys.stdin)

t.context.lastline = None


@t.eval('lastline != line')
def unique(ctx, line):
    sys.stdout.write(line)
    ctx.lastline = line

t.run()
