From 229d0e0549d47040499b72820898726875648c43 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 18 Apr 2012 14:43:08 -0700 Subject: [PATCH] math.combinators: Add map-permutation --- basis/math/combinatorics/combinatorics.factor | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/basis/math/combinatorics/combinatorics.factor b/basis/math/combinatorics/combinatorics.factor index 23638b0be6..962a2888d0 100644 --- a/basis/math/combinatorics/combinatorics.factor +++ b/basis/math/combinatorics/combinatorics.factor @@ -55,6 +55,10 @@ PRIVATE> [ [ length factorial iota ] keep ] dip '[ _ permutation @ ] each ; inline +: map-permutation ( seq quot -- ) + [ [ length factorial iota ] keep ] dip + '[ _ permutation @ ] map ; inline + : reduce-permutations ( seq identity quot -- result ) swapd each-permutation ; inline