News for hackers. Stuff that matters.
Re:N-queen puzzle in 4 lines of Scala by Rangi42 on Sunday April 10, 2016 @05:24PM (#11468243)
Python 3's `yield from` lets you write that in one statement:

    def n_queens(n):
        yield from (p for p in permutations(range(n))
            if len({c + i for i, c in enumerate(p)}) ==
                len({c - i for i, c in enumerate(p)}) == n)
It also illustrates how much neater list comprehensions can be in Python versus map/filter since its lambda functions are fairly verbose (even though there's a straightforward correspondence between them):

    def n_queens(n):
        return filter(lambda p:
            len(set(map(lambda x: x[1] + x[0], enumerate(p)))) ==
                len(set(map(lambda x: x[1] - x[0], enumerate(p)))) == n,
            permutations(range(n)))
Re:N-queen puzzle in 4 lines of Scala by Veedrac on Sunday April 10, 2016 @05:30PM (#11468279)
Or you can just `return (p for p in ...)`.