From d908db402dd129db66eb54006a1fb5b83c87edb3 Mon Sep 17 00:00:00 2001 From: Maltysen Date: Mon, 23 Oct 2017 15:40:01 -0400 Subject: [PATCH] Moved factorial to *F --- data.py | 1 - macros.py | 15 ++++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/data.py b/data.py index c2a21ac..ffd34d2 100644 --- a/data.py +++ b/data.py @@ -153,7 +153,6 @@ '.+': ('deltas', 1), '.:': ('substrings', 2), '.{': ('Pset', 1), - '.!': ('factorial', 1), '.[': ('pad', 3), } diff --git a/macros.py b/macros.py index b0cbe98..21f5b06 100755 --- a/macros.py +++ b/macros.py @@ -183,14 +183,15 @@ def repeat(func, start, repetitions): # F on binary function. Fold. def fold(func, lst): - if not lst: - # '*' - if func == environment[c_to_f['*'][0]]: + if func == environment[c_to_f['*'][0]]: + if not lst: return 1 - else: - return 0 - else: - return reduce2(func, lst) + if not is_col(lst): + return factorial(lst) + + if not lst: + return 0 + return reduce2(func, lst) environment['fold'] = fold