Common Lisp スニペット集
#commonlisp
optima/alexandriaでルーティング
optimaはアーカイブされているので代替ライブラリを見つける必要がある。
ルーティングライブラリあった
code:lisp
(let ((tree '(:first 1 :second 2 :path-info "/foo/bar")))
(optima:match tree
((guard (property :path-info path)
(alexandria::starts-with-subseq "/foo/" path))
`(200 nil (,(format nil "you in ~S" path)))) ;; => (200 NIL ("you in \"/foo/bar\""))
((property :path-info path)
`(401 nil (,(format nil "~S is not found" path)))))) ;; => (401 NIL ("\"/bar\" is not found"))