Skip to content

elken/aoc

Repository files navigation

Advent of Clerk

https://github.com/elken/aoc/actions/workflows/deploy.yml/badge.svg

A repo containing all my advent of code solutions; built in Clerk.

Those unfamiliar should read here but in short it’s an annual programming puzzle competition focused around the Advent.

Why Clerk?

For anyone that’s used Clerk before, the answer should be obvious; but otherwise Clerk is a notebook-style live programming environment for Clojure that also renders comments in Markdown.

Without needing extra files (other than 1 index page) and adding in some comments, I can export my namespaces as HTML pages with examples; and even use custom HTML viewers.

Live is truly live, within milliseconds of me saving my namespace the running output (called by bb serve) updates with the computed result. Long-running answers happen during evaluation time but as soon as that’s done the page updates. The instant feedback in this kind of environment is vital.

How do I include the problem definition in the output?

Each namespace has a call that looks like

(clerk/html (u/load-problem "10" "2022"))

Which attempts to get the page for the problem (with the user’s token; so that part 2 can be acquired) and using a custom user-agent so that Eric knows where this is coming from (in this case it’s just a link to this repo). The page is then parsed and the article tags are pulled; which contain both parts. clerk/html can then simply render the HTML strings and with some CSS overriding; the problems look almost identical.

Credits

About

Speedrun to insanity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages