diff options
author | Yann Herklotz <git@yannherklotz.com> | 2021-12-22 18:34:27 +0100 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2021-12-22 18:34:27 +0100 |
commit | 310d8d21bfc8a024c9a469a1f39a2370008fd9ea (patch) | |
tree | 3a74bb424c2ffd1be2b8c59cf0dc36316e560760 /src/common.lisp | |
parent | 8572c23e969af73092fe99a0e89b4f94159cb032 (diff) | |
download | aoc21-310d8d21bfc8a024c9a469a1f39a2370008fd9ea.tar.gz aoc21-310d8d21bfc8a024c9a469a1f39a2370008fd9ea.zip |
Add day 5 to aoc
Diffstat (limited to 'src/common.lisp')
-rw-r--r-- | src/common.lisp | 5 |
1 files changed, 5 insertions, 0 deletions
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))) |