Re: Having trouble doing what I want using macros, is there a better way?

2016-06-10 Thread Nate Young
You can "capture" symbols from the surrounding context, making them available to the body of your macros, the "tilde tick trick" is what you're looking for there: (defmacro deftransducer [body] `(fn [reducing-fn#] (fn ([] (reducing-fn#))

Re: How to Keep Clojure Server From Quitting

2016-06-09 Thread Nate Young
ount/start args) (netty/wait-for-close server/http)) On Wednesday, June 8, 2016 at 7:53:25 AM UTC-7, Nate Young wrote: Good morning (at least from my part of the globe), I spent a good chunk of time last night wondering why this chunk of code kept exiting about a minute after being

Re: Question about attempt parser in parsatron

2014-01-28 Thread Nate Young
/either (p/attempt p) (p/always default-value))) (p/defparser p [] (p/let- [h (optional (helloParser) nil) w (worldParser)] (p/always [h w]))) Hope that helps. Nate Young -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: why is get not giving me a default value?

2012-10-18 Thread Nate Young
On Thu, Oct 18, 2012 at 10:16 AM, larry google groups lawrencecloj...@gmail.com wrote: Okay, this is very confusing to me. If I try this: (defn add-to-logged-in-registry [this-users-params] (let [right-now (. (Date.) getTime) new-user-entry (conj this-users-params { updated

Re: Will this cause stack overflow?

2012-08-29 Thread Nate Young
On Wed, Aug 29, 2012 at 4:03 PM, Erlis Vidal er...@erlisvidal.com wrote: If yes, how can I do a recursive call when passing the function as a parameter to another function, like in this case with mapcat? You could use `lazy-seq`. Something like this: (defn my-flatten [x] (lazy-seq (if

Re: Parser combinators in parsatron

2012-08-28 Thread Nate Young
On Thu, Aug 23, 2012 at 11:22 AM, Alexsandro Soares prof.asoa...@gmail.com wrote: Can you provide the code for this? Certainly. The parser's current source position is stored in the InputState record's `pos` field. That field is a SourcePos record consisting of the current line and column

Re: Parser combinators in parsatron

2012-08-23 Thread Nate Young
On Thu, Aug 23, 2012 at 9:24 AM, Alexsandro Soares prof.asoa...@gmail.com wrote: Ok. Thanks for the answer. Is there any way to get the line and column? The Parsatron doesn't have any builtin facilities for extracting line numbers from tokens, you'd have to keep track of the number of newline

Re: Help using parsatron to parse a list

2012-04-18 Thread Nate Young
for: (defparser arr [] (between (char LPAREN) (tok (char RPAREN)) (many (attempt (tok (array-item)) Cheers, Nate Young -- 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

Re: Clojure-in-CommonLisp?

2011-11-15 Thread Nate Young
There's also ABCL, the Common Lisp implementation that maintains the inalienable right to arm bears, written in Java and supporting interop between both Java and Lisp. http://common-lisp.net/project/armedbear/doc/abcl-user.html On 11/15/2011 09:13 AM, Dennis Crenshaw wrote: I haven't dealt with

Re: Dynamic test creation?

2011-11-09 Thread Nate Young
On 11/08/2011 12:44 PM, AndyK wrote: I finally had a chance to try this out and it fails with error: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IObj Compilation failed. I think I fat-fingered my deftest-form definition: I originally wrote: (defn

Re: Dynamic test creation?

2011-11-02 Thread Nate Young
On 11/01/2011 03:05 PM, AndyK wrote: How would (run-tests 'my-namespace) know to run all those dynamic tests? I thought that it parsed the namespace for 'my-namespace when you call it. Or is it that the call to defcsvtests sets off a chain of macro resolutions before run-tests can even do its

Re: Dynamic test creation?

2011-10-31 Thread Nate Young
On 10/28/2011 09:42 AM, AndyK wrote: I am setting up tests with clojure.test that are driven by a CSV where each line represents one test case. Right now, there is a single deftest function that runs all the assertions. That's ok but creates reporting like 1 test was run with 1000s of

Re: Help: Some AOT-compiled classes can't be required

2011-06-24 Thread Nate Young
This creates a classes/midje/ directory full of class files. (QUESTION: Why create a bunch of class files when Midje is in lib/ as a jar file?) leiningen's compile task calls clojure.core/compile for every namespace you specify in your project.clj. clojure.core/compile sets the *compile-files*

Re: name protect anonymous macros ?

2010-12-21 Thread Nate Young
On 12/17/2010 09:54 AM, Trevor wrote: 2. Is there a form for anonymous macros? i.e. I know I can do : (fn[x](do x)), but can I not do: (macro[x](let [x# x] `(do x))) ? Thanks! A little tardy, but Konrad Hinsen has written a handful of CL-like functions for symbol macros and macrolet

Re: async http client in clojure

2010-08-17 Thread Nate Young
On 08/16/2010 04:12 PM, leo wrote: I am trying to understand how efficient it would be to use Clojure to develop an asynchronous http client for my webapp instead of using Java. Is there any specific way one can be better than the other? Bradford Cross of FlightCaster just wrote an excellent

Re: Defining a namespace inside a let

2010-04-28 Thread Nate Young
On Apr 26, 5:25 pm, David McNeil mcneil.da...@gmail.com wrote: I am experimenting with clojure.test and I encountered the following situation which I cannot explain. This code: (println (do            (ns ns01              (:use clojure.test))            (deftest test1 nil)