From 36c69053558d1c81375a780480c3b4cc8a57be73 Mon Sep 17 00:00:00 2001 From: "Andreas Koepf (aider)" Date: Thu, 23 Jan 2025 14:07:18 +0100 Subject: [PATCH] fix: Correct rule composition in PatternRule to properly chain subrules --- reasoning_gym/cognition/sequences.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reasoning_gym/cognition/sequences.py b/reasoning_gym/cognition/sequences.py index c1d6d4f0..55288e36 100644 --- a/reasoning_gym/cognition/sequences.py +++ b/reasoning_gym/cognition/sequences.py @@ -64,10 +64,10 @@ class PatternRule: if position > 0: result += sequence[position - 1] elif op == Operation.COMPOSE: - # Apply each subrule in sequence - temp_sequence = sequence[:position + 1] - temp_sequence[-1] = result # Use current result as input + # Apply each subrule in sequence, passing the result through for subrule in self.subrules: + temp_sequence = sequence[:position + 1] + temp_sequence[-1] = result # Use current result as input result = subrule.apply(temp_sequence, position) return result