view src/rlm/web_stuff.clj @ 2:c7df1ea6fd71

fixed javadoc to work with my setup
author Robert McIntyre <rlm@mit.edu>
date Tue, 27 Dec 2011 23:27:22 -0700
parents 78a630e650d2
children
line wrap: on
line source
1 (ns rlm.web-stuff)
4 ;;(from http://www.mail-archive.com/clojure@googlegroups.com/msg31123.html
5 (defn convolve [ns ms]
6 (let [ns (vec ns), ms (vec ms),
7 count-ns (count ns), count-ms (count ms)]
8 (loop [n 0,
9 y (transient (vec (repeat (dec (+ count-ns count-ms)) 0)))]
10 (if (= n count-ns) (persistent! y)
11 (recur (inc n)
12 (loop [m 0, y y]
13 (if (= m count-ms) y
14 (let [n+m (+ n m)]
15 (recur (inc m) (assoc! y n+m
16 (+ (y n+m) (* (ns n) (ms
17 m)))))))))))));;)