View document.xml
<?xml version="1.0" encoding="UTF-8"?>
<w:document xmlns:w="" xmlns:mc="" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="" xmlns:wp="" xmlns:wp14="" xmlns:wpg="" xmlns:wps="" mc:Ignorable="w14 wp14">
<w:pStyle w:val="Normal" />
<w:rPr />
<w:rPr />
View rpn.clj
(defn rpn [s]
(first (reduce (fn [[s1 s2 & ss :as stack] op]
(case op
+ (cons (+ s1 s2) ss)
- (cons (- s1 s2) ss)
* (cons (* s1 s2) ss)
/ (cons (/ s1 s2) ss)
, (cons op stack)))
() (read-string (str \( s \))))))
View lis.clj
(defn filt [sequences]
(mapv (partial apply min-key peek) (vals (group-by count sequences))))
(defn rfn [seqs x]
(filt (concat [[x]] seqs (for [cs seqs :when (> x (peek cs))] (conj cs x)))))
(defn longest-subseq [xs]
(apply max-key count [] (reduce rfn nil xs)))

Budapest Clojure User Group - meetup presentation proposal for 2016-11-24

Schema vs. Spec

Validating data in dynamic typed programming languages is an important aspect of making sure our programs are safe and correct. In the short presentation we will take a look at two solutions for validating data in Clojure.

Prismatic Schema is a mature library with simple syntax and strong support in the Clojure ecosystem. The new competitor is core.specs supporting in the core language with promising new features. After the presentation we will discuss personal experiences with the advantages and disadvantages of both solutions.

View split-by-key1.clj
;; number of groups
(def n (.availableProcessors (Runtime/getRuntime)))
;; memoized round-robin style group number generator for items
(let [a (atom (cycle (range n)))]
(def get-id-for
(memoize (fn [_] (first (swap! a next))))))
(defn split-by-key
View num-to-roman.clj
(ns roman-nums.core
[clojure.test :refer [testing are]]))
(def ^:private roman-digits
[[1000 "M"] [900 "CM"]
[500 "D"] [400 "CD"]
[100 "C"] [90 "XC"]
[50 "L"] [40 "XL"]
[10 "X"] [9 "IX"]