Simplified L.

Made L use list comprehensions instead of loops. Gave it a self-test.