From 985d3bb91fd05bd8e95ec880e6e9fdc77aeb46e8 Mon Sep 17 00:00:00 2001 From: Lorenz Lehmann <lorenz.lehmann@students.muho-mannheim.de> Date: Thu, 28 Mar 2024 22:51:53 +0100 Subject: [PATCH] feat (source): add helper functions --- sources/gen-sequence.lisp | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/sources/gen-sequence.lisp b/sources/gen-sequence.lisp index a111182..3fa70ca 100644 --- a/sources/gen-sequence.lisp +++ b/sources/gen-sequence.lisp @@ -301,6 +301,16 @@ (nth counter liste))) +(defun find-area (value borders &key (start-index 0)) + (cond ((null (second borders)) start-index) + ((and (>= value (first borders)) (< value (second borders))) start-index) + (t (find-area value (cdr borders) :start-index (1+ start-index))))) + +(defun filter-rests (liste) + (cond ((null liste) nil) + (t (append (if (>= (car liste) 0) (list (car liste)) nil) + (filter-rests (cdr liste)))))) + -- Gitblit v1.9.1