From 2c192f10cae417bdff4ca126d0d82bdc1b82506e Mon Sep 17 00:00:00 2001 From: Patrick Hammer Date: Wed, 11 Mar 2026 03:11:03 +0100 Subject: [PATCH 1/2] lib_patrick.metta: fixed recursion in function composition, logicprogset.metta: use if there to generate only if condition is met --- examples/logicprogset.metta | 4 ++-- lib/lib_patrick.metta | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/logicprogset.metta b/examples/logicprogset.metta index b8e528c..a797f87 100644 --- a/examples/logicprogset.metta +++ b/examples/logicprogset.metta @@ -1,7 +1,7 @@ (= (myf $M) (and (and (member a $M) (member b $M)) - (== (size-atom $M) 3))) + (== (size-atom $M) 2))) -!(test (let $constraint (once (myf $M)) $M) +!(test (if (once (myf $M)) $M) (a b)) diff --git a/lib/lib_patrick.metta b/lib/lib_patrick.metta index ca9de2f..be4149e 100644 --- a/lib/lib_patrick.metta +++ b/lib/lib_patrick.metta @@ -5,7 +5,7 @@ (if (== (length $args) 1) ;optimization for single arg, avoids (let ($arg) $args ($f $arg)) ;reduce for function call (let $func (cons $f $args) (reduce $func))) - ($f (. $rest $args)))) + ($f (cons $rest $args)))) ;Reverse Function Matching (= (@ $a $b) (let $a $b $a)) From 5739d7e6f36c8db897d929630777567c07e0e6f3 Mon Sep 17 00:00:00 2001 From: Patrick Hammer Date: Wed, 11 Mar 2026 03:14:15 +0100 Subject: [PATCH 2/2] lib_patrick.metta: fixed recursion in function composition, logicprogset.metta: use if there to generate only if condition is met --- lib/lib_patrick.metta | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lib_patrick.metta b/lib/lib_patrick.metta index be4149e..b01e139 100644 --- a/lib/lib_patrick.metta +++ b/lib/lib_patrick.metta @@ -5,7 +5,7 @@ (if (== (length $args) 1) ;optimization for single arg, avoids (let ($arg) $args ($f $arg)) ;reduce for function call (let $func (cons $f $args) (reduce $func))) - ($f (cons $rest $args)))) + ($f (compose $rest $args)))) ;Reverse Function Matching (= (@ $a $b) (let $a $b $a))