Possible to add dependency within leiningen plugin dynamically?

2013-07-11 Thread Chris Kuttruff
Eg: I have a leiningen plugin I'm building that calls some jdbc stuff, but the specific driver would be specified in the project that brings in my plugin as a dependency. Would this be possible? If so, how would I go about it? Was looking into leinjacker, but having trouble accomplishing

Re: Possible to add dependency within leiningen plugin dynamically?

2013-07-11 Thread Shantanu Kumar
On Thursday, 11 July 2013 12:24:34 UTC+5:30, Chris Kuttruff wrote: Eg: I have a leiningen plugin I'm building that calls some jdbc stuff, but the specific driver would be specified in the project that brings in my plugin as a dependency. Can you describe your use case with an example

Re: Possible to add dependency within leiningen plugin dynamically?

2013-07-11 Thread Chris Kuttruff
Shantanu, thanks for the reply; yes, that definitely seems like a similar situation. I will take a close look at that code tomorrow. Here is the example that you requested: Entry point for the plugin: https://github.com/ckuttruff/clj-sql-up/blob/master/src/leiningen/clj_sql_up.clj Function

Re: core.async pub/sub

2013-07-11 Thread Thomas Heller
Hey, the lab stuff looks very interesting, I however couldn't quite figure out how to unsubscribe one channel from the broadcast since I cannot exchange the topic for every subscriber when one subscriber decides to leave. Its also a lot lower level than I'm currently comfortable with since I

Re: java.jdbc - (sql/where ...) with multiple values (i.e. 'x in (1,2,3')

2013-07-11 Thread Max Penet
Honeysql is nice but it only supports select statements FYI. That said it's probably easy to extend, but my point is that it's far from complete, so I am not sure it's a good recommendation at the moment. -- -- You received this message because you are subscribed to the Google Groups Clojure

Re: cljx 0.3.0 released

2013-07-11 Thread Thomas Heller
This is awesome, thanks a ton. Solved all the issues I had with 0.2 Cheers, /thomas On Wednesday, July 10, 2013 8:26:03 PM UTC+2, Chas Emerick wrote: Earlier today, we released [com.keminglabs/cljx 0.3.0], which brings a bunch of significant changes and improvements:

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
OK thanks Brian - I've managed to reproduce it with this config. I'll figure out a fix and do a new release in the next couple of hours. On Thursday, 11 July 2013 01:52:16 UTC+1, Brian Craft wrote: [org.clojure/clojure 1.5.1] [net.mikera/core.matrix 0.8.0] [net.mikera/vectorz-clj 0.10.0]

Re: Documentation / usage --- Array vs. Vector

2013-07-11 Thread Mikera
This is a heavily overloaded naming space - especially when you consider code.matrix as well, and usage of these words in mathematical / scientific communities. Data scientists generally expect a vector to be a 1D collection of numeric values, in the same sense that a matrix is a 2D

Group words by their first letter and sum their frequencies

2013-07-11 Thread James Trunk
Hi everyone, I'm new to Clojure and trying to learn my way around the language. I've written a function that sums the frequencies of words starting with the same letter, however I'm not fully satisfied with the result. I'm striving for readability and idomaticity, but I fear that my rather

Stack overflow deep in repl printer

2013-07-11 Thread David Goldfarb
The following pathological case triggers a confusing stack overflow error. *$ lein repl* *...* *user= (def x (atom nil))* *#'user/x* *user= (reset! x x)* * * *StackOverflowError java.util.regex.Pattern$Curly.match (Pattern.java:4125)* * * *;;; Of course, I can avoid the problem:* *user= (set!

Re: Stack overflow deep in repl printer

2013-07-11 Thread Meikel Brandmeyer (kotarak)
David, I wouldn't automatically set any values around the printing. The user should be free to do what he likes. But the repl could start out with some sane defaults, which are not limiting in the usual case, but safe in general. Like 50 for the level and 1000 for the length. Then you are not

core.async: communicating termination

2013-07-11 Thread vemv
Consider a happy, oblivious producer of values: (def c (chan 42)) (go (while true (! c (rand It doesn't know where/now the channel is consumed (which part of the point of channels/queues). However, we *do* know that at some point, nobody will need the result of our producing, so we should

Re: Group words by their first letter and sum their frequencies

2013-07-11 Thread Laurent PETIT
Hello James, 2013/7/11 James Trunk james.tr...@gmail.com: Hi everyone, I'm new to Clojure and trying to learn my way around the language. I've written a function that sums the frequencies of words starting with the same letter, however I'm not fully satisfied with the result. I'm striving

Clojure: Superset of XML, HTML, CSS, JavaScript, Flash (SVG/ActionScript), etc.?

2013-07-11 Thread Alexander Gunnarson
No comments? -- -- 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 with your first post. To unsubscribe from this group,

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
Hi Brian, I've released a new vectorz-clj version to Clojars which should fix the problem: [net.mikera/vectorz-clj 0.11.0] Hopefully that works for you! On Thursday, 11 July 2013 00:44:46 UTC+1, Brian Craft wrote: Without vectorz: = (+ 5 (matrix [1 2 3])) [6 7 8] With vectorz: = (+ 5

Re: vectorz doesn't handle scalars?

2013-07-11 Thread P Martin
I am having a similar error, but it is happening for the vectors. I just updated to the 0.11.0 version of vectorz. I have the following project file: [org.clojure/clojure 1.5.1] [incanter/incanter-core 1.5.1] [incanter/incanter-charts 1.5.1] [net.mikera/vectorz-clj 0.11.0] And I get an

Re: vectorz doesn't handle scalars?

2013-07-11 Thread P Martin
Woops - my error is really different from my prior post. I forgot to put vz/vec in my function call: (vz/+ 5 (vz/vec [1 2 3])) ClassCastException java.lang.Long cannot be cast to mikera.vectorz.AVector mikera.vectorz.core/clone (core.clj:38) On Thursday, July 11, 2013 9:37:06 AM UTC-4, P

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
Ah - that is expected behaviour because you are using the specialised vector-only operators in mikera.vectorz.core. These are fast type-hinted versions of functions (that only work on vectors). If you want to use the broadcasting operations that work with different types, you need to use the

Re: Group words by their first letter and sum their frequencies

2013-07-11 Thread James Trunk
Hello Laurent, Thank you so much for your detailed and helpful reply. You could use the new as- macro in clojure 1.5 Is it possible to get as- to work with thread-last? depends :-) since your 2 fns are helper fns rather than generically-reusable fns, I would make them private to enforce

Re: [ANN] CHP Web Framework Documentation Update

2013-07-11 Thread Steven Degutis
I am. On Wed, Jul 10, 2013 at 2:59 PM, Kelker Ryan theinter...@yandex.com wrote: Thanks. It's currently alpha and there's a lot more to come. Are you by chance the same Degutis from 8th light? 11.07.2013, 02:12, Steven Degutis sbdegu...@gmail.com: Wow. You obviously put a lot of work

Clojure: One language to rule the Web

2013-07-11 Thread Alexander Gunnarson
This idea's been on my mind lately: could Clojure be used as a unifying force for all those disparate file formats and frameworks like: - XML / XLink / XPointer / XQuery, - JSON, - HTML / XHTML, - CSS, - JavaScript / jQuery, - Flash (SVG/ActionScript), - SQL, - and (of course) Java? As a

Re: Clojure: One language to rule the Web

2013-07-11 Thread Gary Trakhman
It's true that many of these systems are equivalently powerful and redundant, but the dominant forces driving them are social, not technical. Fred Brooks's 'The Mythical Man-Month' is the classic book on this topic. In an ideal world, where information flowed freely and instantly, all these

Re: Clojure: One language to rule the Web

2013-07-11 Thread Kelker Ryan
With the exception of XML and Flash, my framework covers all of that https://github.com/runexec/chp 11.07.2013, 23:37, Alexander Gunnarson alexandergunnar...@gmail.com: This idea's been on my mind lately: could Clojure be used as a unifying force for all those disparate file formats and

Re: Group words by their first letter and sum their frequencies

2013-07-11 Thread Andy Fingerhut
There is a link Download other versions with tooltips near the top of the Clojure Cheat Sheet page (http://clojure.org/cheatsheet) that links to versions that are a bit more recent, and they include tooltips of the doc strings when you hover your cursor over the symbol. The version at

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Brian Craft
Yes, that works better, thanks! Is there an element-wise matrix multiply? Maybe I can copy the code for the / operator. On Thursday, July 11, 2013 5:57:30 AM UTC-7, Mikera wrote: Hi Brian, I've released a new vectorz-clj version to Clojars which should fix the problem:

Making RPCs with Shoreleave

2013-07-11 Thread Alex Fowler
Hi all, this is my first experience with Shoreleave and I'm trying to use it's RPC mechanism to perform AJAX tasks. However, on a call to a remote procedure, I get this: ` 1. POST http://localhost:8080/_shoreleave 404 (Not Found) cljs.js:25223http://localhost:8080/js/cljs.js 1.

Re: vectorz doesn't handle scalars?

2013-07-11 Thread P Martin
Ok understood! Thanks for the tip. I'll switch over to the core.matrix system. So as I understand it, I need the vectorz dependencies in my project file, then I use the core.matrix and core.matrix.operators with the :vectorz implementation specified? Thanks! Patrick On Thursday, July 11,

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Brian Craft
Just found emul, which I believe is what I need. On Thursday, July 11, 2013 9:52:12 AM UTC-7, Brian Craft wrote: Yes, that works better, thanks! Is there an element-wise matrix multiply? Maybe I can copy the code for the / operator. On Thursday, July 11, 2013 5:57:30 AM UTC-7, Mikera

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
Elementwise matrix multiply is called emul (clojure.core.matrix/emul) It's named for consistency with the other operations that work on elements, e.g. ecount, esum, emap, ereduce etc. On Thursday, 11 July 2013 17:52:12 UTC+1, Brian Craft wrote: Yes, that works better, thanks! Is there an

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
Yes that should work fine. You can also use (clojure.core.matrix/set-current-implementation :vectorz) if you are working at the REPL / don't want to explicitly ask for a vectorz type every time. It is a global setting however - so use with caution. On Thursday, 11 July 2013 18:14:04 UTC+1, P

Re: Core Logic Reference Documentation

2013-07-11 Thread Benjamin Peter
Hello, I went through the clojure core logic code and picked the functions I though that might go into the cheat sheet. The groups are pretty much defined by the code comments left by David and co.

Re: Core Logic Reference Documentation

2013-07-11 Thread Plínio Balduino
Hey, good job. I missed a cheat sheet like this. Thank you. On Thu, Jul 11, 2013 at 3:06 PM, Benjamin Peter benjaminpe...@arcor.dewrote: Hello, I went through the clojure core logic code and picked the functions I though that might go into the cheat sheet. The groups are pretty much

Re: Core Logic Reference Documentation

2013-07-11 Thread David Nolen
This mostly looks good I remove the references to the defnc, fnc and predc these are very experimental, likely to change, and easy to cause trouble if you're not careful. David On Thu, Jul 11, 2013 at 1:06 PM, Benjamin Peter benjaminpe...@arcor.dewrote: Hello, I went through the clojure

Lamina receive-all functionality

2013-07-11 Thread P Martin
Hi there, I am working on an application using Lamina where I register several callbacks on a channel with receive-all. At some point in the application, I want to cancel all current callbacks. When this occurs the channel appears to close. Why does this happen? Is this a safety feature? For

ANN Elastisch 1.2.0-beta3 is released

2013-07-11 Thread Michael Klishin
Elastisch [1] is a minimalistic Clojure client for ElasticSearch. 1.2.0-beta3 is a development release that adds a minor feature to the REST client and upgrades ElasticSearch dependency to 0.90.2. Release notes: http://blog.clojurewerkz.org/blog/2013/07/11/elastisch-1-dot-2-0-beta3-is-released/

Re: Lamina receive-all functionality

2013-07-11 Thread Zach Tellman
Hi Patrick, A similar question has been asked in the Aleph mailing list, and you can see my answer there: https://groups.google.com/forum/#!topic/aleph-lib/SIO9Z8d3tdo. For future reference, you're more likely to get my attention, or the attention of someone else who can answer your

Re: Clojure: One language to rule the Web

2013-07-11 Thread Alexander Gunnarson
With the exception of XML and Flash, my framework covers all of that https://github.com/runexec/chp Your framework seems very promising. I'll have to play around with it. Any plans for extending it to enclose XML? ActionScript/Flash seems to have been addressed somewhat by

Re: Lamina receive-all functionality

2013-07-11 Thread P Martin
Awesome! After I posted I ran into the permanent-channel in the API docs. Thanks for your help, Patrick On Thursday, July 11, 2013 3:58:47 PM UTC-4, Zach Tellman wrote: Hi Patrick, A similar question has been asked in the Aleph mailing list, and you can see my answer there:

Re: Clojure: One language to rule the Web

2013-07-11 Thread Alexander Gunnarson
As a side note, maybe we can keep a running list of Clojure-ized technologies we're aware of: - XML - *clojure/data.xml https://github.com/clojure/data.xml* - XLink + XPointer + XQuery - *clojure/data.xmlhttps://github.com/clojure/data.xml * - JSON -* Clojure Home Page (CHP)

State monad issue

2013-07-11 Thread JvJ
I'm trying to use a domonad block with the state monad, and I'm running into trouble chaining together multiple monadic instructions. Take this for example: ;; This block of code fetches the value from :a in the state, ;; and then associates a new value for :b if :a is set. (domonad state-m [a

Re: State monad issue

2013-07-11 Thread Ben Wolfson
Is it not possible just to put another domonad block in the true branch of the if? Alternately, it should be possible to do it with an explicit bind operation. On Thu, Jul 11, 2013 at 2:11 PM, JvJ kfjwhee...@gmail.com wrote: I'm trying to use a domonad block with the state monad, and I'm

Re: State monad issue

2013-07-11 Thread JvJ
Yeah it is possible to do it with another domonad block. I just don't want to clutter up the code by repeating myself. I made a macro do-state that introduces a new domonad block using the current state. It works: (defmacro do-state [bindings r] `(fn [st] ( (domonad state-m ~bindings

Multiple REPLs in Emacs? (was: test run startup time

2013-07-11 Thread Sean Corfield
On Wed, Jul 10, 2013 at 10:53 AM, Jay Fields j...@jayfields.com wrote: I work in emacs with 2 repls running - 1 for running my app and 1 for running my tests. What is the magic to get this working and how does Emacs / nrepl.el know which REPL to send commands to? I've often wanted multiple

Re: ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-11 Thread Sean Corfield
On Wed, Jul 10, 2013 at 11:00 AM, Vincent vhenneb...@gmail.com wrote: I guess I can proxy APersistentVector, but the Clojure docs [1] advise to use reify in favour to proxy whenever possible. My goal is to have my byte stream behave like a standard Clojure vector. Given the definition of

Re: Multiple REPLs in Emacs? (was: test run startup time

2013-07-11 Thread Jay Fields
On Thu, Jul 11, 2013 at 5:53 PM, Sean Corfield seancorfi...@gmail.comwrote: On Wed, Jul 10, 2013 at 10:53 AM, Jay Fields j...@jayfields.com wrote: I work in emacs with 2 repls running - 1 for running my app and 1 for running my tests. What is the magic to get this working and how does

Re: Multiple REPLs in Emacs? (was: test run startup time

2013-07-11 Thread Sean Corfield
Thanx Jay. For whatever reason, multiple nREPL buffers has never worked for me before but on reading that I suspect I may just have had incorrect assumptions about how it was actually supposed to work... Sean On Thu, Jul 11, 2013 at 3:10 PM, Jay Fields j...@jayfields.com wrote: On Thu, Jul

Re: core.async: communicating termination

2013-07-11 Thread Alex Miller
I haven't been in any discussions about this with the team, so it's entirely possible I am ignorant of some established future direction... but - closed? seems useful to me. (It may also be useful to ask drained? (closed + empty).) - ! returning an indicator of success also seems useful.

Re: core.async: communicating termination

2013-07-11 Thread Michał Marczyk
I think you could pass the producer a higher-order (chan 1) with the actual communication channel placed in the buffer. Then at each step the producer would do (when-let [c (! communication-channel)] (! c (rand)) (! communication-channel c)) Once you close communication-channel, the put

Re: core.async: communicating termination

2013-07-11 Thread Timothy Baldridge
It's interesting to note that blocking go blocks can actually be GC'd. For example, run this in a repl: (loop [] (let [c (chan)] (go (! c 42))) (recur)) On my box the CPU and memory spikes, but after I CTRL+C and kill the loop, the GC kicks in and collects all the channels and gos

Re: core.async: communicating termination

2013-07-11 Thread Michał Marczyk
Hi Timothy, That's very cool and very good to know! Cheers, M. On 12 July 2013 00:56, Timothy Baldridge tbaldri...@gmail.com wrote: It's interesting to note that blocking go blocks can actually be GC'd. For example, run this in a repl: (loop [] (let [c (chan)] (go (! c 42)))

Re: core.async: communicating termination

2013-07-11 Thread Michał Marczyk
As for the producer/consumer scheme with the higher-order channel, it works in the single-producer case: https://gist.github.com/michalmarczyk/5980097 (Actually this is simplified a bit in that it's also single consumer, but that's not a feature of the approach, but rather my quick dirty poc.)

Re: Possible to add dependency within leiningen plugin dynamically?

2013-07-11 Thread Chris Kuttruff
Brilliant! worked perfectly for me... found the magic you were referring to in load-deps ( https://github.com/kumarshantanu/lein-servlet/blob/master/plugin/src/leiningen/servlet.clj#L35 ) and the pomegranate/add-dependencies call (

Re: core.async: communicating termination

2013-07-11 Thread Brandon Bloom
Wouldn't closed and drained predicates introduce race conditions? (Sorry for brevity, on my phone) -- -- 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

[ANN] Proteus: local mutable variables for the masses

2013-07-11 Thread Zach Tellman
There was some discussion a few days ago about how the lack of local mutable variables were harming performance, or possibly elegance, I'm not sure. Regardless, I fixed it: https://github.com/ztellman/proteus Enjoy! -- -- You received this message because you are subscribed to the Google

Re: core.async: communicating termination

2013-07-11 Thread Michał Marczyk
On 12 July 2013 01:08, Michał Marczyk michal.marc...@gmail.com wrote: (Actually this is simplified a bit in that it's also single consumer, but that's not a feature of the approach, but rather my quick dirty poc.) Single consumer, multiple producers:

Re: [ANN] Proteus: local mutable variables for the masses

2013-07-11 Thread Ben Wolfson
Note: proteus (defmacro aif [test then else] (let [it (first (filter #(not (contains? env %)) (cons 'it (map #(symbol (str it- %)) (iterate inc 1)] `(let [~it ~test] (if ~it ~then ~else #'proteus/aif proteus (aif (get {:x {:y 3}}

Re: [ANN] Proteus: local mutable variables for the masses

2013-07-11 Thread Zach Tellman
Yeah, for safety's sake I need to macroexpand everything, which wipes out the env for internal macros. There might be a gentler way to do this, but it's not obvious to me. If anyone has suggestions, I'd be interested in hearing them. Zach On Thursday, July 11, 2013 6:35:21 PM UTC-7, Ben

Re: [ANN] Proteus: local mutable variables for the masses

2013-07-11 Thread Ben Wolfson
On Thu, Jul 11, 2013 at 6:48 PM, Zach Tellman ztell...@gmail.com wrote: Yeah, for safety's sake I need to macroexpand everything, which wipes out the env for internal macros. There might be a gentler way to do this, but it's not obvious to me. If anyone has suggestions, I'd be interested in

Re: [ANN] Proteus: local mutable variables for the masses

2013-07-11 Thread Zach Tellman
It looks like the macroexpansion code in conditions.free is fairly generic. What would you say to putting it into its own library? On Thu, Jul 11, 2013 at 6:54 PM, Ben Wolfson wolf...@gmail.com wrote: On Thu, Jul 11, 2013 at 6:48 PM, Zach Tellman ztell...@gmail.com wrote: Yeah, for safety's

Re: Clojure: One language to rule the Web

2013-07-11 Thread Kelker Ryan
Sorry, but I don't have any plans on adding AS2/3 or XML support by default. Thanks! The framework is currently Alpha and I just added auto-documenting features for the JSON API. https://github.com/runexec/chp/releases/tag/v.0.162-alpha  CHTML, Routing, and Sessions CHTML RoutesSession handling,

Re: Clojure: One language to rule the Web

2013-07-11 Thread Kelker Ryan
Try these. http://www.clojuresphere.com/ http://www.clojure-toolbox.com/ https://clojure-libraries.appspot.com/ 12.07.2013, 05:32, Alexander Gunnarson alexandergunnar...@gmail.com: As a side note, maybe we can keep a running list of Clojure-ized technologies we're aware of:- XML -

Re: [ANN] Proteus: local mutable variables for the masses

2013-07-11 Thread Ben Wolfson
Sure, I was considering that anyway. I'm not sure, though, whether it should be in its own library all by its lonesome or in one with at least a fairly generic name, since I've got some other macro-related utilities (specifically https://github.com/bwo/macroparser) that could all be usefully (I

Re: Making RPCs with Shoreleave

2013-07-11 Thread Samrat Man Singh
I think you need to (use projectname.ajax) in your projectname.handler page. If I remember correctly, there's also a way to specify which namespace your remote function is in. On Thursday, July 11, 2013 10:42:15 PM UTC+5:45, Alex Fowler wrote: Hi all, this is my first experience with

Re: Possible to add dependency within leiningen plugin dynamically?

2013-07-11 Thread Shantanu Kumar
On Friday, 12 July 2013 05:00:43 UTC+5:30, Chris Kuttruff wrote: Brilliant! worked perfectly for me... found the magic you were referring to in load-deps ( https://github.com/kumarshantanu/lein-servlet/blob/master/plugin/src/leiningen/servlet.clj#L35) and the pomegranate/add-dependencies