From 310d8d21bfc8a024c9a469a1f39a2370008fd9ea Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 22 Dec 2021 18:34:27 +0100 Subject: Add day 5 to aoc --- src/common.lisp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/common.lisp') diff --git a/src/common.lisp b/src/common.lisp index 2c56184..c9e6e8b 100644 --- a/src/common.lisp +++ b/src/common.lisp @@ -15,3 +15,8 @@ (defun trim (input) (string-trim '(#\Space #\Newline #\Backspace #\Tab #\Linefeed #\Page #\Return #\Rubout) input)) + +(defun fold-left (reducer initial list) + (loop for fold = initial then (funcall reducer fold element) + for element in list + finally (return fold))) -- cgit