cnb <[EMAIL PROTECTED]> writes:
> perms([]) -> [[]];
> perms(L)  -> [[H|T] || H <- L, T <- perms(L--[H])].

I think the most direct transcription might be:

    def perms(xs):
        if len(xs)==0: return [[]]
        return [([h]+t) for h in xs 
                for t in perms([y for y in xs if y not in [h]])]

But it is rather inefficient, as is the Erlang version.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to