Skip to content

Instantly share code, notes, and snippets.

@alexanderjamesking
alexanderjamesking / errors.clj
Created October 7, 2021 20:02 — forked from adambard/errors.clj
An example of functional error handling in clojure.
(ns example.errors)
(defn clean-address [params]
"Ensure (params :address) is present"
(if (empty? (params :address))
[nil "Please enter your address"]
[params nil]))
(defn clean-email [params]
"Ensure (params :email) matches *@*.*"
@alexanderjamesking
alexanderjamesking / RDF in Turtle to PDF Graph
Created September 15, 2018 10:11 — forked from crstn/RDF in Turtle to PDF Graph
Create a graph visualization from an RDF file using http://librdf.org/raptor/ and http://www.graphviz.org.
rapper -i turtle -o dot model.ttl | dot -Tpdf -omodel.pdf
@alexanderjamesking
alexanderjamesking / 00_destructuring.md
Created March 20, 2017 10:44 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors