diff options
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)) |