All pastes #945165 Raw Edit

asd

public java v1 · immutable
·published 2008-03-16 19:03 UTC
rendered paste body
% This is a commentfunction permutate(sequence)% yield here, equals returning from next() in Java code    is sequence empty?        yield the empty sequence    for i = 0 then i + 1 while i < sequence.length% sequence.subsequence(int start, int stop)% assumed to return the subsequence that goes from element start (inclusive) to stop (exclusive)% sequence.subsequence(int start)% assumed to return the subsequence that starts in index start and ends at the end of the sequence        n = sequence.subsequence(i, i + 1) % This gives us one element in a sequence        for every subsequence m in permutate(sequence.subsequence(0, i).concatenate(sequence.subsequence(i + 1))            yield n.concatenate(m)    stopIteration() % This equals setting the value of the next hasNext() call to false