OTWO-1213 Works around lost encoding in Ruby/C binding layer
[ohcount] / test / src_dir / clj1.clj
1 ;;; Copyright (C) 2009 Brendan Ribera. All rights reserved.
2 ;;; Distributed under the MIT License; see the file LICENSE
3 ;;; at the root of this distribution.
4 (ns kdtree)
5
6 (defn dist-squared [a b]
7     "Compute the K-dimensional distance between two points"
8       (reduce + (for [i (range (count a))]
9                                 (let [v (- (nth a i)
10                                             (nth b i))]
11                                                   (* v v)))))
12
13 ;;; Simple accessors
14 (defn- node-value [n] (first n))
15 (defn- node-left  [n] (first (rest n)))
16 (defn- node-right [n] (first (rest (rest n))))