Skip to content

Instantly share code, notes, and snippets.

@ryukinix
Last active January 3, 2023 00:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryukinix/5273af4b25dec53ed9f078bd7e350d88 to your computer and use it in GitHub Desktop.
Save ryukinix/5273af4b25dec53ed9f078bd7e350d88 to your computer and use it in GitHub Desktop.
find-executable in Common Lisp
(defun executables ()
(loop with path = (uiop:getenv "PATH")
for p in (uiop:split-string path :separator ":")
for dir = (probe-file p)
when (uiop:directory-exists-p dir)
append (uiop:directory-files dir)))
(defun find-executable (name)
(find name (executables)
:test #'equalp
:key #'pathname-name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment