Wednesday, February 27, 2019

SICP in Clojure: Chapter 1, Exercise 3

This is my Clojure solution to Chapter 1, Exercise 3:

(ns sicp.ch1.ex03)

(defn f
  [x y z]
  (reduce #(+ %1 (* %2 %2))
          (drop 1 (sort [x y z]))))

No comments: