utils: Slightly streamline extract-symbols with match.

This commit is contained in:
Sergiu Ivanov 2020-02-23 09:00:54 +01:00
parent 9eca7bf449
commit 5a27469dce

View file

@ -135,11 +135,10 @@
;;; Produces a list of symbols appearing in the quoted expression
;;; passed in the first argument.
(define (extract-symbols form)
(cond
[(symbol? form)
(list form)]
[(list? form)
(flatten (for/list ([x form]) (extract-symbols x)))]
(match form
[(? symbol?) (list form)]
[(? list?) (flatten (for/list ([x form])
(extract-symbols x)))]
[else '()]))