Re: question about clojure.lang.LazySeq.toString()

2013-03-22 Thread Nelson Morris
If I'm reading everything correctly: 1. Object 's .toString uses .hashCode() 2. LazySeq 's .hashCode() uses seq() which realizes a seq. 3. LazySeq 's .hashCode() calls .hashCode() on the realized seq 3. (map ..) creates a LazySeq with a fn to create (cons val (lazy-seq (map f rest))) 4. (cons ...

Re: question about clojure.lang.LazySeq.toString()

2013-03-22 Thread Nelson Morris
Found a post on clojure-dev about this https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/F68GRPrbfWo On Fri, Mar 22, 2013 at 1:29 AM, Nelson Morris nmor...@nelsonmorris.net wrote: If I'm reading everything correctly: 1. Object 's .toString uses .hashCode() 2. LazySeq 's

Re: question about clojure.lang.LazySeq.toString()

2013-03-22 Thread Cedric Greevey
Hrm. Sounds like getting the hash of an infinite sequence will hang or cause OOME. On the one hand, *most* uses of the hash are followed by .equals if the hashes match, and .equals on an infinite seq can't work, since if it gives up and says equal after some large number N of elements, the seqs

Re: Clojure - CLR - JS - Visual Studio Extension

2013-03-22 Thread Devin Garner
I've added beta support for ClojureScript to vsClojure on the visual studio gallery for vs2012. Please try it out and let me know how it works. You can see more details about the post on the ClojureCLR group at http://gplus.to/clojureclr Thanks, Devin On Thursday, March 21, 2013 9:42:52 PM

Re: question about clojure.lang.LazySeq.toString()

2013-03-22 Thread Cedric Greevey
Eh. Not just any collisions, but only ones where the succession of tails are equal-as-seqs but not identical as objects (.equals, but not ==) for sufficiently long. So seqs that differ after only a trillion items would blow up. So would equal ones sharing no tail structure. Putting (iterate inc 0)

doing a Google search from Clojure?

2013-03-22 Thread Rich Morin
I've been successfully using slurp and laser to harvest and pull apart some web pages. However, I can't figure out how to use Google Search from my code. My first thought was to use the Google Search API, but after a lot of frustration in trying to get and use an API key, I gave up on that. My

Re: Redefinition of datatypes

2013-03-22 Thread Ambrose Bonnaire-Sergeant
Now that ClojureWest has finished, I'll gently bump this thread :) Thanks, Ambrose On Wed, Mar 13, 2013 at 12:51 PM, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: core.typed dependencies are all in Central now. Here's a reproducible example of this failure.

Re: doing a Google search from Clojure?

2013-03-22 Thread Cedric Greevey
Change your code to it spoofs a common browser user-agent, change your DHCP-assigned IP address, and try again. They're probably trying to obstruct bots from making overwhelming numbers of requests or something. As long as you don't flood them with requests at a higher rate than a human would

Re: Native library not found after upgrade to leiningen 2.0

2013-03-22 Thread Karsten Schmidt
You can see the actual path used by doing this in the repl: (System/getProperty java.library.path) I found it best to wrap native libs in a jar with this internal structure: /META-INF/MANIFEST.MF /native/linux/x86 /native/linux/x86_64 /native/macosx/x86 /native/macosx/x86_64 /native/windows/x86

Re: Get difference between two lists with java objects of same class

2013-03-22 Thread Ryan
Thanks once again Marko. The only thing that I am having trouble understanding is this: 1. What exactly happens when an item is passed to #(keyset-b (key-fn %)) ? Does keyset-b looks up itself (because collections are functions) for the item which contains *:id X *and returns true/false?

Re: Get difference between two lists with java objects of same class

2013-03-22 Thread Marko Topolnik
Let's assume that key-fn is defined as #(.getID %) so we have: #(keyset-b #(.getID %)) And now let's assume that item-object is passed to it. So, #(.getID %) returns, let's say, the number 3 (which is the value of the id). How exactly is that number is being looked up in keyset-b? How

Re: Clojure - CLR - JS - Visual Studio Extension

2013-03-22 Thread dmiller
I've not seen that behavior on ClojureCLR/Mono before. What ClojureCLR commit are you using? On Thursday, March 21, 2013 10:42:52 PM UTC-5, Ambrose Bonnaire-Sergeant wrote: I'm using Mono on Ubuntu, and I have these errors/failures (including project.clj at the bottom):

Re: [ANN] Leiningen 2.1.1 released

2013-03-22 Thread Johann Hibschman
By the way, is there any place to get a full tarball (or zip) of leiningen and its dependencies? Not all of the machines I'm working on have external internet access, so I can't bootstrap as usual. On Thursday, March 21, 2013 6:44:09 PM UTC-4, Phil Hagelberg wrote: Hello folks. I've just

Re: doing a Google search from Clojure?

2013-03-22 Thread Jonathan Fischer Friberg
Found some info here: http://stackoverflow.com/questions/3727662/how-can-you-search-google-programmatically-java-api Jonathan On Fri, Mar 22, 2013 at 8:32 AM, Cedric Greevey cgree...@gmail.com wrote: Change your code to it spoofs a common browser user-agent, change your DHCP-assigned IP

[ANN] Pedestal Application Framework

2013-03-22 Thread Alex Redinton
Hello! At Relevance, we have been working on a way to build applications delivered over the web for some time, and unveiled our work at Clojure/West. If you missed it, our work is called Pedestal, and while it is still immature and in an alpha state, we've opened it up and are interested in

Re: [ANN] Leiningen 2.1.1 released

2013-03-22 Thread Phil Hagelberg
There are just two files, the bin script and the uberjar. Though for project dependencies and the repl you will need to download further jars from a repository. So hopefully you have an internal mirror or something for that. -Phil -- -- You received this message because you are subscribed to

Re: Refactoring tools

2013-03-22 Thread Daniel Glauser
I feel your pain, would love to see some Clojure refactorings. I had started working on the 1.3 branch of clojure-refactoring trying to bring it up to speed. I met with Tony (the original author of clojure-refactoring) and Phil H. at Clojure/West. Tony was very adamant that we ditch his code

Re: doing a Google search from Clojure?

2013-03-22 Thread juan.facorro
Setting the user agent did the trick, at least in my case. (ns google-search (:import [java.net URL URLEncoder])) (def google-search-url http://www.google.com/search?q=;) (def user-agent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172) (defn

Re: doing a Google search from Clojure?

2013-03-22 Thread Jim - FooBar();
On 22/03/13 15:00, juan.facorro wrote: (do (.append sb (char c)) do you really need the 'do'? Jim -- -- 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

Re: doing a Google search from Clojure?

2013-03-22 Thread Juan Martín
Yes, the *do *is necessary since the character needs to be appended to the *StringBuilder *and *recur *needs to be called after doing that. I actually took the code from the clojure.core/slurphttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6279function :). Cheers, Juan

Re: doing a Google search from Clojure?

2013-03-22 Thread Jim - FooBar();
On 22/03/13 15:20, Jim - FooBar(); wrote: On 22/03/13 15:00, juan.facorro wrote: (do (.append sb (char c)) do you really need the 'do'? Jim ooops! I'm really sorry! my bad! JIm -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: If there is no nil values, why do I get null pointer exception?

2013-03-22 Thread Gary Verhaegen
I would guess the NPE comes from the form (xml/emit-str (xml/map-Element next-movie-as-map)), given that (conj nil nil) does not throw. Perhaps try to isolate the problem in a smaller chunk of code, and then file a bug with the data.xml library? On 21 March 2013 19:16, larry google groups

Re: If there is no nil values, why do I get null pointer exception?

2013-03-22 Thread larry google groups
Thank you. I need to import this json and convert it to XML or CSV: http://tribecafilm.com/api/xomo/films.json I'm guessing that the problem is the nested vector of cast members, which my project manager has asked me to flatten (I think she is planning work with this in Microsoft Excel,

Re: doing a Google search from Clojure?

2013-03-22 Thread Rich Morin
On Mar 22, 2013, at 08:00, juan.facorro wrote: Setting the user agent did the trick, at least in my case. Thanks! Using your code, I was able to bring in a page and write it to a file. I was then able to confirm that it had the expected content. FTW! I still think this should be easier, but

Re: [ANN] Pedestal Application Framework

2013-03-22 Thread Michael Klishin
2013/3/22 Alex Redinton alex.reding...@thinkrelevance.com Please let us know what you think! Will Pedestal accept pull requests? -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- -- You received this message because you are subscribed to the Google Groups

Re: Get difference between two lists with java objects of same class

2013-03-22 Thread Ryan
Thanks a lot Marko :) On Friday, March 22, 2013 12:44:06 PM UTC+2, Marko Topolnik wrote: Let's assume that key-fn is defined as #(.getID %) so we have: #(keyset-b #(.getID %)) And now let's assume that item-object is passed to it. So, #(.getID %) returns, let's say, the number 3 (which

Re: doing a Google search from Clojure?

2013-03-22 Thread juan.facorro
I gave the code another look and remembered that *slurp* can actually handle a bunch of types as input, so I just passed the *InputStream *from the connection and got the same results. Additionaly in the code I posted before, the *get-response* function was never closing the stream, which *

Re: doing a Google search from Clojure?

2013-03-22 Thread Armando Blancas
Rich, you may want to check out clojure-http-client. https://github.com/technomancy/clojure-http-client (require '[clj-http.client :as client]) (spit result.html (client/get http://www.google.com/search?q=clojure;)) On Friday, March 22, 2013 12:09:07 AM UTC-7, Rich Morin wrote: I've been

Re: doing a Google search from Clojure?

2013-03-22 Thread Anthony Grimes
clojure-http-client is more or less unmaintained. https://github.com/dakrone/clj-http is the canonical http client these days. Lazybot has a plugin for doing this with the google ajax api, if that's helpful. No API key needed.

LoL which style for Clojure

2013-03-22 Thread jamieorc
Curious which style is preferred in Clojure and why: (defn f1 [] (let [x {:foo 1 :bar 2 :baz 3}] (keys x))) (let [x {:foo 1 :bar 2 :baz 3}] (defn f2 [] (keys x))) Cheers, Jamie -- -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: [ANN] Pedestal Application Framework

2013-03-22 Thread Denis Labaye
hurray! It looks really promising. I would mention the relevance podcast about Pedestalhttp://thinkrelevance.com/blog/2013/03/18/pedestal-podcast-episode-027, it's a really smooth introduction. I started playing with Pedestal, and I particularly appreciate the incremental approach of the

Re: Refactoring tools

2013-03-22 Thread Laurent PETIT
2013/3/22 Daniel Glauser danglau...@gmail.com I feel your pain, would love to see some Clojure refactorings. I had started working on the 1.3 branch of clojure-refactoring trying to bring it up to speed. I met with Tony (the original author of clojure-refactoring) and Phil H. at Clojure/West.

Re: LoL which style for Clojure

2013-03-22 Thread Jim - FooBar();
def/defn et. al are top-level form definitions...very rarely (I'd say never) you'd have a def/defn inside a 'let' or inside anything for that matter...The 1st one looks good :) Jim On 22/03/13 18:59, jamieorc wrote: Curious which style is preferred in Clojure and why: (defn f1 [] (let [x

Re: LoL which style for Clojure

2013-03-22 Thread Laurent PETIT
2013/3/22 jamieorc jamie...@gmail.com Curious which style is preferred in Clojure and why: (defn f1 [] (let [x {:foo 1 :bar 2 :baz 3}] (keys x))) (let [x {:foo 1 :bar 2 :baz 3}] (defn f2 [] (keys x))) In either case, AFAIK, the compiler will recognize {:foo 1 :bar 2 :baz 3}

Re: LoL which style for Clojure

2013-03-22 Thread jamieorc
Thanks, that's what I expected, especially after doing some (time... ) experiments. On Friday, March 22, 2013 3:05:10 PM UTC-4, Laurent PETIT wrote: 2013/3/22 jamieorc jami...@gmail.com javascript: Curious which style is preferred in Clojure and why: (defn f1 [] (let [x {:foo 1 :bar

Re: Understanding vars

2013-03-22 Thread Nicola Mometto
Opened ticket with fix + test http://dev.clojure.org/jira/browse/CLJ-1187 Mark Engelberg writes: On Tue, Mar 19, 2013 at 12:57 AM, Bronsa brobro...@gmail.com wrote: If I remember correctly, this is a bug due to the fact that constant empty literals are handled in a special way from the

Re: doing a Google search from Clojure?

2013-03-22 Thread Armando Blancas
Thanks, Anthony; will use that one. On Friday, March 22, 2013 11:37:44 AM UTC-7, Anthony Grimes wrote: clojure-http-client is more or less unmaintained. https://github.com/dakrone/clj-http is the canonical http client these days. Lazybot has a plugin for doing this with the google ajax

Re: [ANN] Leiningen 2.1.1 released

2013-03-22 Thread John Gabriele
Just in case it's not said enough, thank you --- and thank you to the other contributors as well --- so much for Leiningen. It is awesome. :) Ooh, and I'm grateful to see the new gpg tut in the docs! Thanks, tcrawley! (BTW, the upgrade from 2.1.0 went fine for me.) ---John On Thursday,

Re: LoL which style for Clojure

2013-03-22 Thread Chris Hapgood
For the example given, I would say it depends on what you are trying to express. The function f1 is a function that needs some internal data x to operate -x might be considered an implementation detail. The function f2 operates on well known data x -x might be considered configuration of

Re: LoL which style for Clojure

2013-03-22 Thread Robert Pitts
I've certainly seen this at least a few spots within the 4clojure codebase – https://github.com/4clojure/4clojure/blob/develop/src/foreclojure/utils.clj#L66-L70 (quick example, I believe there are more) On Friday, March 22, 2013 3:02:20 PM UTC-4, Jim foo.bar wrote: def/defn et. al are

Re: Clojure - CLR - JS - Visual Studio Extension

2013-03-22 Thread dmiller
We never did any testing of the 1.4.x series under mono. If it works at all, that's just a bonus. I'd do mono work off the master branch. lein-clr won't do that directly. You'd have to download, build and set the appropriate environment variable to your bin dir. The current master

Re: [ANN] Pedestal Application Framework

2013-03-22 Thread Toni Tuominen
Looks very interesting. I'd really love to see a screencast of someone building for example the todomvc app form scratch with this cause I for one couldn't really wrap my head around it. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: LoL which style for Clojure

2013-03-22 Thread Timothy Baldridge
The question should probably be asked: is there a benefit in a given situation to having the let be outside the scope of the defn? I would argue that most times it is not, and putting the let outside the function clutters the code and makes it harder to see the functions defined in the namespace.

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 more or less randomly, and don't

Re: If there is no nil values, why do I get null pointer exception?

2013-03-22 Thread larry google groups
Hmm, maybe I simply nested the XML elements incorrectly (though NullPointerException doesn't give much information about the real problem). I eventually imported this URL: http://tribecafilm.com/api/xomo/films.json With this code: (defn transform-cast-members-into-xml

Re: Redefinition of datatypes

2013-03-22 Thread Hugo Duncan
Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com writes: Now that ClojureWest has finished, I'll gently bump this thread :) Thanks, Ambrose Ambrose, I had a quick look at this. I tried running with zi:test, and it complained about a missing dependency on tools.macro. Adding that as a

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

2013-03-22 Thread Andy Fingerhut
Links to pages where you can file problem reports using JIRA, for Clojure and all of its contrib libraries (of which tools.logging is one) can be found here: http://dev.clojure.org/jira/secure/BrowseProjects.jspa#all You will need to create an account to be able to create a new ticket. Click

Re: Redefinition of datatypes

2013-03-22 Thread Ambrose Bonnaire-Sergeant
On Sat, Mar 23, 2013 at 7:32 AM, Hugo Duncan duncan.h...@gmail.com wrote: Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com writes: Now that ClojureWest has finished, I'll gently bump this thread :) Thanks, Ambrose Ambrose, I had a quick look at this. I tried running with

Re: Refactoring tools

2013-03-22 Thread Alex Baranosky
I'd really like to see a way to factor to code that uses -/- and back again. On Fri, Mar 22, 2013 at 12:01 PM, Laurent PETIT laurent.pe...@gmail.comwrote: 2013/3/22 Daniel Glauser danglau...@gmail.com I feel your pain, would love to see some Clojure refactorings. I had started working on the

[ANN] bond, a spying stubbing library

2013-03-22 Thread Allen Rohner
I'd like to announce bond, a spying and stubbing library, intended for tests. https://github.com/circleci/bond Don't let the low version number scare you, we've been using it in production every day for several months. Allen -- -- You received this message because you are subscribed to

Macro for bailout-style programming

2013-03-22 Thread Russell Mull
Hi Clojurians, I'm relatively new to the language and am trying to get used to its idioms. One thing I'm accustomed to doing in things like java and C# is checking values for validity and then bailing out early if they don't make sense. For example, without this idiom in java you might do:

Re: Refactoring tools

2013-03-22 Thread Russell Mull
I find myself doing that a lot by hand, a tool to help would be very useful. Some others that I've thought of are: - change between (fn [x] ...) and #(...) - pull sexp up to let, or introduce a new let (like introduce variable in java et. al) On Saturday, March 23, 2013 10:42:10 AM UTC+9,

Re: Macro for bailout-style programming

2013-03-22 Thread Michael Klishin
2013/3/23 Russell Mull russell.m...@gmail.com Which leads me to my question: does such a construct already exist? Or perhaps am I doing it wrong? I've googled around for this, but I'm not exactly sure what it's called. http://clojuredocs.org/clojure_core/clojure.core/if-let (and its close

Re: Macro for bailout-style programming

2013-03-22 Thread Mikera
You can get quite a long way with just if-let and and or to express the bailout logic. Examples I find myself using all the time: ;; fallback / default values (or (maybe-make-value) (make-fallback-value) (error this shouldn't happen!)) ;; bailout with nil return (assumes you are running

Re: Clojure/West 2013 videos?

2013-03-22 Thread Alex Miller
Hi John, Videos will be available on InfoQ from http://www.infoq.com/clojure-west. Generally, it takes 3-4 weeks for videos to start coming out and they then arrive 1-2 per week for many months. We will probably not start working on the actual schedule for another week or two. Rich Hickey has