view src/rlm/dylan-reverse-seq.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 coderloop.reverse-sequence)
2 (use 'clojure.contrib.str-utils)
3 ;;(use 'rlm.shell-inspect)
5 (defn extension[f ip op] (fn[x](if (= x ip) op (f x))))
7 (let[
8 ;;*command-line-args* (list "/home/ocsenave/testfile.txt")
9 pairs (if (nil? *command-line-args*) '() (map #(re-split #" " %) (re-split #"\r\n" (slurp(first *command-line-args*)))))
10 predecessor (reduce #(extension %1 (second %2)(first %2)) (fn[x]nil) pairs)
11 terminus (first(remove(set(map first pairs))(map second pairs)))
12 ]
13 (defn lineage[x](if(nil? x)nil (cons x(lineage (predecessor x)))))
14 (print (str-join "\n" (lineage terminus)))
15 )
18 ;;(if (command-line?)
19 ;; (do-something-to *command-line-args*))