Sometimes I miss the named arguments feature in Python, for example: def slope(p1=(0,0), p2=(1,1)) return (float(p2[1] - p1[1])) / (p2[0] - p1[0]) => slope((1,2), (4,5)) => slope(p2=(2, 1)) The equivalent in clojure can be done using destructuring: (defn slope [& {:keys [p1 p2] :or {p1 [0 0] p2 [1 1]}}] (float (/ (- p2 1) (p1 1)) (- p2 0) (p1 0))) => (slope :p1 [1 2] :p2 [3 4]) => (slope :p2 [3 4]) => (slope)

# Functional Programming

One awkwardness I haven’t really get rid of when using Clojure is for loops. Especially nested for loops that modifies some global variables. I find some solutions online where people use nested recursion or atoms, but can we just use one level of recursion? Let’s try out with a coding kata. Problem: Given an array of numbers, find the biggest sum of any two numbers. The same item in array cannot be used twice.