From 115121ec9faf8d651358d54b7427a5e021c1169f Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Tue, 29 Jul 2025 09:04:23 +0200 Subject: [PATCH] util:curry: fix: only fn as parameter --- test/test-core.lisp | 4 ++-- util/util.lisp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/test-core.lisp b/test/test-core.lisp index 8b7dd3c..5b69df6 100644 --- a/test/test-core.lisp +++ b/test/test-core.lisp @@ -72,8 +72,8 @@ (t:show-result)))) (deftest test-util () - (let* ((25+ (util:curry #'+ 25)) - (35+ (util:curry 25+ 10))) + (let* ((25+ (funcall (util:curry #'+) 25)) + (35+ (funcall (util:curry 25+) 10))) (== (funcall 35+ 7) 42)) (let ((now (get-universal-time))) (== (util:from-unix-time (util:to-unix-time now)) now)) diff --git a/util/util.lisp b/util/util.lisp index aca0a0a..6f7d181 100644 --- a/util/util.lisp +++ b/util/util.lisp @@ -22,8 +22,9 @@ ;;;; functional tools -(defun curry (fn a) - (lambda (&rest args) (apply fn a args))) +(defun curry (fn) + (lambda (a) + (lambda (&rest args) (apply fn a args)))) ;;;; formatting and logging shortcuts