diff options
author | Yann Herklotz <git@yannherklotz.com> | 2021-12-22 15:02:02 +0100 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2021-12-22 15:02:02 +0100 |
commit | 475d382b0baaa085910d6066d3a51943e777b147 (patch) | |
tree | 8d18ba97d5eb03e0e11ed799211359c4ecd7aa76 /src/common.lisp | |
parent | 771f9fdf08671b2673a7b19d7980f15f2288eb26 (diff) | |
download | aoc21-475d382b0baaa085910d6066d3a51943e777b147.tar.gz aoc21-475d382b0baaa085910d6066d3a51943e777b147.zip |
Pass the 4th day in AOC
Diffstat (limited to 'src/common.lisp')
-rw-r--r-- | src/common.lisp | 15 |
1 files changed, 15 insertions, 0 deletions
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)) |