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 ... ...) creates a Cons
5. Cons uses Aseq's .hashcode() which traverses each object in the seq
and merges the hashcodes together.

A similar thing happens with a (range) as it builds a ChunkedCons
which also uses Aseq's hashcode.

On Fri, Mar 22, 2013 at 12:53 AM, Marko Topolnik
marko.topol...@gmail.com wrote:
 I am deeply puzzled abouth the behavior of .toString invocation on a lazy
 sequence.

 == (.getClass (map println (range 100)))
 clojure.lang.LazySeq
 == (.toString (map println (range 100)))
 ;; integers 0..100 printed
 clojure.lang.LazySeq@590b4b81

 It should be obvious from the output, but for the record: LazySeq doesn't
 override toString, so just the basic Java method is called. How can this
 possibly cause the sequence to be realized?

 Beyond my curiosity, however, what possible purpose could such behavior
 serve?

 -marko



 On Thursday, March 21, 2013 7:54:39 PM UTC+1, Razvan Rotaru wrote:

 Hi,

 I'm curious, why doesn't toString of clojure.lang.LazySeq return the
 entire sequence as a String, and returns the Java pointer instead? I find it
 annoying when I do this:


 user (str (map + [1 2 3]))
 clojure.lang.LazySeq@7861


 What's the reason behind this decision? Shouldn't toString trigger the
 evaluation of the sequence? Doesn't it do that for other values, like
 numbers and vectors?

 Is there an alternative to the code above (preferably simple and elegant),
 which will return the etire sequence?


 Thanks,
 Răzvan

 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 .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 ... ...) creates a Cons
 5. Cons uses Aseq's .hashcode() which traverses each object in the seq
 and merges the hashcodes together.

 A similar thing happens with a (range) as it builds a ChunkedCons
 which also uses Aseq's hashcode.

 On Fri, Mar 22, 2013 at 12:53 AM, Marko Topolnik
 marko.topol...@gmail.com wrote:
 I am deeply puzzled abouth the behavior of .toString invocation on a lazy
 sequence.

 == (.getClass (map println (range 100)))
 clojure.lang.LazySeq
 == (.toString (map println (range 100)))
 ;; integers 0..100 printed
 clojure.lang.LazySeq@590b4b81

 It should be obvious from the output, but for the record: LazySeq doesn't
 override toString, so just the basic Java method is called. How can this
 possibly cause the sequence to be realized?

 Beyond my curiosity, however, what possible purpose could such behavior
 serve?

 -marko



 On Thursday, March 21, 2013 7:54:39 PM UTC+1, Razvan Rotaru wrote:

 Hi,

 I'm curious, why doesn't toString of clojure.lang.LazySeq return the
 entire sequence as a String, and returns the Java pointer instead? I find it
 annoying when I do this:


 user (str (map + [1 2 3]))
 clojure.lang.LazySeq@7861


 What's the reason behind this decision? Shouldn't toString trigger the
 evaluation of the sequence? Doesn't it do that for other values, like
 numbers and vectors?

 Is there an alternative to the code above (preferably simple and elegant),
 which will return the etire sequence?


 Thanks,
 Răzvan

 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 might
still differ at position N + 1, and there's no *general* way to determine
in an analytic manner whether two seqs will produce identical output, or
even whether they're infinite (even given the generating code, those're
equivalent to the halting problem).

On the other hand, the above use of the hash does *not* require equals to
work. Hash could be changed to use only the first N elements of the seq, at
most, for some N, and would then work for such uses as in the generic
.toString.

On the gripping hand, a) doing this would make infinite seqs *mostly* work
in associative data structures, but with intermittent failures (when there
were collisions), instead of failing promptly every time, and b) .toString
for LazySeq might more productively just produce (the seq), if it's going
to fail on infinite seqs anyway.



On Fri, Mar 22, 2013 at 2:29 AM, Nelson Morris nmor...@nelsonmorris.netwrote:

 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 ... ...) creates a Cons
 5. Cons uses Aseq's .hashcode() which traverses each object in the seq
 and merges the hashcodes together.

 A similar thing happens with a (range) as it builds a ChunkedCons
 which also uses Aseq's hashcode.

 On Fri, Mar 22, 2013 at 12:53 AM, Marko Topolnik
 marko.topol...@gmail.com wrote:
  I am deeply puzzled abouth the behavior of .toString invocation on a lazy
  sequence.
 
  == (.getClass (map println (range 100)))
  clojure.lang.LazySeq
  == (.toString (map println (range 100)))
  ;; integers 0..100 printed
  clojure.lang.LazySeq@590b4b81
 
  It should be obvious from the output, but for the record: LazySeq doesn't
  override toString, so just the basic Java method is called. How can this
  possibly cause the sequence to be realized?
 
  Beyond my curiosity, however, what possible purpose could such behavior
  serve?
 
  -marko
 
 
 
  On Thursday, March 21, 2013 7:54:39 PM UTC+1, Razvan Rotaru wrote:
 
  Hi,
 
  I'm curious, why doesn't toString of clojure.lang.LazySeq return the
  entire sequence as a String, and returns the Java pointer instead? I
 find it
  annoying when I do this:
 
 
  user (str (map + [1 2 3]))
  clojure.lang.LazySeq@7861
 
 
  What's the reason behind this decision? Shouldn't toString trigger the
  evaluation of the sequence? Doesn't it do that for other values, like
  numbers and vectors?
 
  Is there an alternative to the code above (preferably simple and
 elegant),
  which will return the etire sequence?
 
 
  Thanks,
  Răzvan
 
  --
  --
  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, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send an
  email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 

 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from 

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 UTC-6, Ambrose Bonnaire-Sergeant 
wrote:

 I'm using Mono on Ubuntu, and I have these errors/failures (including 
 project.clj at the bottom):

 https://gist.github.com/frenchy64/5218783

 This is with commit 3b387f914815e389313897977eb02a9fba89dea2

 Is this to do with my environment?

 Thanks,
 Ambrose

 On Fri, Mar 22, 2013 at 11:09 AM, Ambrose Bonnaire-Sergeant 
 abonnair...@gmail.com javascript: wrote:

 Hi David,

 Excellent work so far!

 I'll have a dig around and see what I find.

 Thanks,
 Ambrose


 On Fri, Mar 22, 2013 at 10:53 AM, dmiller dmill...@gmail.comjavascript:
  wrote:

 Last update on this here:


 The port of core.logic to ClojureCLR that resides here:  
 https://github.com/**dmiller/clr.core.logichttps://github.com/dmiller/clr.core.logic
   
 the datomic piece is not ported.

 All tests run EXCEPT:

 test-binding-map-*
 test-binding-map-as-1
 test-binding-map-constraints-1
 test-unifier-constraints-*
 test-flatteno
 test-unifier-anon-constraints-3
 test-36-unifier-behavior

 These tests mostly involve clojure.core.logic.unifier/unify and 
 .../unifier.
 It is rather daunting to just jump into core.logic and debug this kind 
 of thing, so it might take a while for me to solve this.
 I invite anyone interested in ClojureCLR + core.logic to take a look.

 -David

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  





-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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) and (range) into a hashset together would fail, and (concat (range
10) [3]) and (concat (range 10) [4]) dropped in together
would either fail or make things really, really sloow, depending on
whether anything held onto the head of either seq.


On Fri, Mar 22, 2013 at 2:37 AM, Cedric Greevey cgree...@gmail.com wrote:

 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 might
 still differ at position N + 1, and there's no *general* way to determine
 in an analytic manner whether two seqs will produce identical output, or
 even whether they're infinite (even given the generating code, those're
 equivalent to the halting problem).

 On the other hand, the above use of the hash does *not* require equals to
 work. Hash could be changed to use only the first N elements of the seq, at
 most, for some N, and would then work for such uses as in the generic
 .toString.

 On the gripping hand, a) doing this would make infinite seqs *mostly* work
 in associative data structures, but with intermittent failures (when there
 were collisions), instead of failing promptly every time, and b) .toString
 for LazySeq might more productively just produce (the seq), if it's going
 to fail on infinite seqs anyway.



 On Fri, Mar 22, 2013 at 2:29 AM, Nelson Morris 
 nmor...@nelsonmorris.netwrote:

 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 ... ...) creates a Cons
 5. Cons uses Aseq's .hashcode() which traverses each object in the seq
 and merges the hashcodes together.

 A similar thing happens with a (range) as it builds a ChunkedCons
 which also uses Aseq's hashcode.

 On Fri, Mar 22, 2013 at 12:53 AM, Marko Topolnik
 marko.topol...@gmail.com wrote:
  I am deeply puzzled abouth the behavior of .toString invocation on a
 lazy
  sequence.
 
  == (.getClass (map println (range 100)))
  clojure.lang.LazySeq
  == (.toString (map println (range 100)))
  ;; integers 0..100 printed
  clojure.lang.LazySeq@590b4b81
 
  It should be obvious from the output, but for the record: LazySeq
 doesn't
  override toString, so just the basic Java method is called. How can this
  possibly cause the sequence to be realized?
 
  Beyond my curiosity, however, what possible purpose could such behavior
  serve?
 
  -marko
 
 
 
  On Thursday, March 21, 2013 7:54:39 PM UTC+1, Razvan Rotaru wrote:
 
  Hi,
 
  I'm curious, why doesn't toString of clojure.lang.LazySeq return the
  entire sequence as a String, and returns the Java pointer instead? I
 find it
  annoying when I do this:
 
 
  user (str (map + [1 2 3]))
  clojure.lang.LazySeq@7861
 
 
  What's the reason behind this decision? Shouldn't toString trigger the
  evaluation of the sequence? Doesn't it do that for other values, like
  numbers and vectors?
 
  Is there an alternative to the code above (preferably simple and
 elegant),
  which will return the etire sequence?
 
 
  Thanks,
  Răzvan
 
  --
  --
  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, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
 Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 

 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from 

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 next thought was to slurp in a page from the interactive
Google Search facility, using the URL from Advanced Search:

  http://www.google.com/search?hl=enas_q=...;

However, this gives me a 403 nastygram:

  IOException Server returned HTTP response code: 403 for URL:
  https://www.google.com/search?hl=enas_q=as_epq=...
  sun.net.www.protocol.http.HttpURLConnection.getInputStream
  (HttpURLConnection.java:1436)

Has anyone here, by chance, been able to do this sort of thing?

-r

 -- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume r...@cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Software system design, development, and documentation


-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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.

 http://build.clojure.org/job/core.typed/3/console

 Thanks,
 Ambrose


 On Sun, Feb 24, 2013 at 12:50 AM, Chas Emerick c...@cemerick.com wrote:

 On Feb 23, 2013, at 11:35 AM, Stuart Sierra wrote:

 Furthermore, according to the policy of the Maven Central 
 Repositoryhttp://search.maven.org/,
 we cannot deploy anything which depends on third-party repositories.
 Therefore we cannot deploy core.typed to the Central Repository unless all
 its dependencies are also deployed there.


 Straying further off-topic, but: FWIW, unless they've changed the
 verification of POMs being promoted recently, that's not so.  The official
 guide to OSS deployment only says it's strongly discouraged (
 https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide),
 and links to blog posts that indicate that Sonatype is (was?) planning on
 rewriting POMs to remove external repository definitions, but tons of
 artifacts in central still contain them, e.g.:


 http://repo1.maven.org/maven2/org/openid4java/openid4java-nodeps/0.9.6/openid4java-nodeps-0.9.6.pom

 (…which refers to a now-defunct Guice repository, thus highlighting the
 rationale for the proposed no-external-repositories policy.)

 Cheers,

 - Chas

 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 generate by clicking, I don't see any ethical issue with
circumventing their countermeasures, especially not if the search will be
triggered by a user input to your application anyway.


On Fri, Mar 22, 2013 at 3:09 AM, Rich Morin r...@cfcl.com wrote:

 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 next thought was to slurp in a page from the interactive
 Google Search facility, using the URL from Advanced Search:

   http://www.google.com/search?hl=enas_q=...;

 However, this gives me a 403 nastygram:

   IOException Server returned HTTP response code: 403 for URL:
   https://www.google.com/search?hl=enas_q=as_epq=...
   sun.net.www.protocol.http.HttpURLConnection.getInputStream
   (HttpURLConnection.java:1436)

 Has anyone here, by chance, been able to do this sort of thing?

 -r

  --
 http://www.cfcl.com/rdmRich Morin
 http://www.cfcl.com/rdm/resume r...@cfcl.com
 http://www.cfcl.com/rdm/weblog +1 650-873-7841

 Software system design, development, and documentation


 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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
/native/windows/x86_64

Then deploy the jar to your repo and refer to it as normal from
project.clj, no need to set native path manually...

On 22 March 2013 02:17, xumingmingv xumingming64398...@gmail.com wrote:
 Have a look at this:
 http://nakkaya.com/2010/04/05/managing-native-dependencies-with-leiningen/

 在 2013-3-22,上午6:55,Dave Snowdon dave.snow...@gmail.com 写道:

 I just upgraded from leiningen version 1.5.2 to 2.0.0 and noticed that the
 native library path no longer seems to be set correctly.

 Here is my project file:

 (defproject naojure 0.1.0-SNAPSHOT
   :description Clojure wrapper for Aldebaran Robotics java NAOQI binding.
 Depends on the Aldebaran jar file being installed in a local repo and the
 shared library being in the dynamic library load path
   :url https://github.com/davesnowdon/naojure;
   :repositories {local ~(str (.toURI (java.io.File. maven_repository)))}
   :native-path native
   :dependencies [[org.clojure/clojure 1.4.0] [com.aldebaran/jnaoqi
 1.14.0]])

 The native library is in a folder native at the top-level of the project
 and the corresponding jar in a local repo also contained within the
 leiningen project.

 If I run lein1 repl (I renamed the old leiningen script before upgrading)
 then I can create instances of native classes from the repl, If I run lein
 repl (leiningen 2.0.0) then I get the following error:

 CompilerException java.lang.UnsatisfiedLinkError: no jnaoqi in
 java.library.path, compiling:(NO_SOURCE_PATH:1)

 Here are the exact values reported by lein version (running on Linux -
 Fedora Core 14)
 Leiningen 1.5.2 on Java 1.6.0_20 OpenJDK 64-Bit Server VM
 
 Leiningen 2.0.0 on Java 1.6.0_20 OpenJDK 64-Bit Server VM

 I've looked online for issues related to leiningen and native path handling
 but the bugs I found all related to leiningen 1 and have been supposedly
 fixed.

 Can anyone suggest why the native library is not being located?

 thanks

 Dave

 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.





-- 
Karsten Schmidt
http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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?


It returns the argument if it contains it, and otherwise 
nil.http://clojure.org/data_structures#Data%20Structures-Sets


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 does keyset-b knows we are 
looking for an item with key id and value 3?

Apparently I am missing something here hence my confusion.

Cheers

On Thursday, March 21, 2013 8:48:51 PM UTC+2, Marko Topolnik wrote:

 On Thursday, March 21, 2013 5:21:53 PM UTC+1, Ryan wrote:

 Thanks Marko. I do have couple more q's for you just to ensure I got 
 everything right:

 (comp keyset-b key-fn)
 This results in a function that first applies *key-fn*, then *keyset-b*. 
 So it's like #(keyset-b (key-fn %)). Let's call this function *predicate
 *.


 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?


 It returns the argument if it contains it, and otherwise 
 nil.http://clojure.org/data_structures#Data%20Structures-Sets
  

 2. Isn't it more idiomatic to write #((key-fn %) keyset-b) ?


 No, because it doesn't work :) An arbitrary object cannot be applied as a 
 function.
  

 3. Does remove loops list-a internally and applies the predicate to each 
 item? (if the answer is no my head will definitely explode)


 *remove* is just like *filter*, only with reversed logic. Its 
 implementation in fact is literally

 (filter (complement pred) 
 coll))http://clojuredocs.org/clojure_core/1.2.0/clojure.core/remove
  

 On Thursday, March 21, 2013 6:09:42 PM UTC+2, Marko Topolnik wrote:

 Personal preference. It causes less mental load because it more 
 obviously spells out what you are doing.

 On Thursday, March 21, 2013 4:58:08 PM UTC+1, Ryan wrote:

 Thanks a lot Marko. Much better now :)

 I also wanted to ask you why did you mention in a previous post that 
 you prefer using *remove *than *filter + complement*. Is there a 
 reason for this or just a personal preference?

 Ryan

 On Thursday, March 21, 2013 5:37:33 PM UTC+2, Marko Topolnik wrote:

 First we build a set of all the keys in *list-b*: 

 (into #{} (map key-fn list-b))

 Let's call that set *keyset-b. *Then we use *keyset-b* as a function 
 which returns truthy (non-nil) for any key that is contained in it, and 
 compose it with our *key-fn*:

 (comp keyset-b key-fn)

 This results in a function that first applies *key-fn*, then *keyset-b
 *. So it's like #(keyset-b (key-fn %)). Let's call this function *
 predicate*.

 Finally, we use *predicate* to *remove* any member of *list-a* for 
 which it is truthy:

 (remove predicate list-a)

 -marko

 On Thursday, March 21, 2013 4:14:46 PM UTC+1, Ryan wrote:

 Marko,

 Can you please do me a favor and break down the function you 
 suggested me? I understand partially how it works but I am having 
 trouble 
 to fully get it.

 (remove (comp (into #{} (map key-fn list-b)) key-fn) list-a)



-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 does keyset-b knows we are 
 looking for an item with key id and value 3?


Well, as its name already indicates, te keyset contains the keys. So it 
will literally contain that 3 as its member.

-marko 

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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):

 https://gist.github.com/frenchy64/5218783

 This is with commit 3b387f914815e389313897977eb02a9fba89dea2

 Is this to do with my environment?

 Thanks,
 Ambrose

 On Fri, Mar 22, 2013 at 11:09 AM, Ambrose Bonnaire-Sergeant 
 abonnair...@gmail.com javascript: wrote:

 Hi David,

 Excellent work so far!

 I'll have a dig around and see what I find.

 Thanks,
 Ambrose


 On Fri, Mar 22, 2013 at 10:53 AM, dmiller dmill...@gmail.comjavascript:
  wrote:

 Last update on this here:


 The port of core.logic to ClojureCLR that resides here:  
 https://github.com/**dmiller/clr.core.logichttps://github.com/dmiller/clr.core.logic
   
 the datomic piece is not ported.

 All tests run EXCEPT:

 test-binding-map-*
 test-binding-map-as-1
 test-binding-map-constraints-1
 test-unifier-constraints-*
 test-flatteno
 test-unifier-anon-constraints-3
 test-36-unifier-behavior

 These tests mostly involve clojure.core.logic.unifier/unify and 
 .../unifier.
 It is rather daunting to just jump into core.logic and debug this kind 
 of thing, so it might take a while for me to solve this.
 I invite anyone interested in ClojureCLR + core.logic to take a look.

 -David

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  





-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 pushed out version 2.1.1 of Leiningen, which contains a 
 handful of bug fixes from 2.1.0. 

 * Add `:test-paths` to directories shared by checkout deps. (Phil 
 Hagelberg) 
 * Allow `run` task to function outside projects. (Phil Hagelberg) 
 * Fix a bug preventing `with-profiles` working outside projects. (Colin 
 Jones) 
 * Fix a bug in trampolined `repl`. (Colin Jones) 
 * Fix a bug in `update-in` task causing stack overflow. (David Powell) 
 * Fix a bug in `lein upgrade`. (Phil Hagelberg) 

 This should address a few issues people came across in 2.1.0, but 
 there's nothing terribly exciting. 

 That is all. 

 -Phil 


-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 generate by clicking, I don't see any ethical issue with
 circumventing their countermeasures, especially not if the search will be
 triggered by a user input to your application anyway.


 On Fri, Mar 22, 2013 at 3:09 AM, Rich Morin r...@cfcl.com wrote:

 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 next thought was to slurp in a page from the interactive
 Google Search facility, using the URL from Advanced Search:

   http://www.google.com/search?hl=enas_q=...;

 However, this gives me a 403 nastygram:

   IOException Server returned HTTP response code: 403 for URL:
   https://www.google.com/search?hl=enas_q=as_epq=...
   sun.net.www.protocol.http.HttpURLConnection.getInputStream
   (HttpURLConnection.java:1436)

 Has anyone here, by chance, been able to do this sort of thing?

 -r

  --
 http://www.cfcl.com/rdmRich Morin
 http://www.cfcl.com/rdm/resume r...@cfcl.com
 http://www.cfcl.com/rdm/weblog +1 650-873-7841

 Software system design, development, and documentation


 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



  --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[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 receiving people's feedback.

We consider this a solution for delivering applications where most of
the interaction happens in the browser, where delivering information
to browsers should happen quickly and responsively, and where servers
are primarily responsible for processing data, not creating and
transmitting presentations.

If you'd like to learn more, please visit the project's website at
http://pedestal.io

To see some sample applications, please checkout and review our sample
Git repository hosted at http://github.com/pedestal/samples

To start with a new pedestal application, you can do:

lein new pedestal-application your app name

To start a new pedestal service, you can do:

lein new pedestal-service your app name

Please let us know what you think!

-Alex Redingotn

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 
and start over. Currently I'm doing some experimenting with sjacket 
(https://github.com/cgrand/sjacket) trying to see if we could make that 
work for renaming. Once I'm confident that direction will work I'm happy to 
throw some code up on Github. If someone beats me to it then I'd like to 
contribute to their project.

I just created a #clojure-refactoring channel up on Freenode to make it 
easier to collaborate. We can rename the node once a name emerges for a new 
project.

On Thursday, March 21, 2013 12:12:42 AM UTC-6, Akhil Wali wrote:

 A fairly new project for refactoring Clojure is clj-refactor.el.
 Not too much functionality yet, but supplements clojure-refactoring pretty 
 well. 
 clj-refactor.el will later interop with nRepl, or that's the plan I heard.

 That aside (and I know I'm being redundant), refactoring any Lisp is a 
 snap with paredit-mode.
 It doesn't do stuff like renaming a function or exracting a var, but I've 
 had some success in making these operations as interactive functions. 



 On Thu, Mar 21, 2013 at 8:11 AM, Devin Walters dev...@gmail.comjavascript:
  wrote:

 Yeah it sort of bums me out that clojure-refactoring has been in the 
 ditch.

 There are a number of tasks to get this back into a good state. The plan 
 right now is to take tests (which were mostly failing and using outdated 
 dependencies) from the old-test directory and get them passing under Midje. 
 Then, get it to play nicely with nrepl and update any elisp that needs 
 updating to bring back the clojure-refactoring minor mode.

 If anyone wants to help resurrect this project: 
 https://github.com/devn/clojure-refactoring/tree/clojure-1.5 your help 
 would be appreciated. I created a new branch and started bringing old 
 failing tests over. Feel free to drop me a pull request. Big, sweeping 
 commits and tiny typo commits are both equally welcome.
  
 On Wednesday, March 20, 2013 at 8:22 PM, Dave Kincaid wrote:

 Thanks. It looks like nothing has happened on that in a year and it 
 appears to require slime/swank. But it's a start I guess if there isn't 
 anything else.

 On Wednesday, March 20, 2013 6:13:30 PM UTC-7, Devin Walters (devn) wrote:

  I don't think much has happened with it recently, but I used to use 
 https://github.com/joodie/**clojure-refactoringhttps://github.com/joodie/clojure-refactoring
 .

 -- 
 '(Devin Walters)
 Sent from my Motorola RAZR V3 (Matte Black)

 On Wednesday, March 20, 2013 at 8:05 PM, Dave Kincaid wrote:

 I'm wondering if there are any refactoring tools around for working with 
 Clojure projects in Emacs. There seems to be all kinds of other tools 
 except for refactoring. I'm really looking for simple things like ways to 
 easily rename variables, functions, namespaces, etc. That seems to be the 
 most common thing I'm trying to do. Are there any tools out there to make 
 it easier?

 Thanks,

 Dave

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@**googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  
  

  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  
  
  
  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your 

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 open-connection [url]
  (doto (.openConnection url)
(.setRequestProperty User-Agent user-agent)))
 
(defn get-response [url]
  (let [conn (open-connection url)
in   (.getInputStream conn)
sb   (StringBuilder.)]
(loop [c (.read in)]
  (if (neg? c)
(str sb)
(do 
  (.append sb (char c))
  (recur (.read in)))
 
(defn search [query]
  (let [url (URL. (str google-search-url (URLEncoder/encode query)))]
(get-response url)))
(spit response.html (search URLEncoder java 7))


HIH,


Juan

On Friday, March 22, 2013 4:32:33 AM UTC-3, Cedric Greevey wrote:

 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 generate by clicking, I don't see any ethical issue with 
 circumventing their countermeasures, especially not if the search will be 
 triggered by a user input to your application anyway.


 On Fri, Mar 22, 2013 at 3:09 AM, Rich Morin r...@cfcl.com 
 javascript:wrote:

 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 next thought was to slurp in a page from the interactive
 Google Search facility, using the URL from Advanced Search:

   http://www.google.com/search?hl=enas_q=...;

 However, this gives me a 403 nastygram:

   IOException Server returned HTTP response code: 403 for URL:
   https://www.google.com/search?hl=enas_q=as_epq=...
   sun.net.www.protocol.http.HttpURLConnection.getInputStream
   (HttpURLConnection.java:1436)

 Has anyone here, by chance, been able to do this sort of thing?

 -r

  --
 http://www.cfcl.com/rdmRich Morin
 http://www.cfcl.com/rdm/resume r...@cfcl.com javascript:
 http://www.cfcl.com/rdm/weblog +1 650-873-7841

 Software system design, development, and documentation


 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.





-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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

On Fri, Mar 22, 2013 at 12:20 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

  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 moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/QwKmsLwLhjE/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Juan Facorro

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 lawrencecloj...@gmail.com wrote:

 I am getting a null pointer exception in the line where I conj into the
 vector. I added the pprint so I could see what was going on. I am confused
 by the outcome:

 (defn convert-json-to-xml [json-as-flat-maps]
   (reduce
(fn [vector-of-strings next-movie-as-map]
  (println next move as map: )
  (println (pp/pprint next-movie-as-map))
  (if (seq next-movie-as-map)
(conj vector-of-strings (xml/emit-str (xml/map-Element
 next-movie-as-map)))
vector-of-strings))
[]
json-as-flat-maps))

 The pprint is showing me this:

 {:film_64209.9096316473 513e67e3c07f5dd74551,
  :cast_member_64209.9096316473 5148c50dc07f5db4233a,
  :title_64209.9096316473 Sound design,
  :director ,
  :runtime 5,
  :movie-id 513e67e3c07f5dd74551,
  :title Two Islands,
  :thumb

 https://s3.amazonaws.com/tribeca_cms_production/uploads/uploads/film/photo_1/513e67e3c07f5dd74551/small_TWO_ISLANDS_2_pubs.jpg;,
  :categories [Documentary],
  :youtube_url ,
  :website_url ,
  :name_64209.9096316473 Svante Colérus,
  :description
  Two Islands is film about two enormous waste dumps in New York City. The
 first was once the largest dump in the world. The other, a cemetery of
 unknowns, is still in use. Two Islands bluntly asks, what does the existence
 of these two huge mountains of economic and social waste and rejected
 surplus tell us about our civilization and the so-called richest nation in
 the world? What kind of legacy will future archaeologists see?}


 Any thoughts about what triggers a null pointer exception? I am using this
 XML library:

 http://clojure.github.com/data.xml/






 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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, eventually). 

I start with rows like this: 

  ;;
  ;; {
  ;; 
Thumb_img_url:https:\/\/s3.amazonaws.com\/tribeca_cms_production\/uploads\/uploads\/film\/photo_1\/513a82d1c07f5d471377\/small_odayaka__1_PUBS.jpg,
  ;; website_url:,
  ;; director:,
  ;; large_img_url:null,
  ;; youtube_url:,
  ;; title:Odayaka,
  ;; runtime:100,
  ;; id:513a82d1c07f5d471377,
  ;; categories:[Drama],
  ;; description:The Great East Japan Earthquake has just 
struck, the waters of the ensuing tsunami finally rolling back into the 
sea. In the comparative safety of Tokyo, two wives and a child living in 
the same apartment building have nothing to do but wait for their 
husbands\u2019 return. Nobuteru Uchida finds a striking emotional core to 
the shock of March 11, 2011, crafting a tender and intelligent narrative on 
the internal effects of an unspeakable national tragedy.,
  ;; cast:
  ;; [
  ;; {
  ;; _id:513a82d1c07f5d471378,
  ;; film_id:513a82d1c07f5d471377,
  ;; name:Jo Keita,
  ;;  Aya Saito,
  ;; title:Associate Producer
  ;; },
  ;; {
  ;; _id:513a82d1c07f5d471379,
  ;; film_id:513a82d1c07f5d471377,
  ;; name:Kiki Sugino,
  ;;  Yukiko Shinohara,
  ;;  Takeshi Yamamoto,
  ;;  Ami Watanabe,
  ;;  Yu Koyanagi,
  ;;  Makiko Watanabe,
  ;; title:Cast
  ;; },
  ;; {
  ;; _id:513a82d1c07f5d47137a,
  ;; film_id:513a82d1c07f5d471377,
  ;; name:Shinichi Tsunoda,
  ;; title:Cinematographer
  ;; },
  ;; {
  ;;  _id:513a82d1c07f5d47137b,
  ;; film_id:513a82d1c07f5d471377,
  ;; name:Jo Keita,
  ;; title:Composer
  ;; },
  ;; {
  ;;  _id:513a82d1c07f5d47137c,
  ;; film_id:513a82d1c07f5d471377,
  ;; name:Nobuteru Uchida,
  ;; title:Director
  ;; },
  ;; {
  ;; _id:513a82d1c07f5d47137d,
  ;; film_id:513a82d1c07f5d471377,
  ;; name:Nobuteru Uchida,
  ;; title:Editor
  ;; },
  ;; {
  ;; _id:513a82d1c07f5d47137e,
  ;; film_id:513a82d1c07f5d471377,
  ;; name:Kousuke Ono,
  ;; title:Executive Producer
  ;; },
  ;; {
  ;;  _id:513a82d1c07f5d47137f,
  ;; film_id:513a82d1c07f5d471377,
  ;; name:Kiki Sugino,
  ;;  Eric Nyari,
  ;; title:Producer
  ;; },
  ;; {
  ;; _id:513a82d1c07f5d471380,
  ;; film_id:513a82d1c07f5d471377,
  ;; name:Nobuteru Uchida,
  ;; title:Screenwriter
  ;; }
  ;; ]
  ;; },


I flattened this by inventing keys for the nested cast members. But now my 
different rows have different keys. I guess I should pad this so they all 
have the same rows? Or maybe I've missed something obvious? Seems like I 
shouldn't have to engage in ugly hacks for something this simple. 




On Friday, March 22, 2013 11:37:31 AM UTC-4, Gary Verhaegen wrote:

 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 
 lawrenc...@gmail.comjavascript: 
 wrote: 
  
  I am getting a null pointer exception in the line where I conj into the 
  vector. I added the pprint so I could see what was going on. I am 
 confused 
  by the outcome: 
  
  (defn convert-json-to-xml [json-as-flat-maps] 
(reduce 
 (fn [vector-of-strings next-movie-as-map] 
   (println next move as map: ) 
   (println (pp/pprint next-movie-as-map)) 
   (if (seq next-movie-as-map) 
 (conj vector-of-strings (xml/emit-str (xml/map-Element 
  next-movie-as-map))) 
 vector-of-strings)) 
 [] 
 json-as-flat-maps)) 
  
  The pprint is showing me this: 
  
  {:film_64209.9096316473 513e67e3c07f5dd74551, 
   :cast_member_64209.9096316473 5148c50dc07f5db4233a, 
   :title_64209.9096316473 Sound design, 
   

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 now I'm back on a
productive path.

-r

 -- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume r...@cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Software system design, development, and documentation


-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 is the value of the id). How exactly is that 
 number is being looked up in keyset-b? How does keyset-b knows we are 
 looking for an item with key id and value 3?


 Well, as its name already indicates, te keyset contains the keys. So it 
 will literally contain that 3 as its member.

 -marko 


-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 *
slurp* does.

(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 open-connection [url]
  (doto (.openConnection url)
(.setRequestProperty User-Agent user-agent)))
 (defn get-response [url]
  (let [conn (open-connection url)
sb   (StringBuilder.)]
(slurp (.getInputStream conn
 (defn search [query]
  (let [url (java.net.URL. (str google-search-url (URLEncoder/encode query)))]
(get-response url)))
(spit response.html (search clojure google))


J
On Friday, March 22, 2013 1:02:53 PM UTC-3, Rich Morin wrote:

 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 now I'm back on a 
 productive path. 

 -r 

  -- 
 http://www.cfcl.com/rdmRich Morin 
 http://www.cfcl.com/rdm/resume r...@cfcl.com javascript: 
 http://www.cfcl.com/rdm/weblog +1 650-873-7841 

 Software system design, development, and documentation 




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 next thought was to slurp in a page from the interactive 
 Google Search facility, using the URL from Advanced Search: 

   http://www.google.com/search?hl=enas_q=...; 

 However, this gives me a 403 nastygram: 

   IOException Server returned HTTP response code: 403 for URL: 
   https://www.google.com/search?hl=enas_q=as_epq=... 
   sun.net.www.protocol.http.HttpURLConnection.getInputStream 
   (HttpURLConnection.java:1436) 

 Has anyone here, by chance, been able to do this sort of thing? 

 -r 

  -- 
 http://www.cfcl.com/rdmRich Morin 
 http://www.cfcl.com/rdm/resume r...@cfcl.com javascript: 
 http://www.cfcl.com/rdm/weblog +1 650-873-7841 

 Software system design, development, and documentation 




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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. 
https://github.com/flatland/lazybot/blob/develop/src/lazybot/plugins/google.clj

On Friday, March 22, 2013 10:54:37 AM UTC-7, Armando Blancas wrote:

 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 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 next thought was to slurp in a page from the interactive 
 Google Search facility, using the URL from Advanced Search: 

   http://www.google.com/search?hl=enas_q=...; 

 However, this gives me a 403 nastygram: 

   IOException Server returned HTTP response code: 403 for URL: 
   https://www.google.com/search?hl=enas_q=as_epq=... 
   sun.net.www.protocol.http.HttpURLConnection.getInputStream 
   (HttpURLConnection.java:1436) 

 Has anyone here, by chance, been able to do this sort of thing? 

 -r 

  -- 
 http://www.cfcl.com/rdmRich Morin 
 http://www.cfcl.com/rdm/resume r...@cfcl.com 
 http://www.cfcl.com/rdm/weblog +1 650-873-7841 

 Software system design, development, and documentation 




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 getting started docs: In a few minutes it
walks through the building of a Pedestal app with : a backend ((micro)
service) + frontend (clojurescript) + db (datomic), so we've got
everything from the start, that's neat!

It looks like Clojure's Pedestal is a game-changer.

Denis

On Fri, Mar 22, 2013 at 5:04 PM, Michael Klishin 
michael.s.klis...@gmail.com wrote:


 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 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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. Tony was very adamant that we ditch his code
 and start over. Currently I'm doing some experimenting with sjacket (
 https://github.com/cgrand/sjacket) trying to see if we could make that
 work for renaming. Once I'm confident that direction will work I'm happy to
 throw some code up on Github. If someone beats me to it then I'd like to
 contribute to their project.

 I just created a #clojure-refactoring channel up on Freenode to make it
 easier to collaborate. We can rename the node once a name emerges for a new
 project.


Please note that I've also created a project entry for the Google Summer Of
Code for this : creating refactoring library + integration of it into
Counterclockwise :
http://dev.clojure.org/display/community/Project+Ideas#ProjectIdeas-RefactoringfeatureforCCWotherIDEs

I think writing a refactoring library with more than one client in mind
(e.g. a command line client as well as an IDE client) is interesting
because it will help shape its API (for instance, an IDE client will
usually want to offer a view of the modifications to be applied, thus
refactoring can have a review step).

Cheers,

-- 
Laurent



 On Thursday, March 21, 2013 12:12:42 AM UTC-6, Akhil Wali wrote:

 A fairly new project for refactoring Clojure is clj-refactor.el.
 Not too much functionality yet, but supplements clojure-refactoring
 pretty well.
 clj-refactor.el will later interop with nRepl, or that's the plan I heard.

 That aside (and I know I'm being redundant), refactoring any Lisp is a
 snap with paredit-mode.
 It doesn't do stuff like renaming a function or exracting a var, but I've
 had some success in making these operations as interactive functions.



 On Thu, Mar 21, 2013 at 8:11 AM, Devin Walters dev...@gmail.com wrote:

 Yeah it sort of bums me out that clojure-refactoring has been in the
 ditch.

 There are a number of tasks to get this back into a good state. The plan
 right now is to take tests (which were mostly failing and using outdated
 dependencies) from the old-test directory and get them passing under Midje.
 Then, get it to play nicely with nrepl and update any elisp that needs
 updating to bring back the clojure-refactoring minor mode.

 If anyone wants to help resurrect this project: https://github.com/**
 devn/clojure-refactoring/tree/**clojure-1.5https://github.com/devn/clojure-refactoring/tree/clojure-1.5
  your
 help would be appreciated. I created a new branch and started bringing
 old failing tests over. Feel free to drop me a pull request. Big, sweeping
 commits and tiny typo commits are both equally welcome.

 On Wednesday, March 20, 2013 at 8:22 PM, Dave Kincaid wrote:

 Thanks. It looks like nothing has happened on that in a year and it
 appears to require slime/swank. But it's a start I guess if there isn't
 anything else.

 On Wednesday, March 20, 2013 6:13:30 PM UTC-7, Devin Walters (devn)
 wrote:

  I don't think much has happened with it recently, but I used to use
 https://github.com/joodie/clojure-refactoringhttps://github.com/joodie/clojure-refactoring
 .

 --
 '(Devin Walters)
 Sent from my Motorola RAZR V3 (Matte Black)

 On Wednesday, March 20, 2013 at 8:05 PM, Dave Kincaid wrote:

 I'm wondering if there are any refactoring tools around for working with
 Clojure projects in Emacs. There seems to be all kinds of other tools
 except for refactoring. I'm really looking for simple things like ways to
 easily rename variables, functions, namespaces, etc. That seems to be the
 most common thing I'm trying to do. Are there any tools out there to make
 it easier?

 Thanks,

 Dave

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@**googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group**/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+u...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out
 .




  --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 

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 {: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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups Clojure group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
--
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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}
as constant and will only create it once when compiling.

First version is preferred.



 Cheers,

 Jamie

 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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} 
 as constant and will only create it once when compiling.

 First version is preferred.
  


 Cheers,

 Jamie

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 compiler.


 Interesting.  I see you are correct that the problem only occurs on
 metadata attached to an empty literal.  So does that mean this is a known
 bug?

 --

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 api, if that's 
 helpful. No API key needed. 
 https://github.com/flatland/lazybot/blob/develop/src/lazybot/plugins/google.clj

 On Friday, March 22, 2013 10:54:37 AM UTC-7, Armando Blancas wrote:

 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 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 next thought was to slurp in a page from the interactive 
 Google Search facility, using the URL from Advanced Search: 

   http://www.google.com/search?hl=enas_q=...; 

 However, this gives me a 403 nastygram: 

   IOException Server returned HTTP response code: 403 for URL: 
   https://www.google.com/search?hl=enas_q=as_epq=... 
   sun.net.www.protocol.http.HttpURLConnection.getInputStream 
   (HttpURLConnection.java:1436) 

 Has anyone here, by chance, been able to do this sort of thing? 

 -r 

  -- 
 http://www.cfcl.com/rdmRich Morin 
 http://www.cfcl.com/rdm/resume r...@cfcl.com 
 http://www.cfcl.com/rdm/weblog +1 650-873-7841 

 Software system design, development, and documentation 




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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, March 21, 2013 6:44:09 PM UTC-4, Phil Hagelberg wrote:


 Hello folks. 

 I've just pushed out version 2.1.1 of Leiningen, which contains a 
 handful of bug fixes from 2.1.0. 

 * Add `:test-paths` to directories shared by checkout deps. (Phil 
 Hagelberg) 
 * Allow `run` task to function outside projects. (Phil Hagelberg) 
 * Fix a bug preventing `with-profiles` working outside projects. (Colin 
 Jones) 
 * Fix a bug in trampolined `repl`. (Colin Jones) 
 * Fix a bug in `update-in` task causing stack overflow. (David Powell) 
 * Fix a bug in `lein upgrade`. (Phil Hagelberg) 

 This should address a few issues people came across in 2.1.0, but 
 there's nothing terribly exciting. 

 That is all. 

 -Phil 


-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 f2 or a more general concept.

Use both appropriately to write more expressive code -constraining yourself 
to only one is like taking some of the colors off your palette.

In addition to the expression differences, there are two closely related 
issues that should be considered:

1. There is a difference in the evaluation semantics.  In the first 
example, the form bound to x is evaluated every time f1 is called.  In the 
second, the form is invoked just once (at compile time) and then closed 
over by f2.  That can have very real consequences in real world apps 
(performance, side-effects).  In simple cases where the form is effectively 
constant (as in your example), the compiler may optimize things such that 
the costs are equivalent -but I don't think that's a guarantee, especially 
on different runtimes (CLR, ClojureScript, etc).

2. There is a scope difference between the two.  The second approach allows 
you to close over x with multiple functions:

(let [x {:foo 1 :bar 2 :baz 3}] 
  (defn f3 [] 
(keys x))
  (defn f4 [] 
(vals x)))

-Chris

On Friday, March 22, 2013 2:59:43 PM UTC-4, jamieorc wrote:

 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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 {: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 post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient 
  with your first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 
  --- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To unsubscribe from this group and stop receiving emails from it, send 
  an email to clojure+u...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  



-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 introduced a bug in the mono build.  I should have that 
fixed tomorrow morning sometime.  

-David


On Friday, March 22, 2013 7:22:54 AM UTC-5, Ambrose Bonnaire-Sergeant wrote:

 Not sure how to tell the commit, but lein-clr has pulled 
 down: clojure-clr-1.4.0-Debug-4.0.zip

 Thanks,
 Ambrose

 On Fri, Mar 22, 2013 at 8:11 PM, dmiller dmill...@gmail.com javascript:
  wrote:

 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):

 https://gist.github.com/**frenchy64/5218783https://gist.github.com/frenchy64/5218783

 This is with commit **3b387f914815e389313897977eb02a**9fba89dea2

 Is this to do with my environment?

 Thanks,
 Ambrose

 On Fri, Mar 22, 2013 at 11:09 AM, Ambrose Bonnaire-Sergeant 
 abonnair...@gmail.com wrote:

  Hi David,

 Excellent work so far!

 I'll have a dig around and see what I find.

 Thanks,
 Ambrose


  On Fri, Mar 22, 2013 at 10:53 AM, dmiller dmill...@gmail.com wrote:

 Last update on this here:


 The port of core.logic to ClojureCLR that resides here:  
 https://github.com/**dmiller/**clr.core.logichttps://github.com/dmiller/clr.core.logic
   
 the datomic piece is not ported.

 All tests run EXCEPT:

 test-binding-map-*
 test-binding-map-as-1
 test-binding-map-constraints-1
 test-unifier-constraints-*
 test-flatteno
 test-unifier-anon-constraints-**3
 test-36-unifier-behavior
  
 These tests mostly involve clojure.core.logic.unifier/**unify and 
 .../unifier.
 It is rather daunting to just jump into core.logic and debug this kind 
 of thing, so it might take a while for me to solve this.
 I invite anyone interested in ClojureCLR + core.logic to take a look.

 -David

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com

 Note that posts from new members are moderated - please be patient 
 with your first post.
 To unsubscribe from this group, send email to
 clojure+u...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  



  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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. If you truly need a const value, then something like this is
better, IMO:

(def ^:private ^:const data {:a 1 :b 2})

(defn f1 [])
(defn f2 [])

I would say that most of the time, the let at the top version could be
refactored into a def with no change in semantics, while at the same time
gaining a bonus to readability.






On Fri, Mar 22, 2013 at 2:41 PM, Robert Pitts rbxbx...@gmail.com wrote:

 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 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 {: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 post to this group, send email to clo...@googlegroups.com
  Note that posts from new members are moderated - please be patient
  with your first post.
  To unsubscribe from this group, send email to
  clojure+u...@**googlegroups.com
  For more options, visit this group at
  http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an email to clojure+u...@**googlegroups.com.
  For more options, visit 
  https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out.

 
 

  --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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-10-16.html

 Second link seems to think it's a problem with datomic or maybe lein, but 
 I'm using maven and not using datomic, so it *seems* like there's some race 
 condition involving loading logging classes where this happens. I don't 
 understand this, since LoggerFactory is defined at top-level in 
 clojure.tools.logging.impl and impl is required in the ns declaration of 
 clojure.tools.logging.


-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 [cast-members-listed-in-a-vector]
  (timbre/spy :debug  return value of transform-cast-members-into-xml 
  (reduce
   (fn [vector-of-xml-elements next-cast-member-as-map]
   (conj vector-of-xml-elements (xml/element :cast-member {}
 (xml/element 
:film-id {} (get next-cast-member-as-map film_id))
 (xml/element 
:cast-member-name {} (get next-cast-member-as-map name))
 (xml/element 
:cast-member-title {} (get next-cast-member-as-map title)
 []
 cast-members-listed-in-a-vector)))

(defn transform-movie-json-to-vector-of-xml-elements [json-to-convert]
  (timbre/spy :debug return value of 
transform-movie-json-to-vector-of-xml-elements
  (reduce
   (fn [vector-of-xml-elements next-json-map]
 (if (seq next-json-map)
   (conj vector-of-xml-elements (xml/element :movie {}
 (xml/element 
:thumb_img_url {} (get next-json-map Thumb_img_url))
 (xml/element 
:website_url {} (get next-json-map website_url))
 (xml/element 
:director {} (get next-json-map director))
 (xml/element 
:youtube_url {} (get next-json-map youtube_url))
 (xml/element 
:title {} (get next-json-map title))
 (xml/element 
:runtime {} (get next-json-map runtime))
 (xml/element 
:_id {} (get next-json-map _id))
 (xml/element 
:categories {} (st/join , (get next-json-map categories)))
 (xml/element 
:description {} (get next-json-map description))
 (xml/element 
:cast {} (transform-cast-members-into-xml (get next-json-map cast)
   vector-of-xml-elements))
   []
   json-to-convert)))

(defn json-to-xml [request]
  (let [string-to-convert (slurp 
http://tribecafilm.com/api/xomo/films.json;)
json-to-convert (json/read-str string-to-convert)
vector-of-xml-elements 
(transform-movie-json-to-vector-of-xml-elements json-to-convert)
final-xml-element (xml/element :movies {} vector-of-xml-elements)
page-string (xml/emit-str final-xml-element)
response-headers {:status 200
  :headers {Content-Type text/plain}
  :body page-string }]
response-headers))







On Friday, March 22, 2013 12:02:25 PM UTC-4, larry google groups wrote:

 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, eventually). 

 I start with rows like this: 

   ;;
   ;; {
   ;; Thumb_img_url:https:\/\/s3.amazonaws.com
 \/tribeca_cms_production\/uploads\/uploads\/film\/photo_1\/513a82d1c07f5d471377\/small_odayaka__1_PUBS.jpg,
   ;; website_url:,
   ;; director:,
   ;; large_img_url:null,
   ;; youtube_url:,
   ;; title:Odayaka,
   ;; runtime:100,
   ;; id:513a82d1c07f5d471377,
   ;; categories:[Drama],
   ;; description:The Great East Japan Earthquake has just 
 struck, the waters of the ensuing tsunami finally rolling back into the 
 sea. In the comparative safety of Tokyo, two wives and a child living in 
 the same apartment building have nothing to do but wait for their 
 husbands\u2019 return. Nobuteru Uchida finds a striking emotional core to 
 the shock of March 11, 2011, crafting a tender and intelligent narrative on 
 the internal effects of an unspeakable national tragedy.,
   ;; cast:
   ;; [
   ;; {
   ;; _id:513a82d1c07f5d471378,
   ;; film_id:513a82d1c07f5d471377,
   ;; name:Jo Keita,
   ;;  Aya Saito,
   ;; title:Associate Producer
   ;; },
   ;; {
   ;; _id:513a82d1c07f5d471379,
   ;; 

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
test scoped dependency and running again gives me:

  [ERROR] InvocationTargetException: java.lang.StringIndexOutOfBoundsException: 
String index out of range: 1, 
compiling:(clojure/core/typed/test/mini_kanren.clj:575:3)

The original error seems to have something to do with the core.contracts
expansion.  Defining TopFilter and BotFilter with c.core/defrecord (and
defining appropriate type predicate functions) seems to get further.

Hugo

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 on the Log In link near the top right of the tools.logging page to
do so.

Andy

On Fri, Mar 22, 2013 at 3:26 PM, Michael Blume blume.m...@gmail.com wrote:

 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
 seem to be the only one

 http://stackoverflow.com/**questions/8291910/**noclassdeffounderror-with-
 **clojure-tools-logginghttp://stackoverflow.com/questions/8291910/noclassdeffounderror-with-clojure-tools-logging

 https://groups.google.com/**forum/#!msg/datomic/6xWGFB-**
 Dx68/_Hr2I4lv39gJhttps://groups.google.com/forum/#!msg/datomic/6xWGFB-Dx68/_Hr2I4lv39gJ

 http://clojure-log.n01se.net/**date/2012-10-16.htmlhttp://clojure-log.n01se.net/date/2012-10-16.html

 Second link seems to think it's a problem with datomic or maybe lein, but
 I'm using maven and not using datomic, so it *seems* like there's some race
 condition involving loading logging classes where this happens. I don't
 understand this, since LoggerFactory is defined at top-level in
 clojure.tools.logging.impl and impl is required in the ns declaration of
 clojure.tools.logging.

  --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 zi:test, and it
 complained about a missing dependency on tools.macro.  Adding that as a
 test scoped dependency and running again gives me:

   [ERROR] InvocationTargetException:
 java.lang.StringIndexOutOfBoundsException: String index out of range: 1,
 compiling:(clojure/core/typed/test/mini_kanren.clj:575:3)

 The original error seems to have something to do with the core.contracts
 expansion.  Defining TopFilter and BotFilter with c.core/defrecord (and
 defining appropriate type predicate functions) seems to get further.


Cheers Hugo. You're right, it does get further with some defrecords, then
gets stuck at another defconstrainedrecord predicate.

This is the macroexpansion for a defconstrainedrecord predicate:

  (clojure.core/let [t__3815__auto__ (clojure.core/defrecord
   TopFilter
   [])]
(clojure.core/defn TopFilter? [r__3816__auto__]
  (clojure.core.contracts.constraints/=
t__3815__auto__
(clojure.core/type r__3816__auto__

Perhaps we should be doing an (instance? TopFilter r) here instead? The
output of `defrecord` seems to be out of date immediately when compiling.

Thanks,
Ambrose

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 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
 and start over. Currently I'm doing some experimenting with sjacket (
 https://github.com/cgrand/sjacket) trying to see if we could make that
 work for renaming. Once I'm confident that direction will work I'm happy to
 throw some code up on Github. If someone beats me to it then I'd like to
 contribute to their project.

 I just created a #clojure-refactoring channel up on Freenode to make it
 easier to collaborate. We can rename the node once a name emerges for a new
 project.


 Please note that I've also created a project entry for the Google Summer
 Of Code for this : creating refactoring library + integration of it into
 Counterclockwise :
 http://dev.clojure.org/display/community/Project+Ideas#ProjectIdeas-RefactoringfeatureforCCWotherIDEs

 I think writing a refactoring library with more than one client in mind
 (e.g. a command line client as well as an IDE client) is interesting
 because it will help shape its API (for instance, an IDE client will
 usually want to offer a view of the modifications to be applied, thus
 refactoring can have a review step).

 Cheers,

 --
 Laurent



 On Thursday, March 21, 2013 12:12:42 AM UTC-6, Akhil Wali wrote:

 A fairly new project for refactoring Clojure is clj-refactor.el.
 Not too much functionality yet, but supplements clojure-refactoring
 pretty well.
 clj-refactor.el will later interop with nRepl, or that's the plan I
 heard.

 That aside (and I know I'm being redundant), refactoring any Lisp is a
 snap with paredit-mode.
 It doesn't do stuff like renaming a function or exracting a var, but
 I've had some success in making these operations as interactive functions.



 On Thu, Mar 21, 2013 at 8:11 AM, Devin Walters dev...@gmail.com wrote:

 Yeah it sort of bums me out that clojure-refactoring has been in the
 ditch.

 There are a number of tasks to get this back into a good state. The
 plan right now is to take tests (which were mostly failing and using
 outdated dependencies) from the old-test directory and get them passing
 under Midje. Then, get it to play nicely with nrepl and update any elisp
 that needs updating to bring back the clojure-refactoring minor mode.

 If anyone wants to help resurrect this project: https://github.com/**
 devn/clojure-refactoring/tree/**clojure-1.5https://github.com/devn/clojure-refactoring/tree/clojure-1.5
  your
 help would be appreciated. I created a new branch and started bringing
 old failing tests over. Feel free to drop me a pull request. Big, sweeping
 commits and tiny typo commits are both equally welcome.

 On Wednesday, March 20, 2013 at 8:22 PM, Dave Kincaid wrote:

 Thanks. It looks like nothing has happened on that in a year and it
 appears to require slime/swank. But it's a start I guess if there isn't
 anything else.

 On Wednesday, March 20, 2013 6:13:30 PM UTC-7, Devin Walters (devn)
 wrote:

  I don't think much has happened with it recently, but I used to use
 https://github.com/joodie/clojure-refactoringhttps://github.com/joodie/clojure-refactoring
 .

 --
 '(Devin Walters)
 Sent from my Motorola RAZR V3 (Matte Black)

 On Wednesday, March 20, 2013 at 8:05 PM, Dave Kincaid wrote:

 I'm wondering if there are any refactoring tools around for working
 with Clojure projects in Emacs. There seems to be all kinds of other tools
 except for refactoring. I'm really looking for simple things like ways to
 easily rename variables, functions, namespaces, etc. That seems to be the
 most common thing I'm trying to do. Are there any tools out there to make
 it easier?

 Thanks,

 Dave

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@**googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group**/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+u...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out
 .




  --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to 

[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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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:
 
Object doSomething() { 

Integer a = someComputation();
if(a != null) {
Integer b = anotherComputation(a, 42);
if(b != null  b.intValue() = 0) {
return a / b;
}
else {
return null;
}
}
else {
return null;
}
} 
... which is really only desirable if you believe in the one exit point 
school of imperative programming. It is of course much better to do this:
Object doSomething() {
Integer a = someComputation();
if(a == null) { return null; } 

Integer b = anotherComputation(a, 42);
if(b == null || b.intValue == 0) { return null; }

return a / b;
}



... which is much more literate. In Clojure, I have to write what is 
effectively the first form:

(let [a (some-computation)]
  (if (nil? a)
nil
(let [b (another-computation a 42)]
  (if (or (nil? b) (= b 0))
nil
(/ a b)

While more concise, it suffers the same readability problems as the first 
java version. I can easily imagine a macro to support this idiom:

(let-check [a (some-computation)
:check (nil? a) nil
b (another-computation a 42)
:check (or (nil? b) ( b 0)) nil]
  (/ a b))


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. 

Cheers, 

Russell

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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, Alex Baranosky wrote:

 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 
 lauren...@gmail.comjavascript:
  wrote:

 2013/3/22 Daniel Glauser dangl...@gmail.com javascript:

 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 
 and start over. Currently I'm doing some experimenting with sjacket (
 https://github.com/cgrand/sjacket) trying to see if we could make that 
 work for renaming. Once I'm confident that direction will work I'm happy to 
 throw some code up on Github. If someone beats me to it then I'd like to 
 contribute to their project.

 I just created a #clojure-refactoring channel up on Freenode to make it 
 easier to collaborate. We can rename the node once a name emerges for a new 
 project.


 Please note that I've also created a project entry for the Google Summer 
 Of Code for this : creating refactoring library + integration of it into 
 Counterclockwise : 
 http://dev.clojure.org/display/community/Project+Ideas#ProjectIdeas-RefactoringfeatureforCCWotherIDEs

 I think writing a refactoring library with more than one client in mind 
 (e.g. a command line client as well as an IDE client) is interesting 
 because it will help shape its API (for instance, an IDE client will 
 usually want to offer a view of the modifications to be applied, thus 
 refactoring can have a review step).

 Cheers,

 -- 
 Laurent
  


 On Thursday, March 21, 2013 12:12:42 AM UTC-6, Akhil Wali wrote:

 A fairly new project for refactoring Clojure is clj-refactor.el.
 Not too much functionality yet, but supplements clojure-refactoring 
 pretty well. 
 clj-refactor.el will later interop with nRepl, or that's the plan I 
 heard.

 That aside (and I know I'm being redundant), refactoring any Lisp is a 
 snap with paredit-mode.
 It doesn't do stuff like renaming a function or exracting a var, but 
 I've had some success in making these operations as interactive functions. 



 On Thu, Mar 21, 2013 at 8:11 AM, Devin Walters dev...@gmail.comwrote:

 Yeah it sort of bums me out that clojure-refactoring has been in the 
 ditch.

 There are a number of tasks to get this back into a good state. The 
 plan right now is to take tests (which were mostly failing and using 
 outdated dependencies) from the old-test directory and get them passing 
 under Midje. Then, get it to play nicely with nrepl and update any elisp 
 that needs updating to bring back the clojure-refactoring minor mode.

 If anyone wants to help resurrect this project: https://github.com/**
 devn/clojure-refactoring/tree/**clojure-1.5https://github.com/devn/clojure-refactoring/tree/clojure-1.5
  your 
 help would be appreciated. I created a new branch and started 
 bringing old failing tests over. Feel free to drop me a pull request. 
 Big, 
 sweeping commits and tiny typo commits are both equally welcome.
  
 On Wednesday, March 20, 2013 at 8:22 PM, Dave Kincaid wrote:

 Thanks. It looks like nothing has happened on that in a year and it 
 appears to require slime/swank. But it's a start I guess if there isn't 
 anything else.

 On Wednesday, March 20, 2013 6:13:30 PM UTC-7, Devin Walters (devn) 
 wrote:

  I don't think much has happened with it recently, but I used to use 
 https://github.com/joodie/clojure-refactoringhttps://github.com/joodie/clojure-refactoring
 .

 -- 
 '(Devin Walters)
 Sent from my Motorola RAZR V3 (Matte Black)

 On Wednesday, March 20, 2013 at 8:05 PM, Dave Kincaid wrote:

 I'm wondering if there are any refactoring tools around for working 
 with Clojure projects in Emacs. There seems to be all kinds of other 
 tools 
 except for refactoring. I'm really looking for simple things like ways to 
 easily rename variables, functions, namespaces, etc. That seems to be the 
 most common thing I'm trying to do. Are there any tools out there to make 
 it easier?

 Thanks,

 Dave

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient 
 with your first post.
 To unsubscribe from this group, send email to
 clojure+u...@**googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group**/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups 

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
relative when-let).

Explicit checks for nil are really rare in Clojure code.
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 operations for side 
effects, and nil return means failure)
(and (operation1) (operation2) (operation3) :success)

;; let a value, with potential defaults
(if-let [value (or passed-value (try-to-find-default-value))] )

Apart from that, I found myself writing a few macros to allow early 
bailouts from computations. My favourite currently is the and-as- macro, 
which works like this:

(and-as- (some-initial-value-expression) symbol
  (do-something-with symbol)
  (some-thing-else symbol)
  (reduce some-fn symbol some-seq))

At each step, symbol is rebound to the result of the expression (like 
as-) unless the result is nil, in which case the whole expression bails 
out and returns nil. So it is like a cross between and as as-.



On Saturday, 23 March 2013 11:19:28 UTC+8, Russell Mull wrote:

 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:
  
 Object doSomething() { 

 Integer a = someComputation();
 if(a != null) {
 Integer b = anotherComputation(a, 42);
 if(b != null  b.intValue() = 0) {
 return a / b;
 }
 else {
 return null;
 }
 }
 else {
 return null;
 }
 } 
 ... which is really only desirable if you believe in the one exit point 
 school of imperative programming. It is of course much better to do this:
 Object doSomething() {
 Integer a = someComputation();
 if(a == null) { return null; } 

 Integer b = anotherComputation(a, 42);
 if(b == null || b.intValue == 0) { return null; }

 return a / b;
 }



 ... which is much more literate. In Clojure, I have to write what is 
 effectively the first form:

 (let [a (some-computation)]
   (if (nil? a)
 nil
 (let [b (another-computation a 42)]
   (if (or (nil? b) (= b 0))
 nil
 (/ a b)

 While more concise, it suffers the same readability problems as the first 
 java version. I can easily imagine a macro to support this idiom:

 (let-check [a (some-computation)
 :check (nil? a) nil
 b (another-computation a 42)
 :check (or (nil? b) ( b 0)) nil]
   (/ a b))


 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. 

 Cheers, 

 Russell



-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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 requested that the video release of his keynote be delayed 
as he intends to give it at 1 or 2 other events first, so while I usually 
try to slot the keynotes and more buzzy talks earlier, you'll have to wait 
a bit longer for Rich's talk.

There are sometimes grumblings about how long it takes for videos to appear 
(and occasionally the way in which they appear) on InfoQ. To head those 
comments off at the pass (not directing this at you John, just taking the 
opportunity!), the arrangement I have with InfoQ relies on videos being 
released slowly to maximize ad impressions. There are some benefits to me 
as well in serving as a periodic marketing purpose.  

The benefit to attendees and non-attendees is that the videos exist at all 
- without the InfoQ deal, the cost of recording, editing, and hosting 
videos is literally the difference between whether the conference is in the 
red or black. For attendees, I do really wish that I could provide talks 
sooner just to you and I continue to discuss options for that with InfoQ. 

Alex


On Thursday, March 21, 2013 9:08:48 AM UTC-7, John Gabriele wrote:

 Are there any videos available of the talks recently given at 
 Clojure/West? 

 Is there a central location where these will most likely be found at some 
 point? 


-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.