Re: Using an atom for a caching map

2014-09-01 Thread Thomas Heller
As much as I like Clojure and atoms, I do not think they are a good fit for caching. Not only is it impossible to address the concurrency issues related to multiple threads loading the same object, but you also have to do expiration and size management yourself. Immutability doesn't help much

Re: Using an atom for a caching map

2014-09-01 Thread Colin Fleming
Hi Beau, I've not used the STM stuff at all, but my understanding is that dosync is intended for co-ordinated updates to refs, and has no effect on atoms. It's really intended for co-ordinating updates to multiple refs rather than as a synchronisation primitive on a single entity. I might be

Re: Using an atom for a caching map

2014-09-01 Thread Colin Fleming
Hi Marcus, That's an interesting approach. My first reaction was that the update is still not atomic, since you have: (when-not (contains? @cache k) (swap! cache assoc k (calc-value* k))) Which I thought could cause different clients to see different values depending on the race condition

Re: Using an atom for a caching map

2014-09-01 Thread Colin Fleming
Hi Thomas, Normally I'd agree with you, but in my case it actually works quite well since I don't need to expire or worry about sizing. This is for caching objects on IntelliJ parse tree elements, and the element with its cached values is thrown away every time the document is parsed, so these

Re: Using an atom for a caching map

2014-09-01 Thread Thomas Heller
Hey Colin, That doesn't mean guava wouldn't be a nice solution here still. Just .invalidateAll to purge it. Might even use softValues to let the gc decide to remove some entries when running low on memory. Emulating a mutable thing in clojure with an atom is not always better than using the

Re: Using an atom for a caching map

2014-09-01 Thread Beau Fabry
Indeed you're right, I was confused. The dosync call was a naive attempt to avoid the CAS operation you were worried about earlier. I suppose another option would be to use compare-and-set! with a lazy seq. (compare-and-set! cache-atom (dissoc @cache-atom k) (assoc @cache-atom k (lazy-seq

[ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
Hi all, there's a new version of Gorilla REPL out :-) The headline feature is that the autocomplete UI now shows the docs for the function you're typing/lets you browse the docs. It's really handy! Autocomplete itself is also much improved, courtesy of the compliment library. This version

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
Ohh, and there are some new docs on how to use Gorilla alongside your favourite editor/IDE: http://gorilla-repl.org/editors.html Jony -- 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

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Beau Fabry
Started looking into Gorilla for use at work today. Even prior to this release I was incredibly impressed. Amazing work everyone involved. On Monday, September 1, 2014 9:12:49 PM UTC+10, Jony Hudson wrote: Ohh, and there are some new docs on how to use Gorilla alongside your favourite

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Bozhidar Batsov
vim-fireplace uses cider-nrepl (when available, otherwise it will fallback to evaling inlined code) as well, so the Emacs rules should apply for it. — Cheers,  Bozhidar On September 1, 2014 at 2:12:53 PM, Jony Hudson (jonyepsi...@gmail.com) wrote: Ohh, and there are some new docs on how to use

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Bozhidar Batsov
On September 1, 2014 at 2:11:40 PM, Jony Hudson (jonyepsi...@gmail.com) wrote: Hi all,  there's a new version of Gorilla REPL out :-) The headline feature is that the autocomplete UI now shows the docs for the function you're typing/lets you browse the docs. It's really handy! Autocomplete

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
On Monday, 1 September 2014 13:16:36 UTC+1, Bozhidar Batsov wrote: Thanks! :-) You might also find the var-info middleware quite useful - cider and fireplace use it for code navigation and enhanced documentation (eldoc and a replacement for (doc something) that works for both

Re: Using an atom for a caching map

2014-09-01 Thread Marcus Magnusson
On inspecting the source for memoize, it would actually seem (to my eyes, someone please correct me if I'm mistaken) to be using a similar approach to what has been suggested earlier in the discussion, with the risk of re-computing values at concurrent invocations with the same arguments. So

[ANN] Prone: Exception/debugging middleware

2014-09-01 Thread Christian Johansen
Hi, Prone (http://clojars.org/prone - http://github.com/magnars/prone) is a new middleware for Ring apps that replaces the default exception page with an interactive page that presents the exception, stack trace and environment data in a more easily understandable way. It can also debug

Re: Howto Load Project Namespaces in Leiningen Plugins

2014-09-01 Thread Nelson Morris
When writing lein plugins you have to think about if they should do work in lein's vm or the project's vm. In this case, since you want to load namespaces from the project, the work will need to be done in the project's vm. This is where `leiningen.core.eval/eval-in-project` is used, to spin up

Re: How can I add meta to an object that doesn't implement IObj?

2014-09-01 Thread adrian . medina
Sorry, I overlooked that you already ruled out all IDeref instances. On Sunday, August 31, 2014 10:21:39 PM UTC-4, Atamert Ölçgen wrote: On Mon, Sep 1, 2014 at 1:52 AM, adrian...@mail.yu.edu javascript: wrote: If you don't want to wrap the object in an atom, you can also reify an

Re: How can I add meta to an object that doesn't implement IObj?

2014-09-01 Thread James Reeves
I'm not sure whether this would apply in your case, but have you considered using a WeakHashMap instead of Clojure's metadata? - James On 31 August 2014 09:55, Atamert Ölçgen mu...@muhuk.com wrote: Hi Francis, On Sat, Aug 30, 2014 at 1:34 PM, Francis Avila franci...@gmail.com wrote: It

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Lee Spector
On Sep 1, 2014, at 7:15 AM, Beau Fabry imf...@gmail.com wrote: Started looking into Gorilla for use at work today. Even prior to this release I was incredibly impressed. Amazing work everyone involved. inc The new docs feature is a thing of beauty. -Lee -- You received this message

New Functional Programming Job Opportunities

2014-09-01 Thread Functional Jobs
Here are some functional programming job opportunities that were posted recently: Senior Software Engineer (Functional) at McGraw-Hill Education http://functionaljobs.com/jobs/8737-senior-software-engineer-functional-at-mcgraw-hill-education Cheers, Sean Murphy FunctionalJobs.com --

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Stuart Halloway
Hi Jony, Is there a path for using Gorilla REPL from a maven or gradle project? Thanks, Stu On Mon, Sep 1, 2014 at 7:11 AM, Jony Hudson jonyepsi...@gmail.com wrote: Hi all, there's a new version of Gorilla REPL out :-) The headline feature is that the autocomplete UI now shows the docs

Re: clojure streams

2014-09-01 Thread Alex Miller
Yeah, will do. Core.async channels and transducers solve similar problems today. On Aug 31, 2014, at 2:36 PM, Andy Fingerhut andy.finger...@gmail.com wrote: Found it: Don't worry about streams - they lost to chunked seqs. Any vestiges just need to be removed. -- Rich

clojure logo copyright

2014-09-01 Thread lavokad l
Hi, I want to design my own t-shirt, cup and maybe something else putting on clojure logo and some words on zazzle.es web. On http://clojure.org/swag page there is* Design your own custom tee shirt online at Zazzle. * So, while it's not for commercial use is it legal to download a clojure logo

Re: Useless Java error messages

2014-09-01 Thread Luc Prefontaine
Where do you see a Java error here ? I see the Clojure implementation reporting that you are trying to apply a numeric operator to a null/nil value :) I agree the JVM stack traces are not nice and polluted by all the frames which may/may not be relevant. The messages are not always as clear as

Re: clojure logo copyright

2014-09-01 Thread Alex Miller
On Monday, September 1, 2014 6:58:59 AM UTC-5, lavokad l wrote: Hi, I want to design my own t-shirt, cup and maybe something else putting on clojure logo and some words on zazzle.es web. On http://clojure.org/swag page there is* Design your own custom tee shirt online at Zazzle. * So,

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
Beau, Lee - thanks for the kind words - glad you're enjoying it! Stu - I've no experience of running Clojure under either maven or gradle, but my guess is that it won't work out-of-the-box yet. Currently, Gorilla launches by using Leiningen to run its own server process in the classpath of the

Re: Using an atom for a caching map

2014-09-01 Thread Alex Baranosky
I believe you can replace: (when-not (contains? @cache k) (swap! cache assoc k (calc-value* k with: (swap! cache (fn [cache'] (if (contains? cache' k) cache' (assoc cache' k (calc-value* k) Note: I haven't run this code On Mon, Sep 1,

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Stuart Halloway
Hi Jony, A feature allowing connection to an external nREPL server would be great, and totally usable by anyone who can make a CLASSPATH. Having to install a particular build system (whether gradle, lein, or maven) in order to use a tool is a non-starter for 90% of the projects I am involved

Re: Using an atom for a caching map

2014-09-01 Thread Marcus Magnusson
I reckon if that worked, there would be no need for memoize anyway, but I don't think swap! will allow for it. I'm far from an expert on swap! or atoms, but several swap!s may be run simultaneously on a single atom (and swap! may re-run the swapping function if the atom has been changed since

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Stuart Halloway
And now, answering part of my own question. It appears the following almost just works from a maven project that references gorilla: (require '[gorilla-repl.core :as gorilla]) (gorilla/run-gorilla-server {:port 8990}) The only problem is that gorilla's declaration of its own dependencies

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Gary Trakhman
It works inside of lein because lein adds REPL-y to the classpath of the project, which adds clojure-complete. Cider used to be coupled to this before we gutted it. On Mon, Sep 1, 2014 at 4:56 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: And now, answering part of my own question. It

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
Ahh, nice, yes that's a simple way to do it if you can manage to add the code somewhere. Regarding the dependencies - Leiningen adds both of the dependencies you list. I did declare them explicitly at one point, but I recall having some odd error, so I decided to take them back out rather than

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Stuart Halloway
Hi Jony, I sent you a pull request. I believe adding those items is correct and necessary for producing a usable JAR, and that the build works so long as you have a recent version of leiningen. Stu On Mon, Sep 1, 2014 at 5:04 PM, Jony Hudson jonyepsi...@gmail.com wrote: Ahh, nice, yes

Re: Using an atom for a caching map

2014-09-01 Thread Marcus Magnusson
Huh, I gave it some more thought - of course, the reason why memoize won't help us here is that there is no synchronization between simultaneous invocations with the same set of arguments. This is typically not a problem if the underlying function is fast, but in our case it would be neat with

Re: Useless Java error messages

2014-09-01 Thread gvim
On 01/09/2014 17:50, Luc Prefontaine wrote: Where do you see a Java error here ? I see the Clojure implementation reporting that you are trying to apply a numeric operator to a null/nil value :) I agree the JVM stack traces are not nice and polluted by all the frames which may/may not be

Re: Useless Java error messages

2014-09-01 Thread Softaddicts
Ah ! Emacs, an old friend that I should eventually revisit after 30 years... Long time no see :) Luc P. On 01/09/2014 17:50, Luc Prefontaine wrote: Where do you see a Java error here ? I see the Clojure implementation reporting that you are trying to apply a numeric operator to a

Re: Using an atom for a caching map

2014-09-01 Thread Marcus Magnusson
Forget about sleep, there's work to be done! I realized that the drawback I mentioned with my solution, where concurrent calls to the memoized function with different sets of arguments would be handled one-by-one, could easily be resolved by having the cache inside synced-memoize store futures

Re: Useless Java error messages

2014-09-01 Thread Beau Fabry
The pretty-errors leiningen plugin might be worth a look On Tuesday, September 2, 2014 7:58:31 AM UTC+10, g vim wrote: On 01/09/2014 17:50, Luc Prefontaine wrote: Where do you see a Java error here ? I see the Clojure implementation reporting that you are trying to apply a

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Beau Fabry
For what it's worth we're using Gorilla *after* leiningen. Leiningen is used to make an uberjar, but then we start the gorilla server in our own main. This is because we're running gorilla inside of our hadoop environment. This way we have a gorilla instance that can issue live cascalog

Re: Useless Java error messages

2014-09-01 Thread Jason Wolfe
Looks like you figured this out, but sharing in case it helps others. It turns out the JVM actually has a special caching mechanism for making NullPointerExceptions fast (and near-impossible to debug): http://stackoverflow.com/a/3010106 This link also has a JVM opt to stop this optimization,

Re: [ANN] Prone: Exception/debugging middleware

2014-09-01 Thread Colin Fleming
I don't do any web dev myself, but Prone looks really nice - congratulations! Great work. Cheers, Colin On 2 September 2014 02:05, Christian Johansen christ...@cjohansen.no wrote: Hi, Prone (http://clojars.org/prone - http://github.com/magnars/prone) is a new middleware for Ring apps that

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Beau Fabry
Just a little bit of showing off of the previous post :-) http://i.imgur.com/zpfP9Ja.png On Tuesday, September 2, 2014 9:36:50 AM UTC+10, Beau Fabry wrote: For what it's worth we're using Gorilla *after* leiningen. Leiningen is used to make an uberjar, but then we start the gorilla server in

[ANN] Constraint Programming in Clojure: clojure2minizinc -- initial release

2014-09-01 Thread Torsten Anders
Dear Clojure community, clojure2minizinc provides an interface between state-of-the-art constraint solvers (via MiniZinc) and Clojure. The clojure2minizinc user models in Clojure constraint satisfaction or optimisation problems over Boolean, integer, real number, and/or set variables.

Re: [ANN] Prone: Exception/debugging middleware

2014-09-01 Thread James Reeves
This looks rather nice. I'll certainly be trying it out. - James On 2 September 2014 01:06, Colin Fleming colin.mailingl...@gmail.com wrote: I don't do any web dev myself, but Prone looks really nice - congratulations! Great work. Cheers, Colin On 2 September 2014 02:05, Christian

Re: Howto Load Project Namespaces in Leiningen Plugins

2014-09-01 Thread Timothy Washington
Awesome, thanks for the feedback. That all makes sense. And yes, the work will be done in the project's VM. I guess what I'm missing is something more basic. If you look at lein-midje https://github.com/marick/lein-midje/blob/master/src/leiningen/midje.clj#L168 or lein-spec

Re: Howto Load Project Namespaces in Leiningen Plugins

2014-09-01 Thread Timothy Washington
Or (ignoring the previous) getting even more basic... *$ tree* . |-- LICENSE |-- pom.xml |-- project.clj |-- README.md `-- src `-- leiningen `-- zzz.clj *$ cat src/leiningen/zzz.clj * (ns leiningen.zzz (:require [leiningen.core.eval :refer [eval-in-project]])) (defn zz []

Re: Howto Load Project Namespaces in Leiningen Plugins

2014-09-01 Thread Timothy Washington
Ok, I figured it out... :) Something in my *~/.lein/profiles.clj* was screwing things up. It was one of the repl-options, because when I turned those off, things just started to work. Hope this helps someone in future. #_:repl-options #_{:nrepl-middleware

Re: [ANN] Prone: Exception/debugging middleware

2014-09-01 Thread Kurt Schrader
Outstanding work!  Just plugged it locally and used it to debug a particularly hairy issue on my side. This is super useful. -Kurt On Mon, Sep 1, 2014 at 10:48 PM, James Reeves ja...@booleanknot.com wrote: This looks rather nice. I'll certainly be trying it out. - James On 2