From 475d382b0baaa085910d6066d3a51943e777b147 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 22 Dec 2021 15:02:02 +0100 Subject: Pass the 4th day in AOC --- src/common.lisp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/common.lisp') diff --git a/src/common.lisp b/src/common.lisp index c59ea79..2c56184 100644 --- a/src/common.lisp +++ b/src/common.lisp @@ -1,2 +1,17 @@ (defun get-file-lines (name) (uiop:read-file-lines name)) + +(defun partial (func &rest args1) + (lambda (&rest args2) + (apply func (append args1 args2)))) + +(defun compose (a b) + (lambda (&rest args) + (funcall a (apply b args)))) + +(defun filter (func l) + (loop :for i :in l :when (funcall func i) :collect i)) + +(defun trim (input) + (string-trim '(#\Space #\Newline #\Backspace #\Tab + #\Linefeed #\Page #\Return #\Rubout) input)) -- cgit