diff options
Diffstat (limited to 'lisp/clark.lisp')
-rw-r--r-- | lisp/clark.lisp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/clark.lisp b/lisp/clark.lisp index bfb0868..d9477e8 100644 --- a/lisp/clark.lisp +++ b/lisp/clark.lisp @@ -330,6 +330,17 @@ list of tags." (clear-tags url) (add-tags url tags)) +(defun random-item (lst) + (nth (random (length lst) (make-random-state t)) lst)) + +(defcommand random (&optional tag) + "Pick a random bookmark, possibly from TAG." + "Usage: clark random [<tag>] + +Get a random bookmark. If TAG is given limit the result to a bookmark +having the tag TAG." + (format t "~a~%" (random-item (url-list tag)))) + (defcommand version () "Show version." "Usage: clark version |