Skip to content

Instantly share code, notes, and snippets.

View dakrone's full-sized avatar

Lee Hinman dakrone

View GitHub Profile
(ns distance
(:use [clojure.contrib.seq :only [indexed]]))
(defn- min-dist
[index inums]
(apply min (map #(Math/abs (- index %)) inums)))
(defn rel-distance
[indexes elems]
(let [ielems (indexed elems)
Exception in thread "main" java.lang.Exception: Unable to resolve symbol: send-to-emacs in this context, compiling:(server.clj:53)
at clojure.lang.Compiler.analyze(Compiler.java:5777)
at clojure.lang.Compiler.analyze(Compiler.java:5723)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3301)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5945)
at clojure.lang.Compiler.analyze(Compiler.java:5762)
at clojure.lang.Compiler.analyze(Compiler.java:5723)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5131)
at clojure.lang.Compiler$TryExpr$Parser.parse(Compiler.java:1956)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5943)
(defn large-quicksort
[items]
(if (<= (count items) 1)
items
(let [pindex (rand-int (count items))
p (get (vec items) pindex)
[before after-with-p] (split-at pindex items)
after (rest after-with-p)
newitems (vec (concat before after))]
#(concat
" ---------------------------------------------------------------------------
" Automagic Clojure folding on defn's and defmacro's
"
function GetClojureFold()
if getline(v:lnum) =~ '^\s*(defn.*\s'
return ">1"
elseif getline(v:lnum) =~ '^\s*(defmacro.*\s'
return ">1"
elseif getline(v:lnum) =~ '^\s*(defmethod.*\s'
return ">1"
; Use ,p to close this buffer!
Could not determine the Namespace of the file.
This might have different reasons. Please check, that the ng server
is running with the correct classpath and that the file does not contain
syntax errors. The interactive features will not be enabled, ie. the
keybindings will not be mapped.
Reason:
# Clojure jar file
clj=~/.clojure/clojure.jar
# Directory where libaries/jar files can be found
clj_ext=~/.clojure
# Paths to add to LD_LIBRARY_PATH
# clj_lib=~/.lib
# Class execution wrapper, uncomment to use jline.
#!/bin/sh
# Please make sure to configure ~/.clojure.conf or /etc/clojure.conf
# sample configuration can be found at clojure.conf.sample
#
# Note, running this script will:
# - Run ~/.clojurerc on boot up (if exists)
# - Add all .jar files within clj_ext (~/.clojure on default)
# to the classpath
#
(defn make-repl-jframe
"Displays a JFrame with JConsole and attached REPL."
([] (make-repl-jframe {}))
([optmap]
(let [jframe (make-jframe (merge default-opts optmap))]
(javax.swing.SwingUtilities/invokeAndWait
#(let [console (bsh.util.JConsole.)]
(doto (.getContentPane jframe)
(.setLayout (java.awt.BorderLayout.))
(.add console))
(ns multiaritytest)
; This works great.
(defprotocol P
(foo [this a] [this a b]))
(deftype R []
P
(foo [this a] (println "hi"))
(foo [this a b] (println "hi2")))
(ns clomoios.seededcontextsearcher
(:use [clomoios.core :as core])
(:require [opennlp.nlp :as nlp]))
(defprotocol SeededSearcher
"An interface for searching using seeded text"
(add-seed [this seedtext] "Add seed text to this searcher")
(add-score-words [this words] "Add score words to this searcher")
(score-words [this term] "Get the computer score words for a given term"