Some ideas ... coded blind / not tested, as I don't have one of the functions you're calling.
(defun FilterList ( arguments / filter result )
;; first item in arguments is alist
;;
;; second item in arguments is filter
(cond
( (setq filter (cadr arguments))
(foreach item (car arguments) ;; alist (implied)
(if
(eq (strcase filter)
(strcase
(substr
(car
(TGS:StringToList
(cdr item)
";"
)
)
3
4
)
)
)
(setq result
(cons
item
result
)
)
)
)
;; even though you can have a local variable
;; named the same as the function hosting it
;; I think this is a better tact
result
)
((alert "No Filter Set"))
)
)
;; formerly you'd call FilterList thusly
(FilterList alist filter)
;; now like so
(FilterList (list alist filter))
;; or
(FilterList (list alist))