Re: Confusion with namespaces and SLIME

2009-09-06 Thread Mathias Dahl
> (defvar clojure-stuff-path "~/clj" >   "Where all cool Clojure stuff lies.") > > (defun slime-clojure-internal-swank () >   (interactive) >   (add-to-list 'load-path (concat clojure-stuff-path "/clojure-mode")) >   (add-to-list 'load-path (concat clojure-stuff-path "/swank- > clojure")) >   (req

Re: Confusion with namespaces and SLIME

2009-09-05 Thread Mathias Dahl
re")) (add-to-list 'load-path (concat clojure-stuff-path "/slime")) (require 'swank-clojure-autoload) (require 'clojure-mode) (clojure-slime-config clojure-stuff-path ) ;; The order of the line above and below is important (require 'slime) (slime-se

Re: Confusion with namespaces and SLIME

2009-09-05 Thread Mathias Dahl
I have the same problem and I have the latest version of all involved components. I run Emacs 23.1 on Ubuntu. Any ideas on how to resolve it? The trick of using `ns' and `use' separately does not seem to solve the problem for me. It feels like there are two or even more environments behind the s

Re: Starting swank separately and connecting to it works almost but no REPL

2009-09-05 Thread Mathias Dahl
> This wouldn't just be because SLIME no longer includes the REPL by > default, would it? Yes it would indeed :) > Does adding: > (require 'slime-fancy) > > to your emacs setup help at all? No (because the contrib dir was not in my load-path I assume), but the following works: (slime-setup '

Starting swank separately and connecting to it works almost but no REPL

2009-09-05 Thread Mathias Dahl
Hi! I am trying to start swank separately so that I can connect to it from a separate emacs instance. It works almost all the way but I never get a REPL. Here are the details: Shell: $ java -cp /home/mathias/tmp/clojure-1.0/clojure-1.0.0.jar:/home/ mathias/clj/swank-clojure clojure.lang.Repl C

Re: Find lines matching regexp in large text file - performance suggestions welcome

2008-10-23 Thread Mathias Dahl
> I don't see any way to significantly improve your speed, but I can > save you some lines of code: Thanks! I ended up calling out to grep instead :) Here is the code if someone else wants to do similar things: (defn real-grep [pattern] (debug (str "pattern: " pattern)) (let [cmd-arr

Find lines matching regexp in large text file - performance suggestions welcome

2008-10-21 Thread Mathias Dahl
Today I came up with this: (defn locate-lines [regexp] (let [pattern (. java.util.regex.Pattern (compile regexp (. java.util.regex.Pattern CASE_INSENSITIVE)))] (debug (str "pattern: " pattern)) (with-open r (new java.io.LineNumberReader

Re: Using a Timer in Clojure

2008-09-06 Thread Mathias Dahl
> If it's a webapp ... > Create a page that does what you want in whatever webapp framework you > use. > Have cron do a simple wget to that page at the appropriate time. > (some security would need to be implemented.) That is quite clever. I might try that if the approach using a Timer does not w

Get the time of next Friday noon

2008-09-06 Thread Mathias Dahl
I came up with this for my scheduling needs (I use it for getting the start time for a Timer): (import '(java.util GregorianCalendar)) (defn get-next-friday-noon [] (let [cal (new GregorianCalendar) day-of-week (. cal (get (. GregorianCalendar DAY_OF_WEEK))) friday(

Re: Using a Timer in Clojure

2008-09-02 Thread Mathias Dahl
> > For regular tasks of the sort you describe, especially things like > > sending out regular emails, backing up systems, and other maintenance > > tasks, you may want to consider using cron on a unix machine instead. > > Yup, lots of CRON-style functionality already exists, so no reason to > inv

Using a Timer in Clojure

2008-09-01 Thread Mathias Dahl
I would like to have a java.util.Timer running in my Clojure webapp. Once per week, some time each Friday, the code the timer calls would send out an e-mail with news to a list of recipients. I have never used Timers nor worked with threads in Java so this is kind of new ground to me. I found some