Re: [ANN] Ring Jetty servlet adapter

2017-11-19 Thread Michael Blume
I was just about to start figuring out how to do this, for pretty much exactly the same reason (the Hystrix metrics stream). Thanks for this, I'm looking forward to trying it out. On Thu, Nov 16, 2017 at 5:23 AM Jiacai Liu wrote: > Fork of official jetty adapter >

[ANN] Honeysql mailing list and slack channel

2017-07-17 Thread Michael Blume
I'm opening a Google group and Slack channel for discussion of Honeysql, the Clojure DSL for generating SQL. We have some issues that are likely to result in breaking changes, and I'd like to get more input on that than I'd be likely to get in a PR/Issue discussion. Maling list: https://groups.

Re: Clojure android activity?

2017-06-28 Thread Michael Blume
My impression is that if you want to write Clojure on Android in 2017 you use React Native and write ClojureScript. Re-natal is a good starting point On Fri, Jun 23, 2017, 3:57 PM Mike Meyer wrote: > Is there still any activity in the clojure-android space? The > clojure-android mail list is lar

Re: Order preservation and duplicate removal policy in `distinct`

2016-12-28 Thread Michael Blume
Also, I'm assuming distinct uses .equals semantics which might be worth calling out in the doc On Wed, Dec 28, 2016, 11:22 AM Mike Rodriguez wrote: > The doc for `distinct` is: > "Returns a lazy sequence of the elements of coll with duplicates removed. > Returns a stateful transducer when no c

Re: Changing value of atom vector using swap

2016-12-20 Thread Michael Blume
It doesn't look like data is actually an atom? Maybe that's just an error in your e-mail... On Tue, Dec 20, 2016 at 8:24 AM Ghadi Shayban wrote: > swap! takes as its arguments the atom and the function to transition the > state inside the atom. It implicitly calls the function on the state: > (

Re: Lym - written by clojurescript and react native is on apple store

2016-09-14 Thread Michael Blume
ork. > > On Wed, Sep 14, 2016 at 3:02 PM Michael Blume > wrote: > >> I see an Android app in the tree, is it working too? is it using the same >> cljs codebase were there any challenges getting both platforms to work? >> >> On Tue, Sep 13, 2016 at 10:24 PM Tienson

Re: Lym - written by clojurescript and react native is on apple store

2016-09-14 Thread Michael Blume
I see an Android app in the tree, is it working too? is it using the same cljs codebase were there any challenges getting both platforms to work? On Tue, Sep 13, 2016 at 10:24 PM Tienson Qin wrote: > Just release that, > https://github.com/tiensonqin/lymchat > > > On Monday, August 29, 2016 at 6

Re: Cross platform date/time libarary

2016-04-06 Thread Michael Blume
Within your library you could probably use cljc to import one or the other, though. On Mon, Apr 4, 2016 at 9:04 AM Sean Corfield wrote: > On 4/3/16, 11:41 PM, "JvJ" kfjwhee...@gmail.com> wrote: > > OK. As long as a single import in a cljc will suffice. > > Nope. The Clojure time libraries all

Re: [ANN] Clojure 1.8.0-RC3

2015-12-09 Thread Michael Blume
No issues here. On Tue, Dec 8, 2015 at 5:39 PM James Elliott wrote: > I’ve been working with it for a few days and have seen no issues yet. > > > On Wednesday, December 2, 2015 at 10:03:31 AM UTC-6, Alex Miller wrote: > >> Clojure 1.8.0-RC3 is now available. *This build is a "release >> candidat

Re: best practice with forked libraries

2015-11-18 Thread Michael Blume
If you have an internal maven repo, you can publish artifacts to it with updated version string and with group/artifact unchanged. On Wed, Nov 18, 2015 at 7:19 AM Herwig Hochleitner wrote: > 2015-11-18 15:48 GMT+01:00 Max Gonzih : > >> I think lein deps :tree should be enough to spot issues like

Re: Locking non-local variable inside macro

2015-11-15 Thread Michael Blume
The problem here is that you are splicing in obj when there is no need to. You actually want your generated code to refer to obj. So just (defmacro mac1 [& body] `(locking obj ~@body)) is fine. dennis' solution will work too, but it will work almost accidentally? All blank maps evaluate to the s

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Michael Blume
Sorry, I'm confused now -- is the appropriate place to give a return type hint for a function the arg list and not the function name? I've always seen the function name hinted. On Thu, Nov 12, 2015 at 11:20 AM Nicola Mometto wrote: > Also just like the CLJ-1846 issue, this bit of code was valid

Re: how to speedup lein uberjar?

2015-11-01 Thread Michael Blume
I think Matching Socks has definitely got the right answer -- anything that prevents your code from being AOT-compiled is going to give you a huge speedup. On Sun, Nov 1, 2015 at 10:11 PM Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: > Hi Asim, > I needed to run lein uberjar to submit

Re: Calling object members with symbols

2015-10-18 Thread Michael Blume
Nope, still won't work. (let [s 'toString] (invoke 1 s)) java.lang.IllegalArgumentException: No matching field found: s for class java.lang.Long On Sun, Oct 18, 2015 at 5:51 PM dennis zhuang wrote: > You may have to use macro: > > user=> (defmacro invoke [obj sym] `(. ~obj ~sym)) > #'user/in

Re: [ANN] Yesql 0.5.1 Released.

2015-10-09 Thread Michael Blume
The simple answer is https://clojure.github.io/clojure/javadoc/clojure/java/api/package-summary.html But since Yesql works by producing Clojure vars in a namespace, doing *everything* from Java sounds painful -- you'd probably want to sneak in like one Clojure file with a bunch of defquery stateme

Re: 4clojure count problem

2015-10-03 Thread Michael Blume
Reduce can take either two or three arguments; when it takes two arguments, it makes some assumptions about the argument that was left out. You're using reduce with two arguments, so you might want to rethink those assumptions. On Sat, Oct 3, 2015 at 2:19 PM Roelof Wobben wrote: > Hello, > > I h

Re: macro help

2015-09-30 Thread Michael Blume
#foo gensyms don't survive across a 'break' in quoting you can do `(let [foo# bar] (other stuff (foo# ...))) but you can not do `(let [foo# bar] ~(for [i s] `(foo# ...))) or anything like that. The workaround is to create a gensym explicitly using (gensym), let that, and splic

Re: Question about equality in HashMaps

2015-09-11 Thread Michael Blume
I wonder why instaREPL prints a as {"a" 3, "r" 1, "u" 1} On Fri, Sep 11, 2015 at 3:42 PM Alex Miller wrote: > a uses characters (\a \b \c) > b uses strings ("a" "b" "c") > > Those are not equal... > > Try: > (def b {\a 3 \r 1 \u 1}) > > > On Friday, September 11, 2015 at 5:37:32 PM UTC-5, Erlis

Re: Filter predicates and side-effects

2015-09-02 Thread Michael Blume
Don't call filter for side effects, don't rely on when side effects will or will not happen, but yeah, your filter predicate can have side effects. On Wed, Sep 2, 2015 at 9:13 AM James Elliott wrote: > Indeed, that would make sense for filter, but since filterv immediately > puts them all into a

Re: Best Practice on loading namespaces

2015-07-23 Thread Michael Blume
This is component, all of it: https://github.com/stuartsierra/component/blob/master/src/com/stuartsierra/component.clj -- that's well below the size threshold where I'm comfortable saying "if someone else is maintaining it, that's one less thing for me to do; if they ever stop, this'll become part

Re: [ANN] Clojure 1.8.0-alpha2

2015-07-19 Thread Michael Blume
(It looks like you're depending on Potemkin through clj-http, so upgrading to clj-http 2.0.0 will also solve the problem) On Sun, Jul 19, 2015 at 4:53 PM Michael Blume wrote: > Looks like it has, pinning to Potemkin 0.4.1 should probably sort you out > > On Sun, Jul 19, 2015 at 4

Re: [ANN] Clojure 1.8.0-alpha2

2015-07-19 Thread Michael Blume
Looks like it has, pinning to Potemkin 0.4.1 should probably sort you out On Sun, Jul 19, 2015 at 4:50 PM Michael Blume wrote: > Sean, I think that was identified as a bug in Potemkin. The pull was > merged but I'm not sure if there's been a release since. Zack? > > https

Re: [ANN] Clojure 1.8.0-alpha2

2015-07-19 Thread Michael Blume
Sean, I think that was identified as a bug in Potemkin. The pull was merged but I'm not sure if there's been a release since. Zack? https://github.com/ztellman/potemkin/pull/40 http://dev.clojure.org/jira/browse/CLJ-1208?focusedCommentId=39632&page=com.atlassian.jira.plugin.system.issuetabpanels:

Re: How do I expand a variable that I pass to a macro?

2015-07-12 Thread Michael Blume
First of all, I'm pretty sure compojure will let you do the thing, because it's less macro-heavy than what you're using. But to answer the general question, this is a fundamental problem with macros. Once you're making heavy use of macros you start having to write more macros in order to compose t

Re: core.async status?

2015-07-05 Thread Michael Blume
Looking through the tickets at http://dev.clojure.org/jira/browse/ASYNC might give you a better idea of what's planned. On Sat, Jul 4, 2015 at 8:52 PM Martin Raison wrote: > thanks! > > Le samedi 4 juillet 2015 20:38:22 UTC-7, Alex Miller a écrit : >> >> Oh just busy. We will get to a new releas

Re: let vs. let*

2015-06-18 Thread Michael Blume
Basically you the user should not worry about the starred versions On Thu, Jun 18, 2015 at 1:40 PM Johannes wrote: > thanks > > Am Donnerstag, 18. Juni 2015 22:35:53 UTC+2 schrieb raould: >> >> http://lmgtfy.com/?q=clojure+%22let+vs.+let*%22 >> > -- > You received this message because you are s

[ANN] honeysql now available from Clojurescript

2015-06-14 Thread Michael Blume
Using reader conditionals, I've put up an experimental branch of honeysql which seems to work just fine from both Clojure and Clojurescript. If you need to generate SQL from your Node service, please try it out. https://github.com/michaelblume/honeysql/tree/rcond Will update soon with my experien

Re: JDK8

2015-05-07 Thread Michael Blume
Not quite sure what you're asking -- I think Clojure itself is intended to be fully supported on JDK 8, and I regularly build it/build my projects with JDK 8 (though I think I'm using the Oracle version) On Thu, May 7, 2015 at 1:25 PM Pierre-Yves Ritschard wrote: > Hi, > > There hasn't been a JD

Are keys and vals guaranteed to return in the same order?

2015-04-17 Thread Michael Blume
In other people's Clojure code I sometimes see things like (zipmap (map some-fn (keys m)) (map other-fn (vals m))) If it were my code I'd be much more inclined to write (into {} (for [[k v] m] [(some-fn k) (other-fn v)])) Is this a to-each-their-own thing or is the latter preferred?

Re: Generating .clj files with content

2015-04-08 Thread Michael Blume
What James said -- if you want the results to be human readable, if you want control of how it's formatted, if you want to be able to comment it, if you want people to use it as a starting point for code they're going to write, then check out the punctions in https://github.com/technomancy/leininge

Re: Has anyone seen this error while running lein-cloverage?

2015-04-07 Thread Michael Blume
Yes. Cloverage needs to merge https://github.com/lshift/cloverage/pull/59 -- in the meantime, you can add https://github.com/MichaelBlume/cloverage-compojure-fix to your project and it will route around the problem. On Tue, Apr 7, 2015 at 11:27 AM Jonathon McKitrick wrote: > Here's a test in que

Re: Newbie question about filtrering defrecord

2015-04-04 Thread Michael Blume
your list doesn't contain the records, your list contains the symbols 'a1 and 'a2. You can't make a list the way you're trying to. On Sat, Apr 4, 2015 at 5:14 PM Luc Préfontaine wrote: > You mean the a1 record no ? > > > > Hi! > > > > I'm new to clojure, and have problem understanding how to fil

Re: [ANN] Clojure 1.7.0-alpha6 released

2015-03-31 Thread Michael Blume
I've proposed a patch to instaparse to fix this, I realize it's not the most elegant version check ever, but it should fix the problem https://github.com/Engelberg/instaparse/pull/94 On Tue, Mar 31, 2015 at 3:21 PM Sean Corfield wrote: > Looks like a great set of updates! > > Unfortunately, as s

Re: Clojure Culture Question on TDD

2015-03-24 Thread Michael Blume
It is rare to see an open source clojure project without tests. Clojure itself is pretty thoroughly tested, as is leiningen. I don't know about test-first. I think it's actually more common to see "REPL-first" -- build something through exploration in the REPL and then turn whatever you did in the

Re: Disk based caching for Clojure app

2015-03-06 Thread Michael Blume
Possibly stupid question: can you just pretend you have more memory than you do and let the operating system do the heavy lifting? On Fri, Mar 6, 2015, 10:54 AM JPatrick Davenport wrote: > Hello, > I'm been thinking about an idea for a cache layer. It's driven by two > trends. > > Most caches ar

Re: Is Caribou Dormant ?

2015-02-25 Thread Michael Blume
Sure looks dormant to me. My usual rule is, if you think you'd feel comfortable maintaining it yourself if it ever became necessary, use it, otherwise look elsewhere. On Wed, Feb 25, 2015 at 3:36 PM Geraldo Lopes de Souza wrote: > Hi, > > I'm checking Caribou, and wanna know if anyone is using i

Re: Continuously Integrating Leiningen Projects

2015-02-18 Thread Michael Blume
lein-git-version: > > https://github.com/cvillecsteele/lein-git-version > > Which seems to follow project middleware approach you describe, but > for a different use case. > > R. > > On 18 February 2015 at 06:18, Michael Blume wrote: > > We use a Leiningen plugin to set th

Re: Continuously Integrating Leiningen Projects

2015-02-17 Thread Michael Blume
which I'm > expecting to keep more current. > > R. > > On 17 February 2015 at 19:14, Michael Blume wrote: > > Related -- we run lein ancient as part of a lot of our builds so that we > can > > easily pick up dependencies with newer available versions. >

Re: Continuously Integrating Leiningen Projects

2015-02-17 Thread Michael Blume
Related -- we run lein ancient as part of a lot of our builds so that we can easily pick up dependencies with newer available versions. On Tue Feb 17 2015 at 11:13:44 AM Michael Blume wrote: > What we do at Climate is avoid SNAPSHOT builds. Every build gets a version > string with timesta

Re: Continuously Integrating Leiningen Projects

2015-02-17 Thread Michael Blume
What we do at Climate is avoid SNAPSHOT builds. Every build gets a version string with timestamp and git commit. If an upstream library is changed, it's up to downstream maintainers to update their dependency on it. If you update a dependency and your build fails, you a) don't update your dependenc

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Michael Blume
Basically same way you profile java, I usually use jvisualvm, if you feel like shelling out for yourkit that can be nicer. On Sat Feb 14 2015 at 11:23:12 AM Ivan L wrote: > What is the best way to profile Clojure? I tried a reduce doto thing but > it was way slowe than apply str. would love to

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Michael Blume
...Annoyingly, almost all the time for my version is spent in protocol dispatch, so there's probably a much faster way to do that. On Sat Feb 14 2015 at 12:21:11 AM Michael Blume wrote: > er, s/(comp val)/val > > On Sat Feb 14 2015 at 12:17:18 AM Michael Blume > wrote: > &

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Michael Blume
er, s/(comp val)/val On Sat Feb 14 2015 at 12:17:18 AM Michael Blume wrote: > For minimal change to the presented code, what about > > (defprotocol appendable (append-to [this ^StringBuilder sb])) > > (extend-protocol appendable > String > (append-to [this ^StringBu

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Michael Blume
For minimal change to the presented code, what about (defprotocol appendable (append-to [this ^StringBuilder sb])) (extend-protocol appendable String (append-to [this ^StringBuilder sb] (.append sb this)) clojure.lang.IFn (append-to [this ^StringBuilder sb] (this sb)) Object (append-t

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Michael Blume
Feb 12 2015 at 12:06:28 PM Jorge Marques Pelizzoni < jorge.pelizz...@gmail.com> wrote: > Well, that's a bug then :) And seems to have been fixed. Thanks! > > Em quinta-feira, 12 de fevereiro de 2015 17:51:13 UTC-2, Michael Blume > escreveu: > >> Oh, well this is fu

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Michael Blume
Oh, well this is fun -- with bleeding edge clojure I get the right answer, but with 1.6.0 I see the same results you did. On Thu Feb 12 2015 at 11:47:54 AM Michael Blume wrote: > Strange, when I run your code I don't get 9 or 15 > > On Thu Feb 12 2015 at 11:02:00 AM Jorge Mar

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Michael Blume
Strange, when I run your code I don't get 9 or 15 On Thu Feb 12 2015 at 11:02:00 AM Jorge Marques Pelizzoni < jorge.pelizz...@gmail.com> wrote: > Hi, there! Please bear with me as I am very new to Closure (this is my > second program ever) but have a kind of solid Haskell background. > > I was tr

Re: Is this the good way to write get-percentage

2015-02-11 Thread Michael Blume
I think you could replace your condp = with case, since all your mode keywords are known at compile-time, otherwise looks about right. On Tue Feb 10 2015 at 11:32:58 PM Cecil Westerhof wrote: > I needed a function to get the percentage as an int. Input is place and > total-count. > I want the no

Inconsistency in overflow handling between type-hinted and reflective calls

2015-02-09 Thread Michael Blume
(import 'java.io.DataOutputStream) (import 'java.io.ByteArrayOutputStream) (defn- ->bytes "Convert a Java primitive to its byte representation." [write v] (let [output-stream (ByteArrayOutputStream.) data-output (DataOutputStream. output-stream)] (write data-output v) (seq (.

Re: print-table bug?

2015-02-02 Thread Michael Blume
Difference looks like so: https://github.com/MichaelBlume/clojure/compare/pr-str-table On Mon Feb 02 2015 at 12:49:42 PM Steve Miner wrote: > Looks like a bug in clojure.pprint/print-table. Probably should be use > `pr-str` instead of `str`. > > user=> (str ()) > "clojure.lang.PersistentList$

Re: call superclass constructor in clojure class generation with defrecord

2015-02-01 Thread Michael Blume
Yes, but that's for methods you're overriding and OP wants a constructor On Sun, Feb 1, 2015, 12:22 AM Fluid Dynamics wrote: > On Saturday, January 31, 2015 at 6:34:10 PM UTC-5, Michael Blume wrote: >> >> The defn wrapping the call to proxy basically is the constructo

Re: call superclass constructor in clojure class generation with defrecord

2015-01-31 Thread Michael Blume
27;m thinkingin something like this > > (defn MyWindow [] > (proxy [Window] ["My windows!!"] > (MyWindow [] (. this addComponent (Label. "Bang!!") > > is it wrong no? :D > > thanks!!! > > El viernes, 30 de enero de 2015, 18:47:48 (UTC-4:

Re: call superclass constructor in clojure class generation with defrecord

2015-01-30 Thread Michael Blume
(defn my-window [] (proxy [Window] [])) should do the trick Proxy takes a vector of implemented interfaces and at most one superclass (in your case, Window), and then a second vector of arguments to pass to the superclass constructor (in your case, an empty vector) and then a series of methods

Re: aot resolve question

2015-01-23 Thread Michael Blume
Not sure what to tell you. If you can post code we can use to reproduce the problem, that would help. Alternately, put some println statements into load-sym so you can be sure it's getting the values you think it is? On Tue Jan 20 2015 at 11:45:34 PM bob wrote: > Hi, > > I have a function > > (d

Re: vectorz, "Unable to find implementation", uberjar, excluding source

2015-01-23 Thread Michael Blume
If you want to keep jar size down and avoid class loader problems, instead of excluding source I'd avoid aot and only ship source. If you need the JVM to find your main class you can write a shim and only aot-compile that. On Wed Jan 21 2015 at 12:36:03 PM Brian Craft wrote: > Fixed it by adding

Re: Satisfies? seems strangely slow

2015-01-22 Thread Michael Blume
sympathy for how the JVM operates. > > > On Thursday, January 22, 2015 at 11:10:56 PM UTC-5, Michael Blume wrote: > >> It sounds like basically dispatch is fast because we bothered to make it >> fast (by caching) and satisfies? is slow because we didn't. Is it worth >>

Re: Satisfies? seems strangely slow

2015-01-22 Thread Michael Blume
x27;s class, then if necessary walks up the superclass chain. > > [1] > https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L507-L516 > > > > On Thursday, January 22, 2015 at 8:36:23 PM UTC-5, Michael Blume wrote: > >> Extends seems to be defeat

Re: Satisfies? seems strangely slow

2015-01-22 Thread Michael Blume
mented > by x". > > The docs don't seem to give much help here, so play with it in the repl a > bit. > > Timothy > > On Thu, Jan 22, 2015 at 6:14 PM, Michael Blume > wrote: > >> (defprotocol my-protocol >> (foo [this])) >> >> (extend-

Satisfies? seems strangely slow

2015-01-22 Thread Michael Blume
(defprotocol my-protocol (foo [this])) (extend-protocol my-protocol clojure.lang.IPersistentMap (foo [this] "hello from map")) (criterium.core/quick-bench (satisfies? my-protocol {})) (criterium.core/quick-bench (foo {})) Simply calling foo on an empty map takes 7 ns, but checking whe

Re: Testing macros that throw errors at compile time?

2015-01-22 Thread Michael Blume
macroexpand-1 is a good start, I'd also recommend using the (is (thrown? ...)) special form, so (is (thrown? IllegalArgumentException (macroexpend-1 '(my-macro (ill-formed-arguments ...) On Thu Jan 22 2015 at 5:05:36 PM Ben Wolfson wrote: > (try (macroexpand-1 '(my-macro (ill-formed-argumen

Re: [ANN] clojure.jdbc 0.4.0-beta1: A jdbc library for clojure.

2015-01-11 Thread Michael Blume
I'm a little confused, by "last major release" do you mean the most recent major release or do you mean clojure.jdbc is about to move into maintenance mode? On Sun Jan 11 2015 at 3:02:51 AM Andrey Antukh wrote: > Hello! > > I wanted to announce the last major release of clojure.jdbc, a jdbc > li

Re: Extend causes error in servlet container?

2015-01-06 Thread Michael Blume
make your problem go away. On Tue Jan 06 2015 at 1:29:39 PM Michael Blume wrote: > TL;DR: If you wait for that lein-ring pull to get merged, you can upgrade > lein-ring and your problem will go away. If you wait for Clojure 1.7.0 it's > possible your problem will go away, though I&#x

Re: Extend causes error in servlet container?

2015-01-06 Thread Michael Blume
oes. It has an initialize! function which, at run-time, rather than at compile-time, manually imports your real handler and sticks it in an atom. Then the handler exposed to ring just reads the real handler out of the atom and applies it to the incoming request. On Tue Jan 06 2015 at 1:24:4

Re: Extend causes error in servlet container?

2015-01-06 Thread Michael Blume
lein-ring uses AOT compilation to build war files. AOT compilation in clojure is, well, problematic sometimes. Fortunately it can almost always be avoided using clever indirection. For example: https://github.com/pdenhaan/extend-test/pull/1 builds a war that works =) I've got a pull open against

Re: lein uberjar not creating class files with :aot

2015-01-03 Thread Michael Blume
(in the clojure.java.jdbc namespace, I should have said) On Sat Jan 03 2015 at 12:43:31 PM Michael Blume wrote: > it's hard to say exactly what's going on without tinkering with your > project, but Connectable is found in the clojure.java.jdbc, so I'd make > absolutely

Re: lein uberjar not creating class files with :aot

2015-01-03 Thread Michael Blume
it's hard to say exactly what's going on without tinkering with your project, but Connectable is found in the clojure.java.jdbc, so I'd make absolutely sure that namespace has been required before Connectable is referred to. And then, well, if it were me, I'd just ditch AOT. In my experience it cau

Re: How to handle fn args in a macro ?

2015-01-01 Thread Michael Blume
Sorry, that should be (defmacro listen [[topic-sym topic-name] & body] `(on-message ~topic-name (fn [~topic-sym] (~@body) On Thu Jan 01 2015 at 11:01:53 PM Michael Blume wrote: > If it were me I'd avoid making 'topic a "magic symbol" and let the use

Re: How to handle fn args in a macro ?

2015-01-01 Thread Michael Blume
If it were me I'd avoid making 'topic a "magic symbol" and let the user choose a symbol to bind. It'd look something like (defmacro listen [[topic-sym topic-name] & body] `(on-message ~topicname (fn [~topic-name] (~@body) (listen [topic "topic-test"] (println topic "test)) this way

Re: :keys and :or destructuring where defaults refer to one another

2014-12-11 Thread Michael Blume
riting your code, > try evaluating your form quoted with macroexpand. > > Here's a gist with the macroexpansion each form. > > https://gist.github.com/aamedina/542b084d31d4e0c9a7a8 > > Hopefully the expansion makes things clear! > > On Thursday, December 11, 2014 6:11:59 PM

:keys and :or destructuring where defaults refer to one another

2014-12-11 Thread Michael Blume
If I make my defaults on a :keys :or destructuring depend on the values of other keys, I *can* get a compile-time error, depending on what order I give the keys https://gist.github.com/MichaelBlume/4891dafdd31f0dcbc727 Is this on-spec behavior? Should the former be allowed but not the latter? Shou

Re: Wouldn't it be nice if if-let allowed more bindings?

2014-11-26 Thread Michael Blume
Instead of the deshadowing logic, why not (defn if-and-let* [bindings then-clause else-fn-name] (if (empty? bindings) then-clause `(if-let ~(vec (take 2 bindings)) ~(if-and-let* (drop 2 bindings) then-clause else-fn-name) (~else-fn-name (defmacro if-and-let [bindin

Re: Get the value of the persistentArrayMap from the exception which was thrown

2014-11-05 Thread Michael Blume
Well, from the print of the exception, it looks unlikely, but let's look at the code. This stacktrace says the exception was thrown in line 429 of clojure.lang.AFn, and I'm going to assume you're using Clojure 1.6.0, so we want https://github.com/clojure/clojure/blob/clojure-1.6.0/src/jvm/cloju

Re: [ANN] Clojure 1.7.0-alpha3 now available

2014-10-31 Thread Michael Blume
Picking up the variadic arguments discussion, it seems that in a simple definition like (fn [& args] (apply f arg1 args)) One could conceivably put some sort of preprocessing smarts into the fn macro that notices that a) this is a variadic arglist b) the variadic arg (args) is a symbol, not so

Re: Why is my function faster with eval?

2014-10-10 Thread Michael Blume
t;> first >> (take-while (complement #{""})) >> (map keyword))] >> (map (partial zipmap headers) (rest rows >> >> (defn read-to-maps-fn [rows] >> (let [headers (->> >>

Why is my function faster with eval?

2014-10-10 Thread Michael Blume
So I'm reading a bunch of rows from a huge csv file and marshalling those rows into maps using the first row as keys. I wrote the function two ways: https://gist.github.com/MichaelBlume/c67d22df0ff9c225d956 and the version with eval is twice as fast and I'm kind of curious about why. Presumably

Re: Where can one find low hanging fruit for open source contribution?

2014-10-09 Thread Michael Blume
Agree with Michael Klishin, I've gotten a few patches into Leiningen as a relative Clojure newb and the maintainers have been super friendly and helpful. On Friday, September 26, 2014 11:45:18 PM UTC-7, Michael Klishin wrote: > > On 27 September 2014 at 10:34:28, kurofune (jessel...@gmail.com >

Re: vim-fireplace debug workflow: modifying jars

2014-03-27 Thread Michael Blume
Don't worry about the jar, especially. You can have your own git checkout of the upstream project you're working with, and that'll work just fine. Open a source file you need to work with, connect with nrepl, edit a function, and eval -- that should be enough. On Thursday, March 27, 2014 11:43:

Re: Calling from a macro to a private macro

2014-03-17 Thread Michael Blume
You don't have the macro generate a call to the private function, you have the macro call the private function directly replace: (defmacro call-self* [x] `(~x ~x)) (defmacro call-self [x] `(do (println "calling form " ~(str x) " with itself") (call-self ~x))) with: (defn- call-sel

deadlock when using clojure data structures at startup

2014-01-30 Thread Michael Blume
I work on a Java team, so our use of clojure is either a) calling into clojure from java or b) directly using the clojure data structures. Recently we had an app fail because, as it was starting up, one thread was trying to require a clojure namespace, and another was trying to use a PersistentHa

Re: odd failure on recursive use of protocol member

2013-12-10 Thread Michael Blume
ersion, you will get > the behaviour you expected > > On 12/10/13, 11:50 AM, Michael Blume wrote: > > I have a protocol RestSerializable to represent data that can be > serialized > > to json from a REST interface. > > > > (defprotocol RestSerializable > >

odd failure on recursive use of protocol member

2013-12-10 Thread Michael Blume
I have a protocol RestSerializable to represent data that can be serialized to json from a REST interface. (defprotocol RestSerializable (rest-serialize [this] "Convert to something Cheshire can JSONify")) By default, things are left alone (extend Object RestSerializable {:rest-seriali

Re: Functions using locks are slowed even when locks are never taken

2013-11-17 Thread Michael Blume
et loaded from the fields in the > body of the closure's invoke method etc. > > I guess I'll have to play around with Java equivalents too... > > Cheers, > Michał > > > On 3 November 2013 20:46, Michael Blume wrote: > > I mean, I'm probably being naive,

Re: Functions using locks are slowed even when locks are never taken

2013-11-03 Thread Michael Blume
e.core should be changed? On Sun, Nov 3, 2013 at 11:09 AM, Michael Blume wrote: > Huh, interesting. > > I have: > > (defn foo' [x] > (if (> x 0) > (inc x) > (let [res (locking o (dec x))] res))) > > (defn foo'' [x] > (if (> x

Re: Functions using locks are slowed even when locks are never taken

2013-11-03 Thread Michael Blume
point to > locking as the user-facing equivalent to Java's synchronized. > > Cheers, > Michał > > > On 1 November 2013 19:34, Michael Blume > > wrote: > > https://github.com/MichaelBlume/perf-test > > > > (ns perf-test > &g

Re: Functions using locks are slowed even when locks are never taken

2013-11-02 Thread Michael Blume
otherwise no, but I'm not sure how that dovetails with Clojure' fn > compilation. > > On Friday, November 1, 2013 11:53:12 AM UTC-7, Michael Blume wrote: >> >> Since 1.6 alpha is out, I reran the tests with that -- basically the same >> results. >>

Re: Scala interop (or, aliasing imported Java classes)

2013-11-01 Thread Michael Blume
I ran into this problem using inner-class enums and wound up writing a macro to generate aliases for me. You could do something similar: (defmacro def-class-alias "Make name reference class (def-class-alias class-name foo.bar.baz.SomeClass) (class-name foo) -> foo.bar.baz.SomeClass/foo

Re: Functions using locks are slowed even when locks are never taken

2013-11-01 Thread Michael Blume
Since 1.6 alpha is out, I reran the tests with that -- basically the same results. On Friday, November 1, 2013 11:34:15 AM UTC-7, Michael Blume wrote: > > https://github.com/MichaelBlume/perf-test > > (ns perf-test > (:use (criterium core)) > (:gen-class)) > > (def o

Functions using locks are slowed even when locks are never taken

2013-11-01 Thread Michael Blume
https://github.com/MichaelBlume/perf-test (ns perf-test (:use (criterium core)) (:gen-class)) (def o (Object.)) (defn foo [x] (if (> x 0) (inc x) (do (monitor-enter o) (let [res (dec x)] (monitor-exit 0) res (defn bar [x] (if (> x 0) (inc x)

Re: ClassNotFoundException: clojure.tools.logging.impl.LoggerFactory

2013-03-22 Thread Michael Blume
This seems to be a recurring issue. I don't see a public list/bug tracker for clojure.tools.logging, so I'm not clear on where I'm supposed to bring this bug. On Friday, March 15, 2013 9:36:32 AM UTC-7, Michael Blume wrote: > > I'm seeing this problem in my builds

ClassNotFoundException: clojure.tools.logging.impl.LoggerFactory

2013-03-15 Thread Michael Blume
I'm seeing this problem in my builds more or less randomly, and don't seem to be the only one http://stackoverflow.com/questions/8291910/noclassdeffounderror-with-clojure-tools-logging https://groups.google.com/forum/#!msg/datomic/6xWGFB-Dx68/_Hr2I4lv39gJ http://clojure-log.n01se.net/date/2012-