Created
May 21, 2020 23:18
-
-
Save devth/bd154e76536eed783974764dc6e6a2d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn xkcd-cmd | |
"xkcd # fetch current xkcd comic" | |
{:yb/cat #{:fun :img}} | |
[_] | |
((juxt :title :img :alt) (get-json endpoint))) | |
(defn xkcd-idx-cmd | |
"xkcd <index> # fetch xkcd number <index>" | |
{:yb/cat #{:fun :img}} | |
[{index :match}] | |
;; TODO fetch https://xkcd.com/<index>/info.0.json | |
) | |
(cmd-hook #"xkcd" | |
#"\d+" xkcd-idx-cmd | |
_ xkcd-cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe extract
(juxt :title :img :alt)
to a format helper to be shared across bothxkcd-cmd
andxkcd-idx-cmd
.