Skip to content

Commit aa3bc34

Browse files
authored
Merge pull request #37 from yuyichao/boxless
Workaround box created by closure lowering
2 parents 075c867 + 6935eb2 commit aa3bc34

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/permutations.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ end
3636
start(p::Permutations) = [1:length(p.a);]
3737
next(p::Permutations, s) = nextpermutation(p.a, p.t ,s)
3838

39-
function nextpermutation(m, t, s)
40-
perm = [m[s[i]] for i in 1:t]
41-
n = length(s)
39+
function nextpermutation(m, t, state)
40+
perm = [m[state[i]] for i in 1:t]
41+
n = length(state)
4242
if t <= 0
4343
return(perm, [n+1])
4444
end
45-
s = copy(s)
45+
s = copy(state)
4646
if t < n
4747
j = t + 1
4848
while j <= n && s[t] >= s[j]; j+=1; end

test/permutations.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ using Base.Test
1919
@test collect(permutations("", 0)) == Any[Char[]]
2020
@test collect(permutations("", -1)) == Any[]
2121

22+
@inferred first(permutations("abc", 2))
23+
2224
# multiset_permutations
2325
@test collect(multiset_permutations("aabc", 5)) == Any[]
2426
@test collect(multiset_permutations("aabc", 2)) == Any[['a','a'],['a','b'], ['a','c'],['b','a'],

0 commit comments

Comments
 (0)