Skip to content

Instantly share code, notes, and snippets.

View tdantas's full-sized avatar
🏠
Working from home

Thiago Dantas tdantas

🏠
Working from home
View GitHub Profile
@tdantas
tdantas / vars.clj
Created December 4, 2017 20:22 — forked from reborg/vars.clj
;; (defn full-name ...) is equivalent to:
;; (def full-name (fn []...)) which defines a Var
;; object called full-name pointing at a compiled function
;; returning the static string "Oliv"
(defn full-name [] "Oliv")
;; greetings is a function taking two args.
;; it returns a function of no argument
;; invoking the second argument (f) with no arguments
;; and combining a string with it.
(ns datomicdemo.core
(:require
[clojure.edn]
[clojure.string :as str]
[datomic.api :as d]))
(def url "datomic:free://localhost:4334/datomicdemo")
(d/create-database url)
@tdantas
tdantas / bulkspace.clj
Created November 29, 2023 09:59 — forked from nikolavojicic/bulkspace.clj
Various Clojure specs + generators
;; String containing bulk space(s)
(s/def ::bulk-space-string
(s/with-gen
(s/and string? #(re-find #"\t|\n|\r| +" %))
#(gen/fmap
str/join
(gen/vector
(gen/one-of
[(gen/string)