Skip to content

Instantly share code, notes, and snippets.

@kamisori
Created August 12, 2020 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamisori/b76972f492eb3716dd90894440dd95fa to your computer and use it in GitHub Desktop.
Save kamisori/b76972f492eb3716dd90894440dd95fa to your computer and use it in GitHub Desktop.
I'm working on a webcomic framework for fun when I ran into the following problem:
(import hypertext)
(import sqlite3 :as sql)
(import ./src/data-access :as da)
(import ./src/data-presentation :as dp)
(import ./src/debug :as dbg)
#goes to dp:
(defn render-contents--works [page-contents]
(defn make-html [content]
(let [image-url (string "/blob/" (content :blobid))]
(hypertext/from-data
~(img {:src ,image-url}))))
(def sorted-contents (sorted-by |($ :position) page-contents))
(map make-html sorted-contents))
(defn render-contents--doesnt [page-contents]
(def sorted-contents (sorted-by |($ :position) page-contents))
(map |(let [image-url (string "/blob/" ($ :blobid))]
(hypertext/from-data
~(img {:src ,image-url})))
sorted-contents))
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment