Re: Determine file of auxiliary test method with clojure.test?

2014-07-10 Thread Jeff Valk
You could override the clojure.test/do-report implementation and use the same stack frame trick that the default :fail case uses. Then from there, either use the file name from the StackTraceElement, or demunge the method name to get the var. I wouldn't really call that obvious, though. :-)

Re: Clojure source releases issue for Maven Central

2014-04-21 Thread Jeff Valk
Thanks, Alex. On Monday, April 21, 2014 4:30:09 PM UTC-4, Alex Miller wrote: Seems to have been fixed only for snapshots; reopened. -- 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

Clojure source releases issue for Maven Central

2014-04-17 Thread Jeff Valk
Current builds of the Clojure sources jar (clojure-1.6.0-sources.jar, clojure-1.5.1-sources.jar, etc) available from the Maven Central releases repository contain the errant versions.properties file noted in issue CLJ-1161 [1] . The fix for that issue can be seen in the Central repo labelled

ClojureScript deftype and extend-type differ

2011-11-20 Thread Jeff Valk
Hello all, I ran into an extend-type issue with the ClojureScript compiler output. If there's a better place to report such things, please point me there. If I define a protocol method with multiple arities, implementing it using deftype works as expected, however extend-type does not. The

Re: ClojureScript deftype and extend-type differ

2011-11-20 Thread Jeff Valk
Issue opened: http://dev.clojure.org/jira/browse/CLJS-104. Cheers, Jeff -- 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 patient

Re: ClojureScript deftype and extend-type differ

2011-11-20 Thread Jeff Valk
Hi Alan, Good catch. This raises a question though: why do deftype and extend-type take subtly different forms for methods with multiple arities? ;; deftype only works like this: (foo [this] 1) (foo [this x] 2) ;; extend-type only works like this: (foo ([this] 1) ([this x] 2))

Re: Knuth's literate programming tangle function in Clojure

2011-01-04 Thread Jeff Valk
On Tuesday, January 04, 2011 at 10:18 am, Tim Daly wrote: I've run into a syntax for strings that I don't understand. The string #some string is used in the test files. The documentation on the reader does not list this as a possible input case. What does it mean? It's reader syntax for a

Re: HTML5 Validator

2010-12-18 Thread Jeff Valk
On Saturday, December 18, 2010 at 02:10 pm, Alyssa Kwan wrote: I'd like to unit test my html output for well-formedness. What's an easy way to test it for HTML5 validity? Are there good Clojure libs for this? I only need to check for validity, not parse. I'm not aware of a native clojure

Re: Find file from namespace symbol

2010-09-29 Thread Jeff Valk
On Wed, 29 Sep 2010 at 15:18, David Jagoe wrote: Anyone know of a utility that returns a absolute filename given a namespace symbol? If you're using Emacs/SLIME, you could use swank-clojure's classpath browsing information. The var available-classes in namespace swank.util.class-browse holds

Re: Nil Coalesce

2010-08-17 Thread Jeff Valk
Here's a pass using reduce, keeping both collections in the return value, conj-ing to one and taking from the other as necessary... (defn nil-coalesce [coll subs] (first (reduce (fn [[a b] x] (if x [(conj a x) b] [(conj a (first b))

Re: code review:replace-first

2010-05-08 Thread Jeff Valk
On Sat May 08 2010 at 08:38 am, Mark J. Reed wrote: But there are no doubt better ways to do it, probably built in or in clojure.core. Using 'split-with' from core seems handy here: clojure.core/split-with ([pred coll]) Returns a vector of [(take-while pred coll) (drop-while pred coll)] So

Re: clojure-mode patch for docstrings

2009-10-15 Thread Jeff Valk
On Wednesday 14 October 2009 at 07:11 pm, Phil Hagelberg wrote: Currently with swank there are some changes on his branch that I haven't been able to get working properly, so maybe for functionality there it would be best if you wait till I have a chance to merge them, sorry. Good tip.

Re: clojure-mode patch for docstrings

2009-10-15 Thread Jeff Valk
On Thursday 15 October 2009 at 11:54 am, Phil Hagelberg wrote: If you base it on the maven branch from my github repo, you should be good. good stuff. thanks. I've started a separate mailing list for swank-clojure, why don't you join at http://groups.google.com/group/swank-clojure ? will

Re: clojure-mode patch for docstrings

2009-10-14 Thread Jeff Valk
On Wednesday 14 October 2009 at 12:16 pm, Phil Hagelberg wrote: If you've got complicated changes you can create a github fork and ask to pull from there, but for simple things email is fine. Though if you want attribution for your patch you can use git format-patch to generate your it; then

clojure-mode patch for docstrings

2009-10-13 Thread Jeff Valk
Hi Emacs/clojure-mode users, Below is a small patch to enable docstring highlighting. Currently docstrings default to 'font-lock-string-face' rather than using 'font-lock-doc-face'. Also, if there's a way of contributing patches to clojure-mode that's preferred to posting here, please let me

Re: Proposal: New Reader Macro #s{ ... }

2009-10-12 Thread Jeff Valk
If a keeping syntax simple and singular is the goal, the reader macro could use the proposed #s{ ... } form, while supporting balanced braces in the verbatim text. The text literal would close when the number of closing braces matches the number of opening braces. Strings containing unmatched

Re: in-smaller-lists

2009-09-25 Thread Jeff Valk
On Friday 25 September 2009 at 08:46 pm, Travis wrote: I'm doing some file streaming with a lazy list and I ran into a problem where I had to process a whole chunk at a time, so I wrote this function. Just posting to see if I'm reinventing something or if it might be a good addition to

Re: Emacs clojure-mode home?

2009-07-01 Thread Jeff Valk
As a side note on the topic of clojure-mode, I noticed the function clojure-install still clones Kevin O'Neill's svn mirror (git://github.com/kevinoneill/clojure.git). Shouldn't this point to Rich's repository (git://github.com/richhickey/clojure.git), now that clojure has moved to github? -

Re: Mapping a function over a map's values

2009-03-23 Thread Jeff Valk
On Sun, 22 Mar 2009 at 23:27, Jeff Valk wrote: Ah, golf... :-) (defn mapmap [f m] (into {} (for [[k v] m] [k (f v)]))) For the record, I think the original approach is the most clear. And it's actually shorter. (defn mapmap [f m] (zipmap (keys m) (map f (vals m

Re: Mapping a function over a map's values

2009-03-23 Thread Jeff Valk
On Mon, 23 Mar 2009 at 03:29, Mark Engelberg wrote: But it traverses m twice, which is likely to be less efficient. I wondered about this too, and actually no. Zipmap is efficient. It constructs its return map in a single loop from two lazy seqs. Performance is practically identical to the

Re: Mapping a function over a map's values

2009-03-23 Thread Jeff Valk
On Mon, 23 Mar 2009 at 07:57, Christophe Grand wrote: I prefer the into version which allows to write a mapmap that preserves the map type (eg sorted or hash): (defn mapmap [f m] (into (empty m) (for [[k v] m] [k (f v)]))) Agreed. If it were in contrib, this would make most sense.

Re: Mapping a function over a map's values

2009-03-23 Thread Jeff Valk
On Mon, 23 Mar 2009 at 10:48, Konrad Hinsen wrote: It is already in clojure.contrib, with exactly that implementation, and for exactly that reason: Well I'm glad we agree then. :-) And thanks for the pointer. -Jeff --~--~-~--~~~---~--~~ You received this

Re: Mapping a function over a map's values

2009-03-23 Thread Jeff Valk
On Mon, 23 Mar 2009 at 20:10, David Sletten wrote: I think Mark was referring to the call to 'keys'. But apparently Clojure doesn't need to traverse the map to generate the keys? The call to keys just creates a seq. There's no traversal until you consume it. Not sure what you mean here.

Re: Algebraic data types in clojure.contrib

2009-02-26 Thread Jeff Valk
Thanks for the insight, Konrad. I know this is a sideshow to the larger discussion on types, but it does present an unexpected usability issue. On 26 February 2009 at 02:44, Konrad Hinsen wrote: The fix is to provide a default implementation for print-method. Try executing this:

Re: Algebraic data types in clojure.contrib

2009-02-25 Thread Jeff Valk
How about appending type metadata automagically... (defstruct stuff :a :b) (defmacro make Creates a new instance of struct t and appends 'type' t as metadata [t vs] `(with-meta (struct ~t ~...@vs) {:type (keyword (str *ns*) (name '~t))})) user (make stuff 1 2) {:a 1, :b 2} user

Re: Algebraic data types in clojure.contrib

2009-02-25 Thread Jeff Valk
uses :type now in a very particular way. I'm not sure where this happens though. Can anyone shed some light on the details? -Jeff On Thu, Feb 26, 2009 at 7:08 AM, Jeff Valk jv-li...@tx.rr.com wrote: How about appending type metadata automagically... (defstruct stuff :a :b) (defmacro

Re: Idiomatic Way to Write the Following:

2009-02-18 Thread Jeff Valk
Vectors are designed for contiguous/sequential data. The case below requires removing elements at arbitrary (keyed) locations in a collection. Idiomatically, a map is better suited to the job. With a vector you'll be left reassembling your key. It's worth noting that calling assoc on a vector

Re: Idiomatic Way to Write the Following:

2009-02-18 Thread Jeff Valk
Here's another. (defn remove-at [v idxs] (vec (for [i (range (count v)) :when (not ((set idxs) i))] (v i - Jeff On Wednesday 18 February 2009 12:07, Chouser wrote: On Wed, Feb 18, 2009 at 12:30 PM, Telman Yusupov use...@yusupov.com wrote: No prettier, but a bit faster: (defn

Re: clojure and embedded derby

2009-02-17 Thread Jeff Valk
I've seen the same thing with embedded Derby while using SLIME. From within the REPL I was always able to reconnect to the same database, so it didn't really impact me. Outside the REPL I didn't notice a problem. If it holds you up, here's one observation you might investigate. Calling