From be64e1a00f6c14c15bf85f4fcf6f81a4d92fdc4b Mon Sep 17 00:00:00 2001 From: Miles Frain Date: Tue, 17 Sep 2019 17:39:25 -0700 Subject: [PATCH] simplify combination reorder --- src/combinations.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/combinations.jl b/src/combinations.jl index 60f449f..8912860 100644 --- a/src/combinations.jl +++ b/src/combinations.jl @@ -45,8 +45,8 @@ function combinations(a, t::Integer) # generate 0 combinations for negative argument t = length(a) + 1 end - reorder(c) = [a[ci] for ci in c] - (reorder(c) for c in Combinations(length(a), t)) + # generate all reorderings of 'a' based on combinations of indexes + (a[c] for c in Combinations(length(a), t)) end