Re: Seq of Numbers from 0 to N and Back

2011-08-24 Thread HiHeelHottie
Thanks Aaron. Very neat! On Aug 24, 7:05 pm, Aaron Cohen wrote: > One way: > > user=>(concat (range 5) (range 5 0 -1)) > (0 1 2 3 4 5 4 3 2 1) > > user=>(take 15 (cycl­e (conc­at (rang­e 5) (rang­e 5 0 -1)))­)) > (0 1 2 3 4 5 4 3 2 1 0 1 2 3 4) > > On Wed, Aug

Seq of Numbers from 0 to N and Back

2011-08-24 Thread HiHeelHottie
How can you generate a sequence of numbers from 0 to n and back? Here is my try. user> (require '(clojure.contrib [math :as math])) nil user> (take 15 (let [n 3] (drop n (map #(math/abs (- (mod % (* n 2)) n)) (range) (0 1 2 3 2 1 0 1 2 3 2 1 0 1 2) -- You received this message because you

Re: clojure.java.jdbc: mapping BigDecimal to double

2011-08-23 Thread HiHeelHottie
hem would be a > good idea... > > Sean > > > > > > > > On Tue, Aug 23, 2011 at 6:16 PM, HiHeelHottie wrote: > > It looks like Oracle NUMBER types get mapped to BigDecimal in a result > > seq from clojure.java.jdbc. Is there an easy way to configure > > clojure.jav

clojure.java.jdbc: mapping BigDecimal to double

2011-08-23 Thread HiHeelHottie
Hi, It looks like Oracle NUMBER types get mapped to BigDecimal in a result seq from clojure.java.jdbc. Is there an easy way to configure clojure.java.jdbc/ResultSet to map Oracle NUMBERS to doubles? The resultset-seq from https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure

Getting http-agent to throw an exception if url doesn't exist?

2011-01-24 Thread HiHeelHottie
user> (use '[clojure.contrib.http.agent :as ha]) WARNING: bytes already refers to: #'clojure.core/bytes in namespace: user, being replaced by: #'clojure.contrib.http.agent/bytes nil user> (string (http-agent "http://url.that.doesnt.exist.com";)) This will block indefinitely since the url does not

Error Handling for Callback API to Blocking API example in Joy of Clojure

2010-12-19 Thread HiHeelHottie
In Joy of Clojure, there is a callback API to blocking API example in the section on promises. Chouser outlines it a briefly in a discussion on Promise/Deliver use cases here - http://groups.google.com/group/clojure/browse_thread/thread/b1548aa40ba8072/210ec81bfe26032e?lnk=gst&q=promise#210ec81bf

Debugging with IntelliJ Idea 10 and La Closure Plugin version 0.3.15

2010-12-14 Thread HiHeelHottie
I'm using IntelliJ Idea 10 with the La Closure plugin version 0.3.15 and Java 6 I've added Clojure 1.2 to a project. The breakpoints I put on Java code get hit, but the ones I put on Clojure do not. in fact, if the debugger is stopped on a Java breakpoint, the breakpoints on Clojure code have a

Re: priority queue for scheduling events in the future

2010-11-25 Thread HiHeelHottie
Ken, Thanks for putting this together. As a newbie, this gives me a lot to mull over. Can you explain the convention of a * at the end of a function name? On Nov 24, 12:39 am, Ken Wesson wrote: > On Tue, Nov 23, 2010 at 11:45 PM, HiHeelHottie wrote: > > > Does anybod

Re: priority queue for scheduling events in the future

2010-11-23 Thread HiHeelHottie
Ulises, thanks for the response. The insertions will be sprinkled out over time and would want insertions/removals to be reasonably efficient. On Nov 23, 11:58 pm, Ulises wrote: > > Does anybody know of an implementation for a priority queue that can > > be used for scheduling events in the fut

priority queue for scheduling events in the future

2010-11-23 Thread HiHeelHottie
Does anybody know of an implementation for a priority queue that can be used for scheduling events in the future? I would like to put a map associated with a timestamp into the queue and be able to pull out all maps at or before a given time in order. -- You received this message because you ar

Re: println from within a thread

2010-11-21 Thread HiHeelHottie
since there wouldn't be a way to use bound-fn at thread creation. Am I overlooking something? hhh On Nov 21, 7:05 am, Rasmus Svensson wrote: > 2010/11/21 HiHeelHottie : > > > > > Does anybody know how to redirect the output into the repl? > > Thread local bindings are

Re: println from within a thread

2010-11-21 Thread HiHeelHottie
Does anybody know how to redirect the output into the repl? On Nov 20, 7:45 pm, HiHeelHottie wrote: > I'm running it from a shell inside emacs and the output appears in > that buffer.  Thanks! > > On Nov 20, 6:44 pm, Ulises wrote: > > > > > > This is ho

Re: string interpolation

2010-11-21 Thread HiHeelHottie
Thanks Mike. This is what I was looking for. On Nov 20, 8:31 pm, Mike K wrote: > Check out the << macro from clojure.contrib.strint. > > http://clojure.github.com/clojure-contrib/strint-api.html -- You received this message because you are subscribed to the Google Groups "Clojure" group. To p

Re: println from within a thread

2010-11-20 Thread HiHeelHottie
I'm running it from a shell inside emacs and the output appears in that buffer. Thanks! On Nov 20, 6:44 pm, Ulises wrote: > > This is how I'm running the test in the slime-connect buffer: > > How are you running the swank process? I usually run it as lein swank. > Whenever I print inside a spaw

string interpolation

2010-11-20 Thread HiHeelHottie
I think ruby has nice string interpolation. You can put the following in a textfield that a user can modify This is a #{adjective} string. Then, you can take that string, put it in quotes and have ruby evaluate it as a string. What is the clojure way of doing something similar. Presenting som

logging recommendation

2010-11-20 Thread HiHeelHottie
What do you recommend for logging, especially to a set of rolling files? Simply use log4j? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated -

Re: println from within a thread

2010-11-20 Thread HiHeelHottie
e inside thread appear in the output. On Nov 20, 4:56 pm, HiHeelHottie wrote: > I'm using lein swank and doing a slime-connect from within emacs.  The > repl is in *slime-repl clojure* buffer, but I don't see an *inferior > lisp* buffer.  Or did you mean that there is some elisp-var

Re: println from within a thread

2010-11-20 Thread HiHeelHottie
emacs. On Nov 20, 4:16 pm, Moritz Ulrich wrote: > Are you using slime? If so, take a look at the *inferior lisp* buffer. There > is also a elisp-var you can set to redirect the inferior output to the repl. > I just don't remember the name ;) > > On Sat, Nov 20, 2

println from within a thread

2010-11-20 Thread HiHeelHottie
I'm trying to output a debug string from a thread: (def my-thread (Thread. #(println "inside thread"))) (.start my-thread) In the repl, I don't see "inside thread" displayed. Am I coding something incorrectly? Any suggestions on how to get debug output from a thread? Thanks. -- You received

Idiomatic Way to Keep a Variable Private to a Namespace

2010-10-11 Thread HiHeelHottie
I want to define and use a map that is private to a namespace and used by several functions in that namespace. Is the idiomatic way simply to def it within the namespace? Is there another way to hide it? -- You received this message because you are subscribed to the Google Groups "Clojure" gro

lein compile changes not getting picked up by lein swank

2010-10-10 Thread HiHeelHottie
I'm running lein swank and using slime-connect from emacs. When I use lein compile after making changes to a method, they don't appear to get picked up unless I bring down lein swank, bring it up again, slime- connect, etc. Is there a way to get lein compile changes to be picked up by an already

Re: Idiomatic Way to Build String or Simply Use StringBuilder

2010-09-30 Thread HiHeelHottie
f []} (str s " "))] (apply str (:buf m (println (parse "1 2 33")) On Sep 30, 12:15 am, Michael Gardner wrote: > On Sep 29, 2010, at 11:01 PM, HiHeelHottie wrote: > > > What if you are appending over different lines of code? > > Could you give an exam

Re: Idiomatic Way to Build String or Simply Use StringBuilder

2010-09-29 Thread HiHeelHottie
Thanks for the response. What if you are appending over different lines of code? Would it be slightly more efficient to use one StringBuilder or not worth the bother. On Sep 29, 11:32 pm, Stuart Campbell wrote: > On 30 September 2010 12:48, HiHeelHottie wrote: > > > > > Is

Idiomatic Way to Build String or Simply Use StringBuilder

2010-09-29 Thread HiHeelHottie
Is there an idiomatic way to build up a string over different lines of code? Or, should one simply use StringBuilder. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from

Iterating through two seqs at once for side-effects

2010-09-25 Thread HiHeelHottie
What are good ways to iterate through two seqs at once for side- effects? This doesn't seem so great since I'm not interested in the collection that's built by map. I also learned the hard way that map is lazy. Hence, the dorun. (dorun (map #(println %1 %2) [1 2 3] [11 22 33])) -- You receive

Literal collection of numbers - prefer list or vector?

2010-09-24 Thread HiHeelHottie
For a literal collection of numbers which would be more idiomatic and why? (reduce + '(1 2 3)) vs (reduce + [1 2 3]) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from ne

Byte Literals

2010-09-23 Thread HiHeelHottie
Is there a way to create a vector of byte literals eg. [64 69 72] as bytes? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patie

2 lein swank instances on same project and compiling src from emacs

2010-09-07 Thread HiHeelHottie
I have two lein swanks going on different ports against the same project. I open up two slime-connect's in emacs. How can I compile (C-c C-k) my core.clj to the two different slime-connect's. hhh -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Embedding swank-clojure

2010-04-17 Thread HiHeelHottie
Based on the Embedding section of http://github.com/technomancy/swank-clojure, I'm using the following to test it out. Is there a better way to do this that doesn't use Compiler? Is there a way to programmatically stop swank? It seems start-repl takes control of the thread. What would be a goo

^#'

2010-03-24 Thread HiHeelHottie
Why does ^#' get you the meta data? http://clojure.org/special_forms user=> ^#'mymax ->{:name mymax, :user/comment "this is the best fn ever!", I couldn't find it documented in http://clojure.org/reader. #' seems to match Var-quote (#'), but why does ^ get you metadata when that page uses M