Re: Calling a java function with multiple implementations based on type

2013-05-13 Thread Philip Potter
Clojure will use reflection to find *a* method, but if you want it to pick the correct one from multiple overloads, you need to give clojure type hints so it knows the correct static types of the parameters. At least I think that's how it works. When I've hit this before, I've just played with

Re: Calling a java function with multiple implementations based on type

2013-05-13 Thread Meikel Brandmeyer (kotarak)
Hi, Am Montag, 13. Mai 2013 02:25:03 UTC+2 schrieb Korny: If I call (add-identity agent {:private-key-path foo :passphrase bar}) the clj-ssh library (eventually) calls a java method: (.addIdentity agent foo bar) This method has several implementations, including: public void

Re: Calling a java function with multiple implementations based on type

2013-05-13 Thread Meikel Brandmeyer (kotarak)
For reference: https://github.com/hugoduncan/clj-ssh/blob/develop/src/clj_ssh/ssh.clj#L145 -- -- 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

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Meikel Brandmeyer (kotarak)
Hi, Am Samstag, 11. Mai 2013 21:25:11 UTC+2 schrieb Alex Baranosky: Most of the code I see and write at work at Runa uses (not (empty? foo)). I'll continue to defend the position that it is more obvious code, and therefore better (imo :) ) seq belongs to seq-land. empty? belongs to data

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Alex Baranosky
Yes, by all means please just copy-n-paste out of https://github.com/runa-dev/kits if it simplifies your dependency tree. On Sun, May 12, 2013 at 8:53 PM, Dave Kincaid kincaid.d...@gmail.comwrote: Thanks for this, Stuart. I hope it's not too late. As one who has spent the last couple weeks

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Stuart Sierra
On Mon, May 13, 2013 at 12:55 PM, Mikera mike.r.anderson...@gmail.comwrote: Maybe we could try to develop towards some kind of lightweight dependency loading system that avoids this problem? I believe lightweight dependency loading system is an oxymoron. Either you A) design a new module

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Meikel Brandmeyer (kotarak)
Hi, Am Montag, 13. Mai 2013 10:35:14 UTC+2 schrieb Stuart Sierra: I believe lightweight dependency loading system is an oxymoron. Either you A) design a new module format and try to get everyone to follow it (OSGI) or B) build an ad-hoc solution that tries to guess at the right behavior

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Glen Mailer
Are dependencies the potential problem, or are utility belt dependencies the issue here? If its the latter, then should we be trying to break down the utility belt into groups of related functionality, which can be stable and focused. Promoting zero-dependency libraries just means re-inventing

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Mike Thvedt
A good implementation of ISeq won't return a new object, and new short-lived objects are cheap on the JVM anyway. OTOH count can be slow for some data structures. if you don't like instantiating lots of new objects only to throw them away, you're missing out on one of HotSpot's most

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Meikel Brandmeyer
2013/5/13 Mike Thvedt cynicalk...@gmail.com A good implementation of ISeq won't return a new object, and new short-lived objects are cheap on the JVM anyway. OTOH count can be slow for some data structures. if you don't like instantiating lots of new objects only to throw them away, you're

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Herwig Hochleitner
2013/5/13 Meikel Brandmeyer (kotarak) m...@kotka.de seq belongs to seq-land. empty? belongs to data structure land. It should actually be implemented as #(zero? (count %)). But unfortunately it is not. I'd argue it shouldn't (empty? (cycle [1 2 3])) = false (zero? (count (cycle [1 2 3])))

[ANN] - adi 0.1.1 - a `document` database grafted onto Datomic

2013-05-13 Thread zcaudate
I'm extremely happy to announce to the clojure community what I have been working on for the past couple of months. I'm calling it `adi`, sanskrit for `beginning`, acronym - (A) (D)atomic (I)nterface. Get it here: https://github.com/zcaudate/adi For the more technical minded, these are

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Nelson Morris
Development for money isn't a problem for me, however dev for open source can be problematic. The scarce resource for open source is mostly time, though occasionally motivation becomes low. Contributions and projects start off well, and energy might wane depending on time and life factors. Even

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Phillip Lord
AtKaaZ atk...@gmail.com writes: Hi. I've been meaning to ask (all of)you, how do you get moral support? How do you put yourself into that mood so that you're happy/willing to program? What motivates you to do it? Is it the people you surround yourself with or the financial support? Are they

Meta-eX: Hacking Overtone on the Stubnitz - Thurs 16th May

2013-05-13 Thread Sam Aaron
Hey everyone, You've heard of people live coding Clojure examples as part of their talks. Heck, you've probably even seen Stuart Halloway jam on Chris Ford's Bach composition in the new O'Reilly lecture series Clojure Inside Out. However, that's just warm-up material... Come and jump aboard

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Meikel Brandmeyer (kotarak)
Hi, Am Montag, 13. Mai 2013 13:57:57 UTC+2 schrieb Herwig Hochleitner: 2013/5/13 Meikel Brandmeyer (kotarak) m...@kotka.de javascript: seq belongs to seq-land. empty? belongs to data structure land. It should actually be implemented as #(zero? (count %)). But unfortunately it is not.

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Mark
That's a fair point, but do you always know that what you've gotten back is a sequence or a data structure, if you aren't looking directly at the code that you're calling? On Monday, May 13, 2013 10:08:00 AM UTC-4, Meikel Brandmeyer (kotarak) wrote: Hi, Am Montag, 13. Mai 2013 13:57:57

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Sean Corfield
On Mon, May 13, 2013 at 7:08 AM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: You misunderstood my argument. cycle returns a sequence = use seq. count is the wrong thing to call here. And calling seq without using its return value (with a name) is a smell. count should not be called in

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Meikel Brandmeyer (kotarak)
Hi, Am Montag, 13. Mai 2013 16:16:36 UTC+2 schrieb Mark: That's a fair point, but do you always know that what you've gotten back is a sequence or a data structure, if you aren't looking directly at the code that you're calling? Most of my code are either sequence-y things (mostly

Re: A JMonkeyEngine3 wrapper?

2013-05-13 Thread Robert Louis McIntyre
Everything's in a mercurial repository here: http://hg.bortreb.com/cortex/ sincerely, --Robert McIntyre AtKaaZ atk...@gmail.com writes: Robert, do you have all that in a project somewhere on github? I really enjoy all the explanations -- -- You received this message because you are

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Mark Tomko
Even so, what do you do when you're using someone else's code as a library? On Mon, May 13, 2013 at 10:42 AM, Meikel Brandmeyer (kotarak) m...@kotka.dewrote: Hi, Am Montag, 13. Mai 2013 16:16:36 UTC+2 schrieb Mark: That's a fair point, but do you always know that what you've gotten back

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Meikel Brandmeyer (kotarak)
Hi, Am Montag, 13. Mai 2013 16:16:57 UTC+2 schrieb Sean Corfield: So you think (count (map inc [1 2 3])) should be illegal? (I'm just trying to understand your logic here) In the hardcore version, yes. In the practical version, probably not. I never had to call count on a seq. (Various

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Jim
So the following is not encouraged because we disregard the result of calling seq? (def dummy {:a [1 2 3] :b [4 5 6] :c [] }) =(every? seq (vals dummy)) ;make sure all values are non-empty false Jim On 13/05/13 15:08, Meikel Brandmeyer (kotarak) wrote: Hi, Am Montag, 13. Mai 2013

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Meikel Brandmeyer (kotarak)
Hi, Am Montag, 13. Mai 2013 16:48:13 UTC+2 schrieb Jim foo.bar: So the following is not encouraged because we disregard the result of calling seq? I would prefer (not-any? empty? ...) with empty? being #(zero? (count %)) if all the values are data structures. If there might be sequences

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Timothy Baldridge
Let's not forget that allocations on the JVM are super, super cheap. In the order of something like 10 cycles. So don't worry so much about throw-away objects. Timothy On Mon, May 13, 2013 at 8:48 AM, Jim jimpil1...@gmail.com wrote: So the following is not encouraged because we disregard the

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Meikel Brandmeyer (kotarak)
Hi, Am Montag, 13. Mai 2013 16:56:11 UTC+2 schrieb tbc++: Let's not forget that allocations on the JVM are super, super cheap. In the order of something like 10 cycles. So don't worry so much about throw-away objects. seq involves realization of the first step of the sequence which can

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Gary Trakhman
If there is no one-size fits all solution for your use case, it might become idiomatic to use a protocol or some other polymorphism. One could imagine a version of clojure that has protocols for every core function :). Can you ever have too many cakes to eat them, too? On Monday, May 13, 2013,

Re: prog1

2013-05-13 Thread Christophe Grand
Hi On Sat, Nov 8, 2008 at 5:10 PM, Robert Pfeiffer pfeiffer.rob...@googlemail.com wrote: Is there a benefit in implementing this as a macro instead of a function? The function version would be very simple: (defn returning [returnval body] returnval) The macro does not allocate a

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Michael Swierczek
On Sunday, May 12, 2013 3:34:22 PM UTC-4, atkaaz wrote: Hi. I've been meaning to ask (all of)you, how do you get moral support? How do you put yourself into that mood so that you're happy/willing to program? What motivates you to do it? Is it the people you surround yourself with or the

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Christophe Grand
I second: using seq to test for emptiness is only one half of the idiom, the second half is to bind and to destructure (usually with if-let) the returned value. Christophe On Sat, May 11, 2013 at 12:08 PM, Chris Ford christophertf...@gmail.comwrote: IMHO it's a bit subjective, but empty? is

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Herwig Hochleitner
2013/5/13 Meikel Brandmeyer (kotarak) m...@kotka.de You misunderstood my argument. cycle returns a sequence = use seq. count is the wrong thing to call here. And calling seq without using its return value (with a name) is a smell. count should not be called in sequences. (In fact I believe

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Philip Potter
In fact, the way that count works on ISeqs is rather roundabout -- it only works because all implementations of ISeq in clojure.jar also happen to implement java.util.List, so count calls Collection.size(). In theory, some user-provided ISeq which didn't implement List would not respond to count.

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Timothy Baldridge
In fact, the way that count works on ISeqs is rather roundabout -- it only works because all implementations of ISeq in clojure.jar also happen to implement java.util.List, so count calls Collection.size(). In theory, some user-provided ISeq which didn't implement List would not respond to count.

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Dave Ray
On Mon, May 13, 2013 at 1:42 AM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: Hi, Am Montag, 13. Mai 2013 10:35:14 UTC+2 schrieb Stuart Sierra: I believe lightweight dependency loading system is an oxymoron. Either you A) design a new module format and try to get everyone to follow it

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Phil Hagelberg
Nelson Morris writes: What helps is direct involvement by someone else. I'll definitely echo this. People are more important than programs. If I'm writing code that I'm going to be the only one using, maybe it'll hold my interest for a few hours. But even in the best cases it's usually only

Re: FTP with Clojure on Heroku

2013-05-13 Thread Phil Hagelberg
Jonathon McKitrick writes: Has anyone had any success accepting FTP uploads in Clojure on Heroku? Unfortunately Heroku apps are only capable of responding to HTTP requests at this point. -Phil pgp4tO21faepT.pgp Description: PGP signature

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Phil Hagelberg
Angel Java Lopez writes: I guess it could be difficult to implement such feature in Java/Clojure It's really not difficult to do if you limit yourself to Clojure since Clojure namespaces are first-class and easy to manipulate at run-time. We implemneted a prototype of this in under two hours

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Ulises
Code that matters is code that's used by other people. For me personally the ability to share my code with others is the thing that makes programming worth doing in the first place. This is a rather important point. One of the most asked questions (random made up fact) by newcomers to a

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Timothy Baldridge
I doubt I'm unique in this area, but for me, programming is a drug. I have to code, or the ideas and thoughts build up in my mind. For me, actually writing down and implementing these is a stress relief. Just ask my parents when I was growing up, or my wife today. Keep me in a room without a

[ANN] clojure.java.jdbc 0.3.0 alpha 4

2013-05-13 Thread Sean Corfield
Latest alpha build of the upcoming 0.3.0 release of Clojure's JDBC wrapper contrib library. TL;DR: Extensive code changes around connection handling that I'd like to see get tested in the real world... http://corfield.org/blog/post.cfm/clojure-java-jdbc-0-3-0-alpha-4 -- Sean A Corfield -- (904)

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Erlis Vidal
Let me share this tale with you guys, hope you like it as much as I do: It is said that Socrates met a worker who asked: what are you doing good man ? Don't you see I'm cutting a stone to earn my salary and so I can eat the worker replied. He moved on and later found another worker questioning

Understanding boxing

2013-05-13 Thread Mark Engelberg
What tools exist in Clojure for understanding whether a given variable is boxed or primitive? To get a better handle on boxing, I started playing around with things like: (def x 1) (def ^int x 1) (def x (int 1)) I want to know how Clojure is storing that 1 in the various cases. The only tool I

Re: Utility libraries and dependency hygiene

2013-05-13 Thread zcaudate
I'm guilty of this... But I really don't know what to do I still find myself thinking... Hmmm this library provides about 50% of what I want... This library has 2 functions that I like And I don't like the way something is implemented here... If only i can combine this, this, and

Re: Understanding boxing

2013-05-13 Thread Ben Mabey
On Mon May 13 13:36:53 2013, Mark Engelberg wrote: What tools exist in Clojure for understanding whether a given variable is boxed or primitive? To get a better handle on boxing, I started playing around with things like: (def x 1) (def ^int x 1) (def x (int 1)) I want to know how Clojure is

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Stuart Sierra
On Tue, May 14, 2013 at 3:25 AM, Phil Hagelberg p...@hagelb.org wrote: It's really not difficult to do if you limit yourself to Clojure since Clojure namespaces are first-class and easy to manipulate at run-time. We implemneted a prototype of this in under two hours at a Seajure meeting a

Re: Understanding boxing

2013-05-13 Thread Stuart Sierra
On Tuesday, May 14, 2013 5:36:53 AM UTC+10, puzzler wrote: What tools exist in Clojure for understanding whether a given variable is boxed or primitive? The REPL will always box things, making it difficult to use for understanding primitives. If you want to be 100% sure, AOT-compile your code

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Phil Hagelberg
Stuart Sierra writes: That's cool, and it will work for the simple case of libraries A and B depending on different versions of C. But it still breaks down in more complex cases: e.g. if I want to share data between A and B using a protocol or type defined in C, and there are 2 incompatible

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Zack Maril
One of the reasons I program is because I'm furious. By most accepted metrics, I went to one of the best technical public high schools in the country. I was average there and I was taking graph theory and multivariable calculus as a senior my last semester. The smart kids though? They were

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Philip Potter
On 13 May 2013 17:30, Timothy Baldridge tbaldri...@gmail.com wrote: In fact, the way that count works on ISeqs is rather roundabout -- it only works because all implementations of ISeq in clojure.jar also happen to implement java.util.List, so count calls Collection.size(). In theory, some

Re: Utility libraries and dependency hygiene

2013-05-13 Thread fmjrey
Or a reason to integrate via data, not api or type. On Monday, May 13, 2013 10:54:26 PM UTC+2, Phil Hagelberg wrote: Stuart Sierra writes: That's cool, and it will work for the simple case of libraries A and B depending on different versions of C. But it still breaks down in more

Re: ritz-nrepl starts up slowly?

2013-05-13 Thread Warren Lynn
Is it normal to take this long to start the repl? I don't know if it is normal. But I can confirm it takes much longer to start ritz-nrepl compared to nrepl only, which itself is already kind of slow. The slow speed really is killing a lot of fun here. -- -- You received this message

Re: [ANN] clojure.java.jdbc 0.3.0 alpha 4

2013-05-13 Thread Gary Deer
Tested this one in the real world using an Oracle database: Address JDBC-51 by declaring get-connection returns java.sql.Connection indeed it does return a java.sql.Connection What are your plans for documentation beyond the doc strings? I've been trying to keep track of how I'm using the

Re: [ANN] clojure.java.jdbc 0.3.0 alpha 4

2013-05-13 Thread Sean Corfield
On Mon, May 13, 2013 at 3:01 PM, Gary Deer gdee...@gmail.com wrote: What are your plans for documentation beyond the doc strings? There are some additional documentation pages, based on the doc folder in the Github repo here: https://github.com/clojure/java.jdbc/tree/master/doc/clojure/java/jdbc

Re: ritz-nrepl starts up slowly?

2013-05-13 Thread yizhen wei
I heard using a sdd can reduce the time a lot. Maybe 5x? Can someone confirm on that? On Monday, May 13, 2013 6:17:38 PM UTC-4, Warren Lynn wrote: Is it normal to take this long to start the repl? I don't know if it is normal. But I can confirm it takes much longer to start

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Softaddicts
+1 :) I doubt I'm unique in this area, but for me, programming is a drug. I have to code, or the ideas and thoughts build up in my mind. For me, actually writing down and implementing these is a stress relief. Just ask my parents when I was growing up, or my wife today. Keep me in a room

Re: [ANN] clojure.java.jdbc 0.3.0 alpha 4

2013-05-13 Thread Michael Klishin
2013/5/14 Sean Corfield seancorfi...@gmail.com I think in-depth documentation for using java.jdbc probably belongs somewhere like http://clojure-doc.org - (but I'm not quite sure where it belongs on that site) Next to core.typed documentation (which needs some editing to follow the rest of

Re: [ANN] clojure.java.jdbc 0.3.0 alpha 4

2013-05-13 Thread Michael Klishin
2013/5/14 Sean Corfield seancorfi...@gmail.com http://clojure-doc.org is easy to contribute to so with a bit of guidance from that team, perhaps we can start a section there for java.jdbc documentation? And maybe move the four pieces of documentation above from the contrib repo to the

[ANN] Clojars policy change

2013-05-13 Thread Phil Hagelberg
Hello everyone. In the aftermath of the recent Linode intrusion[1][2], we determined that Clojars' policy of allowing artifacts to be overwritten[3] makes it much more difficult to detect an attack than it would be if artifacts were immutable like they are in most other repositories. While

Re: [ANN] Clojars policy change

2013-05-13 Thread Phil Hagelberg
Phil Hagelberg writes: In the aftermath of the recent Linode intrusion[1][2], we determined that Clojars' policy of allowing artifacts to be overwritten[3] makes it much more difficult to detect an attack than it would be if artifacts were immutable like they are in most other repositories.

Re: [ANN] Clojars policy change

2013-05-13 Thread Zack Maril
Is the policy for SNAPSHOT artifacts still that you can overwrite as much and as often as you want? -Zack On Tuesday, May 14, 2013 3:30:19 AM UTC+4, Phil Hagelberg wrote: Phil Hagelberg writes: In the aftermath of the recent Linode intrusion[1][2], we determined that Clojars' policy of

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Michael Klishin
2013/5/12 AtKaaZ atk...@gmail.com How do you put yourself into that mood so that you're happy/willing to program? What motivates you to do it? When it comes to work projects, I am personally motivated by building something useful and making a good living out of it. The process of programming

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Timothy Baldridge
Why shouldn't that be the case? A seq is a collection of data. And it's immutable, why would it bein its own category of collections? Timothy On May 13, 2013 3:45 PM, Philip Potter philip.g.pot...@gmail.com wrote: On 13 May 2013 17:30, Timothy Baldridge tbaldri...@gmail.com wrote: In fact,

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Timothy Baldridge
Neither of these snarky answers solve the problem. I just spent an entire week updating modules from version of a library that expected a seq of maps to one that expected map of seqs of maps. The very nature of data implies a format. If that format changes you have a compatibility issue no fancy

Re: [ANN] Clojars policy change

2013-05-13 Thread Phil Hagelberg
Zack Maril writes: Is the policy for SNAPSHOT artifacts still that you can overwrite as much and as often as you want? Technically no, but effectively yes. Any version ending in -SNAPSHOT is automatically translated into a timestamped version upon deploy or resolution. So 0.5.0-SNAPSHOT

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Armando Blancas
Zack, you've probably come across this profile on Jeff Hammerbacher, but just in case. The best minds of my generation are thinking about how to make people click ads, he says. That sucks. http://www.businessweek.com/printer/articles/55578-this-tech-bubble-is-different On Monday, May 13, 2013

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Mike Thvedt
In regards to the allocation objection--how often are you calling seq millions of times on something that's not already a seq? In re using count instead of seq, a lazy seq's count might be arbitrarily expensive to calculate and might not be able to tell if it's empty without realizing its