Re: Duplicate key exception reading map that was written to a file

2015-11-25 Thread Dave Kincaid
I just tried outputting the map to an Avro file and read it back in. This 
works fine. That tells me that there is something wrong with the way that 
I'm trying to write the EDN file somehow.

Here is the code I used to output to Avro and read back:

(def schema (avro/parse-schema {:type :map :values :long}))
(with-open [out-file (avro/data-file-writer schema 
"/tmp/mednotes6153968756847768349/repl-write.avro")] (.append out-file 
phrases))
(def ps (with-open [in-file (avro/data-file-reader 
"/tmp/mednotes6153968756847768349/repl-write.avro")] (doall (seq in-file

I'm using the excellent abracad library :refer'd as avro.


On Wednesday, November 25, 2015 at 10:40:53 PM UTC-6, Dave Kincaid wrote:
>
> The question marks are actual question marks. I'm not sure how to find the 
> "duplicate" keys in the map in memory. As far as I can tell there is only 
> one "? 5" key in the in memory map.
>
> I thought maybe computing the frequencies of the hash values of the keys 
> and looking for any with more than one would find them, but this code:
>
> read-notes> (def dupes (filter #(> (second %) 1) (frequencies (map hash 
> (keys phrases)
> #'read-notes/dupes
> read-notes> (count dupes)
> 8911
>
> seems to indicate 8,911 keys with identical hash values.
>
>
>>>>

-- 
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/d/optout.


Re: Duplicate key exception reading map that was written to a file

2015-11-25 Thread Dave Kincaid
The question marks are actual question marks. I'm not sure how to find the 
"duplicate" keys in the map in memory. As far as I can tell there is only 
one "? 5" key in the in memory map.

I thought maybe computing the frequencies of the hash values of the keys 
and looking for any with more than one would find them, but this code:

read-notes> (def dupes (filter #(> (second %) 1) (frequencies (map hash 
(keys phrases)
#'read-notes/dupes
read-notes> (count dupes)
8911

seems to indicate 8,911 keys with identical hash values.

On Wednesday, November 25, 2015 at 10:27:29 PM UTC-6, Ghadi Shayban wrote:
>
> While in memory before writing, are the hash codes for the "duplicate" 
> keys the same?   You can call (hash) on the keys.  I'm thinking there is 
> perhaps an issue with unicode string serialization...  Are the question 
> marks a particular character?
>
> If you can find the similar strings in memory, before they are written, 
> call:
> (map int  the-string)
> To see the actual unicode characters for the question marks.
>
> On Wednesday, November 25, 2015 at 11:07:34 PM UTC-5, Dave Kincaid wrote:
>>
>> The number of keys in the map is 8,054,160.
>>
>> On Wednesday, November 25, 2015 at 10:04:11 PM UTC-6, Dave Kincaid wrote:
>>>
>>> I have something very strange going on when I try to write a map out to 
>>> a file and read it back in. It's a perfectly fine hash-map with ? 
>>> key/values (so it's pretty big). When I write the map out to a file using
>>>
>>> (spit "/tmp/mednotes6153968756847768349/repl-write.edn" (pr-str phrases
>>> ))
>>>
>>> and then read it back in with
>>>
>>> (edn/read (PushbackReader. (io/reader 
>>> "/tmp/mednotes6153968756847768349/repl-write.edn")))
>>>
>>> I am getting a duplicate key exception indicating that "? 5" is 
>>> duplicated. phrases is a clojure.lang.PersistentHashMap. The keys of the 
>>> map are strings and the values are numbers. When I get the value for "? 5" 
>>> from the map it returns 352.
>>>
>>> I tried to grep the file to find the occurrences of the key "? 5" (and 
>>> the 30 characters before and after it) and it seems to return 4 of them. 
>>> The second one is the right one from the map, but I have no idea where the 
>>> other 3 are coming from.
>>>
>>> [/tmp/mednotes6153968756847768349]> egrep -o ".{30}\"\? 5\" .{30}" 
>>> repl-write.edn 
>>> hasing a toothbrush for" 160, "? 5" 32, ". ) during his /" 32, "to
>>>  "is intact with sutures" 32, "? 5" 352, "4.81 pounds" 128, "ceren
>>> udden" 32, "being up all" 32, "? 5" 32, "limited financial means" 
>>> , "count , everytime she" 32, "? 5" 32, "had a partial mandibulect
>>>
>>> Does anyone have an idea what might be happening when the map is written 
>>> out to the file? How is that key getting duplicated?
>>>
>>> I have tried a few slightly different ways of writing to the file 
>>> including
>>>
>>> (spit "/tmp/mednotes6153968756847768349/repl-write.edn" (binding 
>>> [*print-dup* true] (pr-str phrases)))
>>>
>>> and
>>>
>>> (spit "/tmp/mednotes6153968756847768349/repl-write.edn" (.toString 
>>> phrases))
>>>
>>> based on some StackOverflow answers I found. They all seem to do the 
>>> same thing.
>>>
>>> Here is the exception stack trace.
>>>
>>> 1. Caused by java.lang.IllegalArgumentException
>>>Duplicate key: ? 5
>>>
>>> PersistentHashMap.java:   67 
>>>  clojure.lang.PersistentHashMap/createWithCheck
>>>RT.java: 1538  clojure.lang.RT/map
>>> EdnReader.java:  631 
>>>  clojure.lang.EdnReader$MapReader/invoke
>>> EdnReader.java:  142  clojure.lang.EdnReader/read
>>> EdnReader.java:  108  clojure.lang.EdnReader/read
>>>edn.clj:   35  clojure.edn/read
>>>edn.clj:   33  clojure.edn/read
>>>   AFn.java:  154  clojure.lang.AFn/applyToHelper
>>>   AFn.java:  144  clojure.lang.AFn/applyTo
>>>  Compiler.java: 3623 
>>>  clojure.lang.Compiler$InvokeExpr/eval
>>>  Compiler.java:  439 

Re: Duplicate key exception reading map that was written to a file

2015-11-25 Thread Dave Kincaid
The number of keys in the map is 8,054,160.

On Wednesday, November 25, 2015 at 10:04:11 PM UTC-6, Dave Kincaid wrote:
>
> I have something very strange going on when I try to write a map out to a 
> file and read it back in. It's a perfectly fine hash-map with ? 
> key/values (so it's pretty big). When I write the map out to a file using
>
> (spit "/tmp/mednotes6153968756847768349/repl-write.edn" (pr-str phrases))
>
> and then read it back in with
>
> (edn/read (PushbackReader. (io/reader 
> "/tmp/mednotes6153968756847768349/repl-write.edn")))
>
> I am getting a duplicate key exception indicating that "? 5" is 
> duplicated. phrases is a clojure.lang.PersistentHashMap. The keys of the 
> map are strings and the values are numbers. When I get the value for "? 5" 
> from the map it returns 352.
>
> I tried to grep the file to find the occurrences of the key "? 5" (and the 
> 30 characters before and after it) and it seems to return 4 of them. The 
> second one is the right one from the map, but I have no idea where the 
> other 3 are coming from.
>
> [/tmp/mednotes6153968756847768349]> egrep -o ".{30}\"\? 5\" .{30}" 
> repl-write.edn 
> hasing a toothbrush for" 160, "? 5" 32, ". ) during his /" 32, "to
>  "is intact with sutures" 32, "? 5" 352, "4.81 pounds" 128, "ceren
> udden" 32, "being up all" 32, "? 5" 32, "limited financial means" 
> , "count , everytime she" 32, "? 5" 32, "had a partial mandibulect
>
> Does anyone have an idea what might be happening when the map is written 
> out to the file? How is that key getting duplicated?
>
> I have tried a few slightly different ways of writing to the file including
>
> (spit "/tmp/mednotes6153968756847768349/repl-write.edn" (binding 
> [*print-dup* true] (pr-str phrases)))
>
> and
>
> (spit "/tmp/mednotes6153968756847768349/repl-write.edn" (.toString 
> phrases))
>
> based on some StackOverflow answers I found. They all seem to do the same 
> thing.
>
> Here is the exception stack trace.
>
> 1. Caused by java.lang.IllegalArgumentException
>Duplicate key: ? 5
>
> PersistentHashMap.java:   67 
>  clojure.lang.PersistentHashMap/createWithCheck
>RT.java: 1538  clojure.lang.RT/map
> EdnReader.java:  631 
>  clojure.lang.EdnReader$MapReader/invoke
> EdnReader.java:  142  clojure.lang.EdnReader/read
> EdnReader.java:  108  clojure.lang.EdnReader/read
>edn.clj:   35  clojure.edn/read
>edn.clj:   33  clojure.edn/read
>   AFn.java:  154  clojure.lang.AFn/applyToHelper
>   AFn.java:  144  clojure.lang.AFn/applyTo
>  Compiler.java: 3623  clojure.lang.Compiler$InvokeExpr/eval
>  Compiler.java:  439  clojure.lang.Compiler$DefExpr/eval
>  Compiler.java: 6787  clojure.lang.Compiler/eval
>  Compiler.java: 6745  clojure.lang.Compiler/eval
>   core.clj: 3081  clojure.core/eval
>   main.clj:  240  clojure.main/repl/read-eval-print/fn
>   main.clj:  240  clojure.main/repl/read-eval-print
>   main.clj:  258  clojure.main/repl/fn
>   main.clj:  258  clojure.main/repl
>RestFn.java: 1523  clojure.lang.RestFn/invoke
> interruptible_eval.clj:   58 
>  clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
>   AFn.java:  152  clojure.lang.AFn/applyToHelper
>   AFn.java:  144  clojure.lang.AFn/applyTo
>   core.clj:  630  clojure.core/apply
>   core.clj: 1868  clojure.core/with-bindings*
>RestFn.java:  425  clojure.lang.RestFn/invoke
> interruptible_eval.clj:   56 
>  clojure.tools.nrepl.middleware.interruptible-eval/evaluate
> interruptible_eval.clj:  191 
>  clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
> interruptible_eval.clj:  159 
>  clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
>   AFn.java:   22  clojure.lang.AFn/run
>ThreadPoolExecutor.java: 1142 
>  java.util.concurrent.ThreadPoolExecutor/runWorker
>ThreadPoolExecutor.java:  617 
>  java.util.concurrent.ThreadPoolExecutor$Worker/run
>Thread.java:  745  java.lang.Thread/run
>
>
>
>
>

-- 
You received this message because you are 

Duplicate key exception reading map that was written to a file

2015-11-25 Thread Dave Kincaid
I have something very strange going on when I try to write a map out to a 
file and read it back in. It's a perfectly fine hash-map with ? 
key/values (so it's pretty big). When I write the map out to a file using

(spit "/tmp/mednotes6153968756847768349/repl-write.edn" (pr-str phrases))

and then read it back in with

(edn/read (PushbackReader. (io/reader 
"/tmp/mednotes6153968756847768349/repl-write.edn")))

I am getting a duplicate key exception indicating that "? 5" is duplicated. 
phrases is a clojure.lang.PersistentHashMap. The keys of the map are 
strings and the values are numbers. When I get the value for "? 5" from the 
map it returns 352.

I tried to grep the file to find the occurrences of the key "? 5" (and the 
30 characters before and after it) and it seems to return 4 of them. The 
second one is the right one from the map, but I have no idea where the 
other 3 are coming from.

[/tmp/mednotes6153968756847768349]> egrep -o ".{30}\"\? 5\" .{30}" 
repl-write.edn 
hasing a toothbrush for" 160, "? 5" 32, ". ) during his /" 32, "to
 "is intact with sutures" 32, "? 5" 352, "4.81 pounds" 128, "ceren
udden" 32, "being up all" 32, "? 5" 32, "limited financial means" 
, "count , everytime she" 32, "? 5" 32, "had a partial mandibulect

Does anyone have an idea what might be happening when the map is written 
out to the file? How is that key getting duplicated?

I have tried a few slightly different ways of writing to the file including

(spit "/tmp/mednotes6153968756847768349/repl-write.edn" (binding 
[*print-dup* true] (pr-str phrases)))

and

(spit "/tmp/mednotes6153968756847768349/repl-write.edn" (.toString phrases))

based on some StackOverflow answers I found. They all seem to do the same 
thing.

Here is the exception stack trace.

1. Caused by java.lang.IllegalArgumentException
   Duplicate key: ? 5

PersistentHashMap.java:   67 
 clojure.lang.PersistentHashMap/createWithCheck
   RT.java: 1538  clojure.lang.RT/map
EdnReader.java:  631 
 clojure.lang.EdnReader$MapReader/invoke
EdnReader.java:  142  clojure.lang.EdnReader/read
EdnReader.java:  108  clojure.lang.EdnReader/read
   edn.clj:   35  clojure.edn/read
   edn.clj:   33  clojure.edn/read
  AFn.java:  154  clojure.lang.AFn/applyToHelper
  AFn.java:  144  clojure.lang.AFn/applyTo
 Compiler.java: 3623  clojure.lang.Compiler$InvokeExpr/eval
 Compiler.java:  439  clojure.lang.Compiler$DefExpr/eval
 Compiler.java: 6787  clojure.lang.Compiler/eval
 Compiler.java: 6745  clojure.lang.Compiler/eval
  core.clj: 3081  clojure.core/eval
  main.clj:  240  clojure.main/repl/read-eval-print/fn
  main.clj:  240  clojure.main/repl/read-eval-print
  main.clj:  258  clojure.main/repl/fn
  main.clj:  258  clojure.main/repl
   RestFn.java: 1523  clojure.lang.RestFn/invoke
interruptible_eval.clj:   58 
 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
  AFn.java:  152  clojure.lang.AFn/applyToHelper
  AFn.java:  144  clojure.lang.AFn/applyTo
  core.clj:  630  clojure.core/apply
  core.clj: 1868  clojure.core/with-bindings*
   RestFn.java:  425  clojure.lang.RestFn/invoke
interruptible_eval.clj:   56 
 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj:  191 
 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj:  159 
 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
  AFn.java:   22  clojure.lang.AFn/run
   ThreadPoolExecutor.java: 1142 
 java.util.concurrent.ThreadPoolExecutor/runWorker
   ThreadPoolExecutor.java:  617 
 java.util.concurrent.ThreadPoolExecutor$Worker/run
   Thread.java:  745  java.lang.Thread/run




-- 
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/d/optout.


Re: Creating multi-module projects with dependencies between modules

2014-03-17 Thread Dave Kincaid
Thanks, I'll try to show you what I have pieced together from your example 
and the immutant project. Right now I'm just trying to make it work, so I 
just have a project with 2 modules. There is lambda-common and lambda-etl. 
lambda-etl should depend on lambda-common. When I run something like "lein 
modules deps" or "lein modules javac" I get the following output:

Could not find artifact lambda-common-module:lambda-common-module:jar:_ in 
central (http://repo1.maven.org/maven2/)
Could not find artifact lambda-common-module:lambda-common-module:jar:_ in 
clojars (https://clojars.org/repo/)
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment 
variable.
Error encountered performing task 'deps' with profile(s): 
'inherited,default'
Could not resolve dependencies

Here are the relevant files:

project.clj in root of project:
(def version "0.1.0-SNAPSHOT")

(defproject lambda-clj version
  :description ""
  :packaging "pom"
  :profiles {:dev {:dependencies [[midje/midje _]]}}

  :modules {:inherited
{:source-paths ["src/clj"]
 :java-source-paths ["src/java"]
 :test-paths ["test/clj" "test/java"]
 :dependencies [[org.clojure/clojure _]
[com.taoensso/timbre _]]}

:versions {org.clojure/clojure "1.5.1"
   midje/midje "1.6.3"
   com.taoensso/timbre "3.1.6"
   
   :lambda-clj "0.1.0-SNAPSHOT"
   
   lambda-common-module :lambda-clj}}

  :codox {:sources ["lambda-common/src"
"lambda-etl/src"]})

lambda-common module project.clj:
(def lambda-version "0.1.0-SNAPSHOT")

(defproject lambda-common-module lambda-version
  :description ""
  :parent [lambda-clj _ :relative-path "../pom.xml"]
  :dependencies [[org.apache.thrift/libthrift "0.9.0"]]
  :thrift-source-path "build-support/thrift"
  :thrift-java-path "src/java"
  :thrift-opts "beans,hashcode")

lambda-etl module project.clj:
(def lambda-version "0.1.0-SNAPSHOT")

(defproject lambda-etl-module lambda-version
  :description ""
  :parent [lambda-clj _ :relative-path "../pom.xml"]
  :dependencies [[lambda-common-module _]])

Thanks for taking a look.

On Monday, March 17, 2014 10:11:15 PM UTC-5, Jim Crossley wrote:
>
> Hi Dave,
>
> Inter-module deps should be supported by lein-modules. I have plenty of 
> them in the immutant source tree. The test-resources dir in the 
> lein-modules source has some examples of parent/child/sibling deps, but 
> they're pretty contrived. If you can describe the structure of your 
> projects or point me to them if public, and tell me what you tried that 
> didn't work, I can try to get you going.
>
> Jim
>
>
> On Mon, Mar 17, 2014 at 10:55 PM, Dave Kincaid 
> 
> > wrote:
>
>> I'm trying to create a project with multiple modules where there are some 
>> dependencies between modules. So far I've tried out lein-sub and 
>> lein-modules but neither one seems to handle inter-module dependencies 
>> (either that or I just can't figure out how to do it). What are people 
>> using for projects like this? Any open source examples I could look at?
>>
>> 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=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/d/optout.
>>
>
>

-- 
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/d/optout.


Creating multi-module projects with dependencies between modules

2014-03-17 Thread Dave Kincaid
I'm trying to create a project with multiple modules where there are some 
dependencies between modules. So far I've tried out lein-sub and 
lein-modules but neither one seems to handle inter-module dependencies 
(either that or I just can't figure out how to do it). What are people 
using for projects like this? Any open source examples I could look at?

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/d/optout.


Re: what does "defserverfn" mean?

2013-10-10 Thread Dave Kincaid
Indeed. You will find the defserverfn macro definition in 
backtype.storm.daemon.common.clj.

- Dave

On Thursday, October 10, 2013 2:27:38 AM UTC-5, Chris Ford wrote:
>
> Hi,
>
> Clojure allows the creation of macros, which means that developers can 
> define new things that look like the keywords from other languages.
>
> For example, even defn is just a macro that builds on top of the 
> underlying def and fn forms.
>
> I expect that the Twitter storm team have a macro called defserverfn 
> defined somewhere in their codebase - don't expect to find it in Clojure 
> documentation or books because it's not part of the core language.
>
> Cheers,
>
> Chris
>
>
> On 10 October 2013 09:36, Waldstein Wang 
> > wrote:
>
>> Hi all,
>> I am a newbie of Clojure and I am reading the source code of Twitter 
>> Storm, which has its major functions implemented by Clojure. I find 
>> following code:
>> (defserverfn service-handler [conf inimbus]
>>   (.prepare inimbus conf (master-inimbus-dir conf))
>>   (log-message "Starting Nimbus with conf " conf)
>>
>> But I did not find any related information of defserverfn in books or 
>> documents.
>> Can anybody tell me why no books mention this keyword?
>> Thx.
>>
>> -- 
>> -- 
>> 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=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_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: Help deciphering ArityException message

2013-06-30 Thread Dave Kincaid
Thanks, Stefan. That sounds like good advice.

Dave

On Sunday, June 30, 2013 5:09:23 AM UTC-5, Stefan Kamphausen wrote:
>
> Just a little hint which may help you in the future.
>
> First, note the trailing $fn in reformat-headers$fn which tells you, that 
> your problem is with an anonymous function.
>
> Second, you know that there is a second form for anonymous functions which 
> uses fn instead of the reader macro.
>
> Third, fn can take a name for the anonymous function.  That way you get a 
> better pointer in your exception, where the problem originated.
>
>
> Recently, I find myself using the reader macros less, only for functions 
> which are basically just one form which are totally self-explanatory.  The 
> usage of fn has two advantages: it can be nested and the parameters help 
> documenting the expected input.  Using fn with a name yields better 
> exceptions plus serves a documentation purpose by naming what should happen.
>
> Just my ct.
>
>
> Kind regards,
> Stefan
>
>
>

-- 
-- 
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: UnreadableForm exception trying to read an EDN file

2013-06-29 Thread Dave Kincaid
That works perfectly! Thank you again very much.

On Saturday, June 29, 2013 9:01:32 PM UTC-5, Baishampayan Ghose wrote:
>
> By the way, there is also the print-method multimethod which might 
> just do the trick for you. Just try this one with your original 
> version of `spit-messages` - 
> http://clojuredocs.org/clojure_core/clojure.core/print-method ~BG 
>
> On Sun, Jun 30, 2013 at 7:18 AM, Dave Kincaid 
> > 
> wrote: 
> > Hmm. No, it doesn't. This is what I get with pprint by itself: 
> > 
> > :headers {"pluginKey" #} 
> > 
> > with your version I get: 
> > 
> > :headers 
> >#=(java.util.HashMap. {"pluginKey" 
> > #=(com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString. 
> > "PLUGIN2")}) 
> > 
> > what I think I needs to be able to read it back in is: 
> > 
> > :headers {"pluginKey" "PLUGIN2"} 
> > 
> > On Saturday, June 29, 2013 8:41:16 PM UTC-5, Baishampayan Ghose wrote: 
> >> 
> >> Does this work? 
> >> 
> >> ;; do the defmethod extension as usual and then define spit-messages as 
> >> such 
> >> (defn spit-messages 
> >>   "Write out the messages in the given seq." 
> >>   [messages dest] 
> >>   (binding [*print-dup* true] 
> >> (pprint 
> >>  (for [[metadata ^bytes payload] messages] 
> >>{:header metadata :payload (String. payload)}) 
> >>  dest))) 
> >> 
> >> ~BG 
> >> 
> >> On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid  
> wrote: 
> >> > Thanks! If that works, it is perfect. However, my first attempt isn't 
> >> > making 
> >> > any difference. Here is what I have: 
> >> > 
> >> > (defmethod print-dup 
> >> > com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] 
> >> >   (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) 
> >> > 
> >> > (defn spit-messages 
> >> >   "Write out the messages in the given seq." 
> >> >   [messages dest] 
> >> >   (print-dup 
> >> >(for [[metadata ^bytes payload] messages] 
> >> >  {:header metadata :payload (String. payload)}) 
> >> >dest)) 
> >> > 
> >> > but it still prints it out to the file with # >> > PLUGIN2>. 
> >> > Did I miss something? 
> >> > 
> >> > On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose 
> wrote: 
> >> >> 
> >> >> Adding a method to the `print-dup` multimethod that dispatches on 
> >> >> ByteArrayLongString should help. See here for an example - 
> >> >> http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG 
> >> >> 
> >> >> On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid  
> >> >> wrote: 
> >> >> > I'm using pprint to write out a map to a file then trying to read 
> it 
> >> >> > back in 
> >> >> > using clojure.edn/read (I also get the same error using read). 
> Here 
> >> >> > is 
> >> >> > the 
> >> >> > output (it's a map that was created by the Langohr rabbitmq 
> library): 
> >> >> > 
> >> >> > {:header 
> >> >> >   {:timestamp #inst "2058-04-07T17:56:17.000-00:00", 
> >> >> >:delivery-tag 2, 
> >> >> >:expiration nil, 
> >> >> >:correlation-id nil, 
> >> >> >:delivery-mode 1, 
> >> >> >:app-id nil, 
> >> >> >:user-id nil, 
> >> >> >:redelivery? true, 
> >> >> >:header {:headers ()}, 
> >> >> >:content-type nil, 
> >> >> >:persistent? false, 
> >> >> >:reply-to nil, 
> >> >> >:routing-key "pims_data_capture", 
> >> >> >:headers {"pluginKey" #}, 
> >> >> >:type nil, 
> >> >> >:message-id nil, 
> >> >> >:cluster-id nil, 
> >> >> >:message-count 3, 
> >> >> >:exchange "", 
> >> >> >:content-encoding nil, 
> >> >> >:priority nil}, 
> >> >> >   :payload 
> >> >> >   "{\"software\":\"CSTONE\",\"

Re: UnreadableForm exception trying to read an EDN file

2013-06-29 Thread Dave Kincaid
Thank you very much for the help. I really appreciate you trying. I don't 
know what is going on, but I need to move on from this.

Dave

On Saturday, June 29, 2013 8:57:31 PM UTC-5, Baishampayan Ghose wrote:
>
> This form, by the way is readable. Not sure why the print-dup 
> extension is not working though... ~BG 
>
> On Sun, Jun 30, 2013 at 7:18 AM, Dave Kincaid 
> > 
> wrote: 
> > Hmm. No, it doesn't. This is what I get with pprint by itself: 
> > 
> > :headers {"pluginKey" #} 
> > 
> > with your version I get: 
> > 
> > :headers 
> >#=(java.util.HashMap. {"pluginKey" 
> > #=(com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString. 
> > "PLUGIN2")}) 
> > 
> > what I think I needs to be able to read it back in is: 
> > 
> > :headers {"pluginKey" "PLUGIN2"} 
> > 
> > On Saturday, June 29, 2013 8:41:16 PM UTC-5, Baishampayan Ghose wrote: 
> >> 
> >> Does this work? 
> >> 
> >> ;; do the defmethod extension as usual and then define spit-messages as 
> >> such 
> >> (defn spit-messages 
> >>   "Write out the messages in the given seq." 
> >>   [messages dest] 
> >>   (binding [*print-dup* true] 
> >> (pprint 
> >>  (for [[metadata ^bytes payload] messages] 
> >>{:header metadata :payload (String. payload)}) 
> >>  dest))) 
> >> 
> >> ~BG 
> >> 
> >> On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid  
> wrote: 
> >> > Thanks! If that works, it is perfect. However, my first attempt isn't 
> >> > making 
> >> > any difference. Here is what I have: 
> >> > 
> >> > (defmethod print-dup 
> >> > com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] 
> >> >   (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) 
> >> > 
> >> > (defn spit-messages 
> >> >   "Write out the messages in the given seq." 
> >> >   [messages dest] 
> >> >   (print-dup 
> >> >(for [[metadata ^bytes payload] messages] 
> >> >  {:header metadata :payload (String. payload)}) 
> >> >dest)) 
> >> > 
> >> > but it still prints it out to the file with # >> > PLUGIN2>. 
> >> > Did I miss something? 
> >> > 
> >> > On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose 
> wrote: 
> >> >> 
> >> >> Adding a method to the `print-dup` multimethod that dispatches on 
> >> >> ByteArrayLongString should help. See here for an example - 
> >> >> http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG 
> >> >> 
> >> >> On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid  
> >> >> wrote: 
> >> >> > I'm using pprint to write out a map to a file then trying to read 
> it 
> >> >> > back in 
> >> >> > using clojure.edn/read (I also get the same error using read). 
> Here 
> >> >> > is 
> >> >> > the 
> >> >> > output (it's a map that was created by the Langohr rabbitmq 
> library): 
> >> >> > 
> >> >> > {:header 
> >> >> >   {:timestamp #inst "2058-04-07T17:56:17.000-00:00", 
> >> >> >:delivery-tag 2, 
> >> >> >:expiration nil, 
> >> >> >:correlation-id nil, 
> >> >> >:delivery-mode 1, 
> >> >> >:app-id nil, 
> >> >> >:user-id nil, 
> >> >> >:redelivery? true, 
> >> >> >:header {:headers ()}, 
> >> >> >:content-type nil, 
> >> >> >:persistent? false, 
> >> >> >:reply-to nil, 
> >> >> >:routing-key "pims_data_capture", 
> >> >> >:headers {"pluginKey" #}, 
> >> >> >:type nil, 
> >> >> >:message-id nil, 
> >> >> >:cluster-id nil, 
> >> >> >:message-count 3, 
> >> >> >:exchange "", 
> >> >> >:content-encoding nil, 
> >> >> >:priority nil}, 
> >> >> >   :payload 
> >> >> >   "{\"software\":\"CSTONE\",\"e

Re: UnreadableForm exception trying to read an EDN file

2013-06-29 Thread Dave Kincaid
Readable by clojure.edn/read? I get this exception from it:

RuntimeException No dispatch macro for: = 
 clojure.lang.Util.runtimeException (Util.java:219)

I think I'm going to give up on this and serialize it to JSON. Should be 
easier.

On Saturday, June 29, 2013 8:57:31 PM UTC-5, Baishampayan Ghose wrote:
>
> This form, by the way is readable. Not sure why the print-dup 
> extension is not working though... ~BG 
>
> On Sun, Jun 30, 2013 at 7:18 AM, Dave Kincaid 
> > 
> wrote: 
> > Hmm. No, it doesn't. This is what I get with pprint by itself: 
> > 
> > :headers {"pluginKey" #} 
> > 
> > with your version I get: 
> > 
> > :headers 
> >#=(java.util.HashMap. {"pluginKey" 
> > #=(com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString. 
> > "PLUGIN2")}) 
> > 
> > what I think I needs to be able to read it back in is: 
> > 
> > :headers {"pluginKey" "PLUGIN2"} 
> > 
> > On Saturday, June 29, 2013 8:41:16 PM UTC-5, Baishampayan Ghose wrote: 
> >> 
> >> Does this work? 
> >> 
> >> ;; do the defmethod extension as usual and then define spit-messages as 
> >> such 
> >> (defn spit-messages 
> >>   "Write out the messages in the given seq." 
> >>   [messages dest] 
> >>   (binding [*print-dup* true] 
> >> (pprint 
> >>  (for [[metadata ^bytes payload] messages] 
> >>{:header metadata :payload (String. payload)}) 
> >>  dest))) 
> >> 
> >> ~BG 
> >> 
> >> On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid  
> wrote: 
> >> > Thanks! If that works, it is perfect. However, my first attempt isn't 
> >> > making 
> >> > any difference. Here is what I have: 
> >> > 
> >> > (defmethod print-dup 
> >> > com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] 
> >> >   (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) 
> >> > 
> >> > (defn spit-messages 
> >> >   "Write out the messages in the given seq." 
> >> >   [messages dest] 
> >> >   (print-dup 
> >> >(for [[metadata ^bytes payload] messages] 
> >> >  {:header metadata :payload (String. payload)}) 
> >> >dest)) 
> >> > 
> >> > but it still prints it out to the file with # >> > PLUGIN2>. 
> >> > Did I miss something? 
> >> > 
> >> > On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose 
> wrote: 
> >> >> 
> >> >> Adding a method to the `print-dup` multimethod that dispatches on 
> >> >> ByteArrayLongString should help. See here for an example - 
> >> >> http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG 
> >> >> 
> >> >> On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid  
> >> >> wrote: 
> >> >> > I'm using pprint to write out a map to a file then trying to read 
> it 
> >> >> > back in 
> >> >> > using clojure.edn/read (I also get the same error using read). 
> Here 
> >> >> > is 
> >> >> > the 
> >> >> > output (it's a map that was created by the Langohr rabbitmq 
> library): 
> >> >> > 
> >> >> > {:header 
> >> >> >   {:timestamp #inst "2058-04-07T17:56:17.000-00:00", 
> >> >> >:delivery-tag 2, 
> >> >> >:expiration nil, 
> >> >> >:correlation-id nil, 
> >> >> >:delivery-mode 1, 
> >> >> >:app-id nil, 
> >> >> >:user-id nil, 
> >> >> >:redelivery? true, 
> >> >> >:header {:headers ()}, 
> >> >> >:content-type nil, 
> >> >> >:persistent? false, 
> >> >> >:reply-to nil, 
> >> >> >:routing-key "pims_data_capture", 
> >> >> >:headers {"pluginKey" #}, 
> >> >> >:type nil, 
> >> >> >:message-id nil, 
> >> >> >:cluster-id nil, 
> >> >> >:message-count 3, 
> >> >> >:exchange "", 
> >> >> >:content-encoding nil, 
> >> >> >:priority nil}, 
> >> >> >   :payload 
> >> >> >   "{\"software\&

Re: UnreadableForm exception trying to read an EDN file

2013-06-29 Thread Dave Kincaid
Hmm. No, it doesn't. This is what I get with pprint by itself:

:headers {"pluginKey" #}

with your version I get:

:headers
   #=(java.util.HashMap. {"pluginKey" 
#=(com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString. 
"PLUGIN2")})

what I think I needs to be able to read it back in is:

:headers {"pluginKey" "PLUGIN2"}

On Saturday, June 29, 2013 8:41:16 PM UTC-5, Baishampayan Ghose wrote:
>
> Does this work? 
>
> ;; do the defmethod extension as usual and then define spit-messages as 
> such 
> (defn spit-messages 
>   "Write out the messages in the given seq." 
>   [messages dest] 
>   (binding [*print-dup* true] 
> (pprint 
>  (for [[metadata ^bytes payload] messages] 
>{:header metadata :payload (String. payload)}) 
>  dest))) 
>
> ~BG 
>
> On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid 
> > 
> wrote: 
> > Thanks! If that works, it is perfect. However, my first attempt isn't 
> making 
> > any difference. Here is what I have: 
> > 
> > (defmethod print-dup 
> > com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] 
> >   (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) 
> > 
> > (defn spit-messages 
> >   "Write out the messages in the given seq." 
> >   [messages dest] 
> >   (print-dup 
> >(for [[metadata ^bytes payload] messages] 
> >  {:header metadata :payload (String. payload)}) 
> >dest)) 
> > 
> > but it still prints it out to the file with # PLUGIN2>. 
> > Did I miss something? 
> > 
> > On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose wrote: 
> >> 
> >> Adding a method to the `print-dup` multimethod that dispatches on 
> >> ByteArrayLongString should help. See here for an example - 
> >> http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG 
> >> 
> >> On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid  
> wrote: 
> >> > I'm using pprint to write out a map to a file then trying to read it 
> >> > back in 
> >> > using clojure.edn/read (I also get the same error using read). Here 
> is 
> >> > the 
> >> > output (it's a map that was created by the Langohr rabbitmq library): 
> >> > 
> >> > {:header 
> >> >   {:timestamp #inst "2058-04-07T17:56:17.000-00:00", 
> >> >:delivery-tag 2, 
> >> >:expiration nil, 
> >> >:correlation-id nil, 
> >> >:delivery-mode 1, 
> >> >:app-id nil, 
> >> >:user-id nil, 
> >> >:redelivery? true, 
> >> >:header {:headers ()}, 
> >> >:content-type nil, 
> >> >:persistent? false, 
> >> >:reply-to nil, 
> >> >:routing-key "pims_data_capture", 
> >> >:headers {"pluginKey" #}, 
> >> >:type nil, 
> >> >:message-id nil, 
> >> >:cluster-id nil, 
> >> >:message-count 3, 
> >> >:exchange "", 
> >> >:content-encoding nil, 
> >> >:priority nil}, 
> >> >   :payload 
> >> >   "{\"software\":\"CSTONE\",\"entity\":\"\","} 
> >> > 
> >> > when I try to read it in I get an UnreadableForm exception. I've 
> >> > narrowed it 
> >> > down to the # element. If I manually 
> change 
> >> > that to just a regular string I can read it. What is the idiomatic 
> way 
> >> > to 
> >> > handle this noting that there could be a number of different values 
> in 
> >> > that 
> >> > :headers map. 
> >> > 
> >> > -- 
> >> > -- 
> >> > 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=en 
> >> > --- 
> >> > You received this message because you are subscribed to the Google 
> >> > Groups 
> &g

Re: Help deciphering ArityException message

2013-06-29 Thread Dave Kincaid
Yes! That does help. It's complaining about the arity of the function in 
the map, not the reformat-headers function. Now I understand. Thank you 
very much for helping clarify it for me.

Dave

On Saturday, June 29, 2013 8:30:21 PM UTC-5, Baishampayan Ghose wrote:
>
> What is the shape of `headers`? It looks like headers is a sequence of 
> two-element sequences, in which case `reformat-headers` should be 
> something like this - 
>
> (defn reformat-headers 
> [headers] 
> (map (fn [[x y]] (hash-map [x 0] (.toString [y 1]))) headers)) 
> ;; note the destructuring. 
>
> The problem is, the lambda inside the map is expecting two args but is 
> getting one arg (which is a two element sequence) instead. 
>
> Hope that helps. 
>
> ~BG 
>
>
>
> On Sun, Jun 30, 2013 at 6:49 AM, Dave Kincaid 
> > 
> wrote: 
> > Here is the whole thing: 
> > 
> > (defn reformat-headers 
> >   [headers] 
> >   (debug (str "Reformatting " headers)) 
> >   (map #(hash-map [%1 0] (.toString [%2 1])) headers)) 
> > 
> > (defn spit-messages 
> >   "Write out the messages in the given seq." 
> >   [messages dest] 
> >   (pprint 
> >(for [[metadata ^bytes payload] messages] 
> >  {:header (update-in metadata [:headers] reformat-headers) :payload 
> > (String. payload)}) 
> >dest)) 
> > 
> > 
> > On Saturday, June 29, 2013 8:12:26 PM UTC-5, Baishampayan Ghose wrote: 
> >> 
> >> This should work. What does headers look like? Sometimes the #(...) 
> >> reader form can cause problems. Does using the (fn ...) form help? ~BG 
> >> 
> >> On Sun, Jun 30, 2013 at 5:39 AM, Dave Kincaid  
> wrote: 
> >> > Could someone help me decipher the ArityException I'm getting. It's 
> not 
> >> > making sense to me. First here is the exception: 
> >> > 
> >> > ArityException Wrong number of args (1) passed to: 
> >> > lastN$reformat-headers$fn 
> >> > clojure.lang.AFn.throwArity (AFn.java:437) 
> >> > 
> >> > and here is the function reformat-headers: 
> >> > 
> >> > (defn reformat-headers 
> >> >   [headers] 
> >> >   (map #(.toString %) headers)) 
> >> > 
> >> > as far as I can tell the exception is saying that 1 argument is the 
> >> > wrong 
> >> > number of arguments for reformat-headers, but as you can clearly see 
> it 
> >> > is a 
> >> > function of one argument. What am I interpreting wrong? 
> >> > 
> >> > 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=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_out. 
> >> > 
> >> > 
> >> 
> >> 
> >> 
> >> -- 
> >> Baishampayan Ghose 
> >> b.ghose at gmail.com 
> > 
> > -- 
> > -- 
> > 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=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_out. 
> > 
> > 
>
>
>
> -- 
> Baishampayan Ghose 
> b.ghose at gmail.com 
>

-- 
-- 
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: UnreadableForm exception trying to read an EDN file

2013-06-29 Thread Dave Kincaid
Thanks! If that works, it is perfect. However, my first attempt isn't 
making any difference. Here is what I have:

(defmethod print-dup 
com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w]
  (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w))

(defn spit-messages
  "Write out the messages in the given seq."
  [messages dest]
  (print-dup
   (for [[metadata ^bytes payload] messages]
 {:header metadata :payload (String. payload)})
   dest))

but it still prints it out to the file with #. 
Did I miss something?

On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose wrote:
>
> Adding a method to the `print-dup` multimethod that dispatches on 
> ByteArrayLongString should help. See here for an example - 
> http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG 
>
> On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid 
> > 
> wrote: 
> > I'm using pprint to write out a map to a file then trying to read it 
> back in 
> > using clojure.edn/read (I also get the same error using read). Here is 
> the 
> > output (it's a map that was created by the Langohr rabbitmq library): 
> > 
> > {:header 
> >   {:timestamp #inst "2058-04-07T17:56:17.000-00:00", 
> >:delivery-tag 2, 
> >:expiration nil, 
> >:correlation-id nil, 
> >:delivery-mode 1, 
> >:app-id nil, 
> >:user-id nil, 
> >:redelivery? true, 
> >:header {:headers ()}, 
> >:content-type nil, 
> >:persistent? false, 
> >:reply-to nil, 
> >:routing-key "pims_data_capture", 
> >:headers {"pluginKey" #}, 
> >:type nil, 
> >:message-id nil, 
> >:cluster-id nil, 
> >:message-count 3, 
> >:exchange "", 
> >:content-encoding nil, 
> >:priority nil}, 
> >   :payload 
> >   "{\"software\":\"CSTONE\",\"entity\":\"\","} 
> > 
> > when I try to read it in I get an UnreadableForm exception. I've 
> narrowed it 
> > down to the # element. If I manually change 
> > that to just a regular string I can read it. What is the idiomatic way 
> to 
> > handle this noting that there could be a number of different values in 
> that 
> > :headers map. 
> > 
> > -- 
> > -- 
> > 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=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_out. 
> > 
> > 
>
>
>
> -- 
> Baishampayan Ghose 
> b.ghose at gmail.com 
>

-- 
-- 
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: Help deciphering ArityException message

2013-06-29 Thread Dave Kincaid
Here is the whole thing:

(defn reformat-headers
  [headers]
  (debug (str "Reformatting " headers))
  (map #(hash-map [%1 0] (.toString [%2 1])) headers))

(defn spit-messages
  "Write out the messages in the given seq."
  [messages dest]
  (pprint 
   (for [[metadata ^bytes payload] messages]
 {:header (update-in metadata [:headers] *reformat-headers*) :payload 
(String. payload)})
   dest))


On Saturday, June 29, 2013 8:12:26 PM UTC-5, Baishampayan Ghose wrote:
>
> This should work. What does headers look like? Sometimes the #(...) 
> reader form can cause problems. Does using the (fn ...) form help? ~BG 
>
> On Sun, Jun 30, 2013 at 5:39 AM, Dave Kincaid 
> > 
> wrote: 
> > Could someone help me decipher the ArityException I'm getting. It's not 
> > making sense to me. First here is the exception: 
> > 
> > ArityException Wrong number of args (1) passed to: 
> lastN$reformat-headers$fn 
> > clojure.lang.AFn.throwArity (AFn.java:437) 
> > 
> > and here is the function reformat-headers: 
> > 
> > (defn reformat-headers 
> >   [headers] 
> >   (map #(.toString %) headers)) 
> > 
> > as far as I can tell the exception is saying that 1 argument is the 
> wrong 
> > number of arguments for reformat-headers, but as you can clearly see it 
> is a 
> > function of one argument. What am I interpreting wrong? 
> > 
> > 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=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_out. 
> > 
> > 
>
>
>
> -- 
> Baishampayan Ghose 
> b.ghose at gmail.com 
>

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




UnreadableForm exception trying to read an EDN file

2013-06-29 Thread Dave Kincaid
I'm using pprint to write out a map to a file then trying to read it back 
in using clojure.edn/read (I also get the same error using read). Here is 
the output (it's a map that was created by the Langohr rabbitmq library):

{:header
  {:timestamp #inst "2058-04-07T17:56:17.000-00:00",
   :delivery-tag 2,
   :expiration nil,
   :correlation-id nil,
   :delivery-mode 1,
   :app-id nil,
   :user-id nil,
   :redelivery? true,
   :header {:headers ()},
   :content-type nil,
   :persistent? false,
   :reply-to nil,
   :routing-key "pims_data_capture",
   :headers {"pluginKey" #},
   :type nil,
   :message-id nil,
   :cluster-id nil,
   :message-count 3,
   :exchange "",
   :content-encoding nil,
   :priority nil},
  :payload
  "{\"software\":\"CSTONE\",\"entity\":\"\","}

when I try to read it in I get an UnreadableForm exception. I've narrowed 
it down to the # element. If I manually change 
that to just a regular string I can read it. What is the idiomatic way to 
handle this noting that there could be a number of different values in that 
:headers map.

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




Help deciphering ArityException message

2013-06-29 Thread Dave Kincaid
Could someone help me decipher the ArityException I'm getting. It's not 
making sense to me. First here is the exception:

ArityException Wrong number of args (1) passed to: 
lastN$reformat-headers$fn  clojure.lang.AFn.throwArity (AFn.java:437)

and here is the function reformat-headers:

(defn reformat-headers
  [headers]
  (map #(.toString %) headers))

as far as I can tell the exception is saying that 1 argument is the wrong 
number of arguments for reformat-headers, but as you can clearly see it is 
a function of one argument. What am I interpreting wrong?

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.




Re: [ANN] lein-pedantic is now deprecated

2013-05-29 Thread Dave Kincaid
I am definitely interested in that. I've been using lein-pedantic all the 
time. It's helped immensely.

On Wednesday, May 29, 2013 8:25:22 PM UTC-5, Nelson Morris wrote:
>
> Good news everybody! As of leiningen 2.2.0 using `lein deps :tree` will 
> perform version checks and version range detection. Therefore, I have 
> deprecated lein-pedantic.  I appreciate all of the users of the plugin that 
> found it useful.
>
> I believe there are two pieces of functionality that do not currently have 
> a replacement:
> 1) ability to fail the task when a "bad" dependency resolution happens
> 2) exact instructions of what to place in project.clj to make things work
>
> If you are interested in these, please let me know here, and I'll see 
> about adding them in a future leiningen release.
>
> -
> Nelson Morris
>

-- 
-- 
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: Strange exception intializing clojure.core using Spring-Hadoop

2013-05-17 Thread Dave Kincaid
A quick update on a little more progress troubleshooting this issue. We 
have gotten to the point where we are seeing this stacktrace:

java.lang.IllegalStateException: Attempting to call unbound fn: 
#'clojure.core/refer
at clojure.lang.Var$Unbound.throwArity(Var.java:43)
at clojure.lang.AFn.invoke(AFn.java:39)
at clojure.lang.Var.invoke(Var.java:415)
at clojure.lang.RT.doInit(RT.java:460)
at clojure.lang.RT.(RT.java:329)

does that give anyone an idea?

On Thursday, May 16, 2013 7:53:27 PM UTC-5, Dave Kincaid wrote:
>
> I'm posting this here in hopes that someone might be able to steer us in 
> the right direction. We have a Cascalog process that we're using 
> Spring-Hadoop & Spring-Batch to send to a remote Hadoop cluster. It seems 
> as though Spring-Hadoop is doing something funky with the 
> classpath/classloader and we're getting the following exception when we run 
> it:
>
> java.lang.ExceptionInInitializerError
> at clojure.core__init.__init0(Unknown Source)
> at clojure.core__init.(Unknown Source)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:266)
> at clojure.lang.RT.loadClassForName(RT.java:2098)
> at clojure.lang.RT.load(RT.java:430)
> at clojure.lang.RT.load(RT.java:411)
> at clojure.lang.RT.doInit(RT.java:447)
> at clojure.lang.RT.(RT.java:329)
> at cascalog.Util.(Util.java:29)
> at jcascalog.Api.setApplicationConf(Api.java:99)
> at com.test.DataShredder.run(DataShredder.java:113)
>
> in trying to trace it we think that this is happening while 
> clojure.lang.RT is scanning all the classes on the classpath. It seems to 
> get to one class called StepExecution.class, which is part of the Spring 
> Framework, and it throws this exception. We've got this posted over on the 
> Spring forums too, since it's most likely something with Spring's 
> manipulation of classpath and/or classloader while it's trying to get the 
> MR jobs over to Hadoop.
>
> If anyone has another idea, we'd love to hear it. We're kind of stuck 
> right now and been working on it for a few days.
>
> 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.




Strange exception intializing clojure.core using Spring-Hadoop

2013-05-16 Thread Dave Kincaid
I'm posting this here in hopes that someone might be able to steer us in 
the right direction. We have a Cascalog process that we're using 
Spring-Hadoop & Spring-Batch to send to a remote Hadoop cluster. It seems 
as though Spring-Hadoop is doing something funky with the 
classpath/classloader and we're getting the following exception when we run 
it:

java.lang.ExceptionInInitializerError
at clojure.core__init.__init0(Unknown Source)
at clojure.core__init.(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at clojure.lang.RT.loadClassForName(RT.java:2098)
at clojure.lang.RT.load(RT.java:430)
at clojure.lang.RT.load(RT.java:411)
at clojure.lang.RT.doInit(RT.java:447)
at clojure.lang.RT.(RT.java:329)
at cascalog.Util.(Util.java:29)
at jcascalog.Api.setApplicationConf(Api.java:99)
at com.test.DataShredder.run(DataShredder.java:113)

in trying to trace it we think that this is happening while clojure.lang.RT 
is scanning all the classes on the classpath. It seems to get to one class 
called StepExecution.class, which is part of the Spring Framework, and it 
throws this exception. We've got this posted over on the Spring forums too, 
since it's most likely something with Spring's manipulation of classpath 
and/or classloader while it's trying to get the MR jobs over to Hadoop.

If anyone has another idea, we'd love to hear it. We're kind of stuck right 
now and been working on it for a few days.

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.




Re: Utility libraries and dependency hygiene

2013-05-15 Thread Dave Kincaid
One that I encountered last week was Midje. In trying to work through all 
of its dependencies I discovered that Pomegranate is also dependent on 
Maven, but I think I was able to work around that by adding 4 or 5 Maven 
libraries into our repository as dependencies (not ideal, but it looked 
like it would work). But I still wasn't able to get Midje working due some 
assumptions about Leiningen.

On Wednesday, May 15, 2013 8:13:19 AM UTC-5, Laurent PETIT wrote:
>
> 2013/5/15 Dave Kincaid >: 
> > As long as we remember that not everyone is using Leiningen and/or 
> Maven. 
> > There are other build and dependency systems out there, so any change to 
> > dependency management tooling will have to cover all of them. 
> > 
> > There are already popular libraries that don't work outside of 
> Leiningen, 
> > but that's a topic for another thread... 
>
> Hello, 
>
> What are the popular Clojure (not ClojureScript) libraries that don't 
> work outside a maven-style-backed-central-public-repository? 
>
> > 
> > 
> > On Wednesday, May 15, 2013 3:17:59 AM UTC-5, Glen Mailer wrote: 
> >> 
> >> At the risk of making a slight strawman here, I agree this issue has 
> the 
> >> potential to drag on Clojure adoption - but in the opposite way to what 
> you 
> >> describe. 
> >> 
> >> At the root of it, is the Clojure ecosystem a "dependencies are bad" 
> >> system, or a "dependencies are good" system? 
> >> 
> >> The former encourages roll-your-own, but reduces code sharing and 
> re-use 
> >> The latter promotes sharing and building upon the work of others, but 
> >> requires more advanced dependency management tooling 
> >> 
> >> As great as the language is, having the general advice be "don't have 
> >> dependencies in your libraries" seems like a step backwards to me. 
> >> 
> >> I would always rather spend an hour finding a documented, tested 
> existing 
> >> library, than spend 20 minutes creating my own duplicate of that work. 
> >> 
> >> I hope this doesn't come over as too accusatory, if the cost of 
> >> dependencies truly is higher than the cost of duplicating work/code 
> then 
> >> perhaps we need to try and make the former easier. 
> >> 
> >> Glen 
> >> 
>
>

-- 
-- 
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: Utility libraries and dependency hygiene

2013-05-15 Thread Dave Kincaid
As long as we remember that not everyone is using Leiningen and/or Maven. 
There are other build and dependency systems out there, so any change to 
dependency management tooling will have to cover all of them. 

There are already popular libraries that don't work outside of Leiningen, 
but that's a topic for another thread...

On Wednesday, May 15, 2013 3:17:59 AM UTC-5, Glen Mailer wrote:
>
> At the risk of making a slight strawman here, I agree this issue has the 
> potential to drag on Clojure adoption - but in the opposite way to what you 
> describe.
>
> At the root of it, is the Clojure ecosystem a "dependencies are bad" 
> system, or a "dependencies are good" system?
>
> The former encourages roll-your-own, but reduces code sharing and re-use
> The latter promotes sharing and building upon the work of others, but 
> requires more advanced dependency management tooling
>
> As great as the language is, having the general advice be "don't have 
> dependencies in your libraries" seems like a step backwards to me.
>
> I would always rather spend an hour finding a documented, tested existing 
> library, than spend 20 minutes creating my own duplicate of that work.
>
> I hope this doesn't come over as too accusatory, if the cost of 
> dependencies truly is higher than the cost of duplicating work/code then 
> perhaps we need to try and make the former easier.
>
> Glen
>
> On Tuesday, 14 May 2013 13:19:15 UTC+1, Dave Kincaid wrote:
>>
>> This thread seems to have gotten way off track and I think that Stuart 
>> made a very important point in the original post that's getting lost. It 
>> would help all of us out if library authors stopped making their libraries 
>> dependent on 10+ other libraries. This issue does have the potential to 
>> really drag on Clojure adoption. Just try to maintain your own local 
>> repository for your projects and you'll see what I mean the first time you 
>> need to add a Clojure dependency.
>>
>> On Tuesday, May 14, 2013 4:22:59 AM UTC-5, Phillip Lord wrote:
>>>
>>> Stuart Sierra  writes: 
>>> > On Tue, May 14, 2013 at 3:25 AM, Phil Hagelberg  
>>> wrote: 
>>> > 
>>> >> It's really not difficult to do if you limit yourself to Clojure 
>>> since 
>>> >> Clojure namespaces are first-class and easy to manipulate at 
>>> >> run-time. We implemneted a prototype of this in under two hours at a 
>>> >> Seajure meeting a while back: 
>>> >> 
>>> >> https://github.com/technomancy/metaverse 
>>> >> 
>>> >> However, it's significantly more difficult to do for arbitrary Java 
>>> >> bytecode. 
>>> >> 
>>> > 
>>> > 
>>> > That's cool, and it will work for the simple case of libraries A and B 
>>> > depending on different versions of C. 
>>> > 
>>> > But it still breaks down in more complex cases: e.g. if I want to 
>>> share 
>>> > data between A and B using a protocol or type defined in C, and there 
>>> are 2 
>>> > incompatible versions of C. Even ClassLoaders can't help you there - 
>>> I'm 
>>> > not aware of any solution. 
>>>
>>>
>>> Automatically, no, but the solution would be to use something akin to an 
>>> adaptor. The two versions of C would be manipulated to be in different 
>>> namespaces; now you just have two libraries, so the task of plumbing 
>>> them together remains the same. 
>>>
>>> To be honest, though, this is unlikely; after all, if you are using A 
>>> and B, and they are using C *as a utility*, my feeling is that C 
>>> shouldn't really be in their public interface. If C *is* in their public 
>>> interface, then again, you need adaptors. 
>>>
>>> Or you can fork A and/or B, fix them to use the same version! 
>>>
>>> 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: Utility libraries and dependency hygiene

2013-05-14 Thread Dave Kincaid
This thread seems to have gotten way off track and I think that Stuart made 
a very important point in the original post that's getting lost. It would 
help all of us out if library authors stopped making their libraries 
dependent on 10+ other libraries. This issue does have the potential to 
really drag on Clojure adoption. Just try to maintain your own local 
repository for your projects and you'll see what I mean the first time you 
need to add a Clojure dependency.

On Tuesday, May 14, 2013 4:22:59 AM UTC-5, Phillip Lord wrote:
>
> Stuart Sierra > writes: 
> > On Tue, May 14, 2013 at 3:25 AM, Phil Hagelberg 
> > > 
> wrote: 
> > 
> >> It's really not difficult to do if you limit yourself to Clojure since 
> >> Clojure namespaces are first-class and easy to manipulate at 
> >> run-time. We implemneted a prototype of this in under two hours at a 
> >> Seajure meeting a while back: 
> >> 
> >> https://github.com/technomancy/metaverse 
> >> 
> >> However, it's significantly more difficult to do for arbitrary Java 
> >> bytecode. 
> >> 
> > 
> > 
> > That's cool, and it will work for the simple case of libraries A and B 
> > depending on different versions of C. 
> > 
> > But it still breaks down in more complex cases: e.g. if I want to share 
> > data between A and B using a protocol or type defined in C, and there 
> are 2 
> > incompatible versions of C. Even ClassLoaders can't help you there - I'm 
> > not aware of any solution. 
>
>
> Automatically, no, but the solution would be to use something akin to an 
> adaptor. The two versions of C would be manipulated to be in different 
> namespaces; now you just have two libraries, so the task of plumbing 
> them together remains the same. 
>
> To be honest, though, this is unlikely; after all, if you are using A 
> and B, and they are using C *as a utility*, my feeling is that C 
> shouldn't really be in their public interface. If C *is* in their public 
> interface, then again, you need adaptors. 
>
> Or you can fork A and/or B, fix them to use the same version! 
>
> 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: Utility libraries and dependency hygiene

2013-05-12 Thread Dave Kincaid
Thanks for this, Stuart. I hope it's not too late. As one who has spent the 
last couple weeks spinning up a new project that uses its own local Ivy 
repository I've been feeling this pain first hand. The number of 
dependencies I have had to add just for a few Clojure libraries has been 
quite painful. I attributed it to how young the language is that these 
utility libraries haven't had time to consolidate.

On Sunday, May 12, 2013 6:29:28 PM UTC-5, Stuart Sierra wrote:
>
> Based on a recent thread about "utility" libraries, I would like to
> take this opportunity to ask everyone to help us avoid the dependency
> mess that Common Lisp has gotten into, where there are over a dozen
> such "convenience" libraries[1].
>
> By all means, use these libraries in your *applications* if you find
> them useful. But please don't make your *libraries* depend on them
> unless you really need to.
>
> Doing this will help application developers who want to use your
> library. For example, if my application depends on libraries A, B, and
> C, I might end up with transitive dependencies on three different
> "utility" libraries. If I want to add library D which depends on an
> incompatible version of one of those utilities, I'm stuck. By
> adding to the dependencies of your library, you increase the
> likelihood of dependency conflicts for consumers.
>
> The ideal number of dependencies for a library release (not counting
> Clojure itself) is zero. Obviously, use common sense. If your library
> relies on critical functionality in another library, then make the
> dependency. But if you can get by without the dependency (even if that
> means copying some of those "utility" functions into your own code and
> making them private) then you will make life easier for consumers of
> your library.
>
> Thanks, and happy coding.
> -S
>
>
> [1]: http://cliki.net/Convenience%20library
>

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




Quick question on protocols

2013-05-09 Thread Dave Kincaid
I've not worked with protocols much, but saw a good fit recently. However, 
I'm a little bit unsure about this situation. I have some Thrift objects 
that I'd like to be able to easily unpack into maps, so I created a protocol

(defprotocol Unpackable
  (unpack [x]))

Thrift has two main data types - structs and unions that need to be handled 
differently. Structs always implement the interface TBase. Unions extend 
the abstract class TUnion which in turn implements the interface TBase. So 
I'm extending my protocol to these types like this:

(extend-protocol IUnpackable
  TUnion
  (unpack [x] (unpack-union x))

  TBase
  (unpack [x] (unpack-struct x (get-meta-data (class x)

It all seems to work correctly, but I'm a little unsure that it is 
guaranteed to work especially in the case of a union. Since a union extends 
TUnion, but also implements TBase will a call to (unpack the-union) do the 
right thing (go to unpack-union instead of unpack-struct) every time?

Thanks.

-- 
-- 
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-20 Thread Dave Kincaid
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-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=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_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.




Refactoring tools

2013-03-20 Thread Dave Kincaid
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 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: What's the point of -> ?

2013-03-12 Thread Dave Kincaid
Before long Clojure will have as much ugly, arcane syntax as Scala. (I say 
that mostly tongue in cheek, btw). For me, a lot of the attractiveness of 
Lisp languages is the minimal syntax that they have. I'm not a fan of 
adding more to Clojure than is already there. I'm just one voice and a very 
new one to Clojure, so I doubt my opinion will sway anyone else. I do love 
Clojure and hope to be able to use it more in the future, but I'll probably 
stick to the very basic syntax and forgo all this fancy sugar.

Dave

On Tuesday, March 12, 2013 4:07:19 AM UTC-5, Marko Topolnik wrote:
>
> On Monday, March 11, 2013 11:51:17 PM UTC+1, Sean Corfield wrote:
>
>> In addition to clj-time, I tend to use -> with date-clj as well: 
>>
>> (-> (today) 
>> (subtract 30 :days)) 
>>
>> And I find something like this: 
>>
>> (->> (-> response :body :postalCodes) 
>>  (map to-location) (sort-by :city)) 
>>
>> much easier to read than: 
>>
>> (sort-by :city (map to-location (:postalCodes (:body response 
>>
>
> In Clojure 1.5 I would write
>
> (as-> response x (:body x) (:postalCodes x) (map to-location x) (sort-by 
> :city x))
>
> or, perhaps
>
> (as-> response x (-> x :body :postalCodes) (->> x (map to-location) 
> (sort-by :city))
>
> I *love *as->* *!
>
> YMMV tho'... 
>>
>
> Ditto :)
>
>

-- 
-- 
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: What's the point of -> ?

2013-03-11 Thread Dave Kincaid
I'm with you. I don't like it personally. Every time I come across it 
reading code I have to stop and think about what exactly it does.

On Monday, March 11, 2013 10:00:13 AM UTC-5, edw...@kenworthy.info wrote:
>
> But to understand the first you have to expand it into the second- which 
> means understanding the arcane squiggle -> and how it differs from the 
> equally arcane squiggle ->>. Nasty, sticky, syntactic sugar :)
>
> I suspect that early on, still being a Clojure noobie, I'll stick with the 
> 'proper' Lisp forms and no doubt as I become more experienced I'll pick 
> more of the arcane Clojure idioms ;)
>
> On Monday, March 11, 2013 10:58:29 AM UTC, edw...@kenworthy.info wrote:
>>
>> So I understand that:
>>
>> (-> foo bar wibble)
>>
>> is equivalent to
>>
>> (wibble (bar (foo)))
>>
>> With the advantage that the latter version is better, in the sense that 
>> it's clearer what the final result is (the result of the call to wobble).
>>
>> What I don't understand is the need for -> the only thing it seems to do 
>> is make something Lispy appear to be imperative.
>>
>> Is that 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: Clojure 1.5 print-table, org-mode babel, and org-mode HTML gen

2013-03-05 Thread Dave Kincaid
Comments in your .emacs file? That's blasphemy!

On Tuesday, March 5, 2013 6:37:29 AM UTC-6, greg r wrote:
>
> I think I was wrong about the extra elisp code required for nrepl to 
> evaluate babel Clojure code blocks.  This was from last year:
>
>
> https://groups.google.com/forum/?fromgroups=#!searchin/nrepl-el/babel/nrepl-el/txLYH9tH6AU/hj0NkyF8YZ8J
>
> I checked my .emacs file and the extra code for clojure babel is commented 
> out, so the later versions of nrepl must have this feature included.
> Too many months ago, I really need to put better notes and comments in my 
> .emacs file!
>
> Greg
>
> On Monday, March 4, 2013 4:25:23 PM UTC-5, Mark C wrote:
>>
>> Very cool. Great looking doc! I just installed LaTeX and TeXworks so it's 
>> off to play. (Other than incanter I already have the rest working, 
>> including nrepl -  though I have to start up nrepl with nrepl-jack-in. Is 
>> that what you were planning on doing? It would be cool to have it launched 
>> by the first compile!).
>>
>>
>>

-- 
-- 
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: Interop question concerning optional args

2012-12-10 Thread Dave Kincaid
I just came across this same problem while trying to use Java 7's 
java.nio.file.Files.createTempDirectory() 
(http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createTempDirectory(java.lang.String,
 
java.nio.file.attribute.FileAttribute...))

Clojure won't let me just do (java.nio.file.Files/createTempDirectory 
"mydir")

It wants the FileAttribute argument. Can anyone help me get past this? I'm 
stuck since I really can't figure out how to create a FileAttribute. Am I 
better off just using Apache commons or something like that?

On Monday, September 27, 2010 7:20:04 PM UTC-5, ataggart wrote:
>
> The vararg at the end of the method is just syntactic sugar for an 
> array, so the "add" method actually takes 4 args, the last being a 
> Resource array.  The java compiler just replaces "missing" varargs 
> with an empty array. 
>
> My guess is that the reflection mechanisms in the compiler just look 
> at type/arity.  The Method object has a isVarArg() boolean, so that 
> could be used to allow omitting varargs altogether.  That would need 
> to be an enhancement to the clojure compiler, so I opened a ticket: 
>
>
> https://www.assembla.com/spaces/clojure/tickets/440-java-method-calls-cannot-omit-varargs
>  
>
>
> On Sep 27, 1:16 pm, JonathanBelolo  wrote: 
> > While toying with the Sesame2.3 library, I've come across the 
> > following behavior for the first time. 
> > 
> > This is taken from the api doc for 
> > org.openrdf.repository.base.RepositoryConnectionBase: 
> > 
> > add(Resource subject, URI predicate, Value object, Resource... 
> > contexts) 
> >   Adds a statement with the specified subject, predicate and 
> > object to this repository, optionally to one or more named contexts. 
> > 
> > But apparently, Clojure seems to think the optional args are 
> > mandatory... 
> > 
> > (.add con alice RDF/TYPE person) 
> > 
> > No matching method found: add for class 
> > org.openrdf.repository.sail.SailRepositoryConnection 
> >   [Thrown class java.lang.IllegalArgumentException] 
> > 
> > So I run 
> > 
> > (grep #".add" (.getMethods (.getClass con))) 
> > 
> > # > 
> org.openrdf.repository.base.RepositoryConnectionBase.add(org.openrdf.model. 
> Resource,org.openrdf.model.URI,org.openrdf.model.Value,
> org.openrdf.model.Re source[]) 
> > throws org.openrdf.repository.RepositoryException>) 
> > 
> > Finally the following works... 
> > 
> > (.add con alice RDF/TYPE person (make-array Resource 1)) 
> > nil 
> > 
> > Is this behavior normal? Are optional args mandatory when called with 
> > interop? 
> > 
> > Thanks for your help :) 
> > 
> > Jonathan

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

How to represent trees for use with zippers

2012-10-15 Thread Dave Kincaid
I stumbled across the clojure.zip library today which looks extremely 
useful for working with trees. The only problem is I can't figure out how 
to represent a tree as a vector so that the zipper will have the correct 
structure. For example say I want to work with this tree:


my first intuition was a vector like this [:A [:B [:D :E]] [:C [:F :G]]] but 
that didn't work. Then I thought of something like this: [[:B [:D :E]] :A 
[:C [:F :G]]]. It seems like that gets me a little bit closer since now the 
zipper at least gets that :A has two children.

Can anyone help me understand how to represent a tree in a Clojure vector? 
Is there a common lispy way of doing this that everyone already knows? It 
seems like all of the references I could find online all assume that you 
know how to represent a tree already.

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

Re: Clojure lazy-seq over Java iterative code

2012-09-14 Thread Dave Kincaid
Thanks, Sean. It turns out the exception is being thrown from one of the 
Java classes (I should have looked closer). I just assumed that doing the 
recursion without loop/recur would always blow the stack eventually. I'll 
have to do some research to understand when it does and when it doesn't.

I also pasted in the wrong original function that I was using when I was 
getting the exception. The code I pasted does work. The version that's 
making the Java code throw the exception has an extra (remove) in it to 
remove empty lists. It looks like this:

(defn datamap-seq
  "Returns a lazy seq of the records using the given parser and processor"
  [parser processor]
  (lazy-seq
(when-let [records (next-record parser processor)]
  (cons records (remove empty? (datamap-seq parser processor))

If I take out that remove and do it elsewhere it works fine. Still puzzling 
over that one.


On Friday, September 14, 2012 11:48:23 AM UTC-5, Sean Corfield wrote:
>
> On Fri, Sep 14, 2012 at 8:37 AM, Dave Kincaid 
> > 
> wrote: 
> > I also posted this to StackOverflow, so sorry if you saw it there too. 
> If 
> > you want some rep points over there you can answer there too 
> > (
> http://stackoverflow.com/questions/12427518/clojure-lazy-seq-over-java-iterative-code).
>  
>
>
> Looks like there's already a good answer over there. 
>
> > Of course when there are a lot of records I end up with a 
> > StackOverflowException. 
>
> Did you dig into where the StackOverflowException originated from? As 
> noted in a comment on SO, the lazy-seq can handle millions of items 
> without a problem so the problem isn't inherently with that part of 
> your code. Perhaps it's the parser or the processor? 
> -- 
> Sean A Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
> World Singles, LLC. -- http://worldsingles.com/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>

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

Clojure lazy-seq over Java iterative code

2012-09-14 Thread Dave Kincaid


I also posted this to StackOverflow, so sorry if you saw it there too. If 
you want some rep points over there you can answer there too (
http://stackoverflow.com/questions/12427518/clojure-lazy-seq-over-java-iterative-code
).

I'm trying to use create a Clojure seq from some iterative Java library 
code that I inherited. Basically what the Java code does is read records 
from a file using a parser, sends those records to a processor and returns 
an ArrayList of result. In Java this is done by calling parser.readData(), 
then parser.getRecord() to get a record then passing that record into 
processor.processRecord(). Each call to parser.readData() returns a single 
record or null if there are no more records. Pretty common pattern in Java.

So I created this next-record function in Clojure that will get the next 
record from a parser.

(defn next-record
  "Get the next record from the parser and process it."
  [parser processor]
  (let [datamap (.readData parser)
row (.getRecord parser datamap)]
(if (nil? row)
nil
(.processRecord processor row 100

The idea then is to call this function and accumulate the records into a 
Clojure seq (preferably a lazy seq). So here is my first attempt which 
works great as long as there aren't too many records:

(defn datamap-seq
  "Returns a lazy seq of the records using the given parser and processor"
  [parser processor]
  (lazy-seq
(when-let [records (next-record parser processor)]
  (cons records (datamap-seq parser processor)

I can create a parser and processor, and do something like (take 5 
(datamap-seq parser processor)) which gives me a lazy seq. And as expected 
getting the (first) of that seq only realizes one element, doing count 
realizes all of them, etc. Just the behavior I would expect from a lazy seq.

Of course when there are a lot of records I end up with a 
StackOverflowException. So my next attempt was to use loop-recur to do the 
same thing.

(defn datamap-seq
  "Returns a lazy seq of the records using the given parser and processor"
  [parser processor]
  (lazy-seq
(loop [records (seq '())]
  (if-let [record (next-record parser processor)]
(recur (cons record records))
records

Now using this the same way and defing it using (def results (datamap-seq 
parser processor)) gives me a lazy seq and doesn't realize any elements. 
However, as soon as I do anything else like (first results) it forces the 
realization of the entire seq.

Can anyone help me understand where I'm going wrong in the second function 
using loop-recur that causes it to realize the entire thing?

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

Re: Handling setting different "profiles" between different environments

2012-08-14 Thread Dave Kincaid
Thanks, Sean. I really like that approach. I wasn't even aware of the delay 
macro. Very cool. So much awesome stuff in Clojure I feel like I'll never 
learn it all.



On Tuesday, August 14, 2012 8:33:49 PM UTC-5, Sean Corfield wrote:
>
> On Tue, Aug 14, 2012 at 5:49 PM, Dave Kincaid 
> > 
> wrote: 
> > So I'm wondering how others handle this. In one project recently I setup 
> a 
> > global map using ^:dynamic and then switched in the appropriate map from 
> a 
> > command line argument. This somehow doesn't seem the right way to do it. 
> Any 
> > suggestions? Are there some projects out there that would be good 
> examples 
> > of this? 
>
> At World Singles, environment control was one of the first things we 
> switched over to Clojure. 
>
> Essentially we have a map of maps - a map with default settings and 
> then a map for each environment with overrides - and a settings Var 
> that is a delay of creating the merged map for the current host (by 
> looking up the local hostname in the override maps). That's a gross 
> simplification but it should give you an idea of what we're doing. 
>
> The application just accesses @worldsingles.environment/settings and 
> it's created on first access and cached for subsequent access (because 
> of delay). 
> -- 
> Sean A Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
> World Singles, LLC. -- http://worldsingles.com/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>

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

Handling setting different "profiles" between different environments

2012-08-14 Thread Dave Kincaid
Being new to functional programming and Lisp in particular there is 
something that's been bugging me for a while. How do people handle having 
different configurations during development for development, testing and 
production? For example, things like data sources, server names, etc are 
often different when you're developing, testing and deploying to 
production. In Java-land the Spring framework profiles work really well for 
doing this. Just specify a profile name as a program argument and global 
variables are setup appropriately.

So I'm wondering how others handle this. In one project recently I setup a 
global map using ^:dynamic and then switched in the appropriate map from a 
command line argument. This somehow doesn't seem the right way to do it. 
Any suggestions? Are there some projects out there that would be good 
examples of this?

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

Re: meta-questions - [clojure] in front of Subject line

2012-06-18 Thread Dave Kincaid
Seems like a great enhancement that Google could make. Give each subscriber 
this as an option. Then each of us can choose whether to add this or not to 
messages we see.

Personally, I only read these groups on the web and seeing [clojure] in the 
subject of every message would be really annoying. I already know I'm 
looking at the Clojure group. It's added noise that I really don't need.



On Monday, June 18, 2012 7:42:29 AM UTC-5, Jay Fields wrote:
>
> Personally, I'd like to have [] as well, but I've recently been educated 
> on the opposing point of view - and I concede that your personal workflow 
> determines what you prefer - and, it's all preferences at the end of the 
> day (no right or wrong answer). My personal workflow would benefit from [], 
> Phil's wouldn't, there's not really much more to say about that.
>
> A possible compromise? - [clj] 
>
> It's short, so it doesn't take up as much space for mobile readers, and 
> it's enough to note it's from a mailing list.
>
> On Mon, Jun 18, 2012 at 8:04 AM, Jim - FooBar(); wrote:
>
>>  On 18/06/12 11:50, Lee Spector wrote: 
>>
>> On Jun 18, 2012, at 3:02 AM, Tassilo Horn wrote:
>>
>>  There's really no need to obscure subjects.  For all your filtering
>> needs, there's the List-ID header:
>>
>>  List-ID: 
>>
>> Here's a SIEVE snippet you can install somehow to your IMAP server to
>> move messages to this list to some special group. (Most providers have a
>> web GUI for easily writing such rules.)
>>
>>  Sigh.
>>
>> I believe that the OP's interest (certainly mine in supporting him) was to 
>> have the list identified in the subject line so that we can see it, with our 
>> eyeballs, in the subject lines, in interfaces that list messages by subject. 
>> Like we can do with most other mailing lists, since including list names in 
>> subject lines is a pretty widely adopted practice. We know full well that 
>> the source of the message is available elsewhere in the header, and that 
>> this can be used to move messages (as I do for mail from various other 
>> lists, etc.), but the point isn't to move messages -- it is to have the list 
>> name actually in the subject. Depending on how you read your mail this can 
>> be handy.
>>
>> If most people are reading their email on tiny devices and the extra 
>> characters are really a hassle then fine, but all of these replies about 
>> ways to move messages are irrelevant.
>>
>> Sean Corfield's idea of using AppleScript to actually change the subject 
>> lines automatically IS to the point, although its almost comically 
>> complicated and this isn't a big enough deal for me to resort to that sort 
>> of duct tape and glue (although I appreciate the effort and the cleverness 
>> of the approach!).
>>
>>  -Lee
>>
>>
>>  
>>
>> I do agree... every other mailing list I've subscribed to does 
>> this...even [ccw] does this...I was wondering a long time ago why this 
>> group doesn't do it...Personally I've learnt to filter clojure discussions 
>> by the *absence* of subject-line!!!
>>
>> 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 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

Re: Classpath problem compiling or executing in emacs

2012-06-17 Thread Dave Kincaid
Thanks for replying, Sean. This was related to a similar post I made 
earlier. The problem was that I had switched to Leiningen 2 and my 
project.clj was still using :source-path "" instead of the new 
:source-paths []. An oversight on my part.

Dave

On Saturday, June 16, 2012 11:21:57 PM UTC-5, Sean Corfield wrote:
>
> What's in your project.clj file? 
>
> On Sat, Jun 16, 2012 at 1:19 PM, Dave Kincaid  
> wrote: 
> > I'm still having a hard time understanding how namespaces work 
> apparently. I 
> > have a project that has two Clojure source files called core.clj and 
> > generator.clj. Both files are in the same directory, src/main/clj. 
> > 
> > In core.clj I have this: 
> > 
> > (ns core 
> >   (:use [cascalog.playground] 
> > [generator]) 
> >   (:import [org.joda.time.format DateTimeFormat DateTimeFormatter])) 
> > 
> > and trying to execute it or compile (using C-x C-e or C-c C-k) I get the 
> > error 
> > 
> > Could not locate generator__init.class or generator.clj on classpath: 
> >   [Thrown class java.io.FileNotFoundException] 
> > 
> > Could someone help me understand what I'm doing wrong? 
>

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

Re: Classpath set by lein swank or clojure-jack-in

2012-06-16 Thread Dave Kincaid
Thank you, Carlo! That was it! I'm using Leingingen 2. It's working great 
now.

Dave

On Saturday, June 16, 2012 8:34:08 PM UTC-5, Carlo wrote:
>
> On Sat, Jun 16, 2012 at 10:10 AM, Dave Kincaid  
> wrote: 
> > Sure can. Here is the project.clj: 
> > 
> > (defproject swank-test "0.1" 
> >   :source-path "src/main/clj" 
>
> Are you using lein 1.x or lein 2.x? In lein 2.x you need to use 
> `:source-paths ["src/main/clj"]` here. 
>
> >   :test-path "test/clj" 
> >   :java-source-path "src/main/java" 
>
> The same goes for :test-paths and :java-source-paths. The leiningen 
> girhub repository has a sample project.clj which is where I looked 
> this up (in case you need to look something else up later). 
>
> https://github.com/technomancy/leiningen/blob/master/sample.project.clj 
>
> >   :javac-options {:debug "true" :fork "true"} 
> >   :resources-path "src/main/resources" 
> >   :dependencies [[org.clojure/clojure "1.4.0"] 
> >  [cascalog "1.9.0"] 
> >  [org.apache.hadoop/hadoop-core "0.20.2" :exclusions 
> > [hsqldb/hsqldb]]]) 
> > 
> > I have a file named generator.clj in src/main/clj. When I do a "lein 
> swank" 
> > from the directory that project.clj is in then run slime-connect in 
> Emacs 
> > with the generator.clj file open. Then I try to do (use 'generator) and 
> get 
> > 
> > Could not locate generator__init.class or generator.clj on classpath: 
> >   [Thrown class java.io.FileNotFoundException] 
>
> When I do this with your supplied project.clj with lein 1.x it works. 
> With lein2.x and the changes outlined above it also works. 
>

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

Classpath problem compiling or executing in emacs

2012-06-16 Thread Dave Kincaid
I'm still having a hard time understanding how namespaces work apparently. 
I have a project that has two Clojure source files called core.clj and 
generator.clj. Both files are in the same directory, src/main/clj. 

In core.clj I have this:

(ns core
  (:use [cascalog.playground]
[generator])
  (:import [org.joda.time.format DateTimeFormat DateTimeFormatter]))

and trying to execute it or compile (using C-x C-e or C-c C-k) I get the 
error

Could not locate generator__init.class or generator.clj on classpath: 
  [Thrown class java.io.FileNotFoundException]

Could someone help me understand what I'm doing wrong?

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

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Dave Kincaid
Thanks I'll give those things a try. swank-test was just a small project I 
threw together as an example for this post. The directory structure is the 
same as my big project though. I'll play around with your suggestions and 
see if I can find a pattern to when it works and when it doesn't.

Thanks,

Dave

On Friday, June 15, 2012 9:10:21 PM UTC-5, Peter wrote:
>
> Probably over-cautious because of my ignorance, but I don't know if I 
> would name the project "swank-test" as I haven't paid too close attention 
> to what seems a slightly confusing rule about "dashes in namespaces and 
> underscores in filenames" - also swank-test might be some sort of existing 
> namespace that secretly gets loaded and oddly conflicts. 
>
> I also haven't done much with directory structure under the 
> src/ folder - do you have the same problems with a project 
> that only has one file, or only files in that folder? 
>
> Like I said this is mostly based on my ignorance, and getting a handle on 
> the namespacing is probably a good idea, but I've never had an issue with 
> my small projects with flat/default directory structures. Might workaround 
> it for you in the short term. 
>
> -Original Message- 
> From: Sean Corfield  
> Sender: clojure@googlegroups.com 
> Date: Fri, 15 Jun 2012 18:44:46 
> To:  
> Reply-To: clojure@googlegroups.com 
> Subject: Re: Classpath set by lein swank or clojure-jack-in 
>
> Have you tried visiting the project.clj file in Emacs and then doing 
> M-x clojure-jack-in ? That should start lein swank in the project 
> directory and pull in all the dependencies as expected. 
>
> (you should start lein swank in the project root directory - 
> containing project.clj - not in a subdirectory) 
>
> On Fri, Jun 15, 2012 at 5:10 PM, Dave Kincaid  
> wrote: 
> > Sure can. Here is the project.clj: 
> > 
> > (defproject swank-test "0.1" 
> >   :source-path "src/main/clj" 
> >   :test-path "test/clj" 
> >   :java-source-path "src/main/java" 
> >   :javac-options {:debug "true" :fork "true"} 
> >   :resources-path "src/main/resources" 
> >   :dependencies [[org.clojure/clojure "1.4.0"] 
> >  [cascalog "1.9.0"] 
> >  [org.apache.hadoop/hadoop-core "0.20.2" :exclusions 
> > [hsqldb/hsqldb]]]) 
> > 
> > I have a file named generator.clj in src/main/clj. When I do a "lein 
> swank" 
> > from the directory that project.clj is in then run slime-connect in 
> Emacs 
> > with the generator.clj file open. Then I try to do (use 'generator) and 
> get 
> > 
> > Could not locate generator__init.class or generator.clj on classpath: 
> >   [Thrown class java.io.FileNotFoundException] 
> > 
> > 
> > what am I doing wrong? 
>
> -- 
> 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 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

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Dave Kincaid
Sure can. Here is the project.clj:

(defproject swank-test "0.1"
  :source-path "src/main/clj"
  :test-path "test/clj"
  :java-source-path "src/main/java"
  :javac-options {:debug "true" :fork "true"}
  :resources-path "src/main/resources"
  :dependencies [[org.clojure/clojure "1.4.0"]
 [cascalog "1.9.0"]
 [org.apache.hadoop/hadoop-core "0.20.2" :exclusions 
[hsqldb/hsqldb]]])

I have a file named generator.clj in src/main/clj. When I do a "lein swank" 
from the directory that project.clj is in then run slime-connect in Emacs 
with the generator.clj file open. Then I try to do (use 'generator) and get

Could not locate generator__init.class or generator.clj on classpath: 
  [Thrown class java.io.FileNotFoundException]


what am I doing wrong?

On Friday, June 15, 2012 6:26:02 PM UTC-5, Moritz Ulrich wrote:
>
> That's strange. You usually just run lein swank in the folder with you 
> project.clj. Nothing to do wrong there.
>
> Can you show the project.clj and the directory structure of a non-working 
> project? 
>
> -- 
> Sent from my mobile
> Am 16.06.2012 01:07 schrieb "Dave Kincaid" :
>
>> I'm with you, Peter. The problem is I can't get lein swank and 
>> slime-connect working in a consistent way. It starts up fine but can't find 
>> any dependencies that I try to (use ...) or even any of the code in my .clj 
>> files that I try to access. I just can't understand what it's using as a 
>> classpath when it's launched. When I do stumble on the right combination of 
>> directory, lein swank and emacs buffer it is awesome!
>>
>> On Friday, June 15, 2012 5:42:59 PM UTC-5, Peter wrote:
>>>
>>> Once I got lein swank and slime-connect working in emacs, I essentially 
>>> stopped using the repl directly. The real magic and beauty of writing 
>>> clojure in emacs is that I can write a fn, then C-x C-e to evaluate it 
>>> right there in the file. I can evaluate inner forms, test every line of the 
>>> file to confirm it works, experiment, etc, and the code is all saved in the 
>>> file. 
>>>
>>> I don't want to write anything *other* than clojure because it's such a 
>>> beautiful and effective experience. 
>>> --
>>> *From: * Dave Kincaid  
>>> *Sender: * clojure@googlegroups.com 
>>> *Date: *Fri, 15 Jun 2012 14:47:10 -0700 (PDT)
>>> *To: *
>>> *ReplyTo: * clojure@googlegroups.com 
>>> *Subject: *Classpath set by lein swank or clojure-jack-in
>>>
>>> One of the things that really been holding me back from moving ahead 
>>> with Clojure is the difficulty I have running code that I'm writing using a 
>>> repl. I generally use Emacs to code Clojure and I really don't understand 
>>> how the classpath gets set when I use either "lein swank + slime-connect" 
>>> or "clojure-jack-in". I can't seem to get it to find either any 
>>> dependencies that I've included in the project.clj or any of my own code 
>>> without a lot of hit and miss trial and error. Eventually I can usually get 
>>> it to work by doing all kind of things like compiling the .clj file, 
>>> launching lein swank from different directories, etc. Is there a good 
>>> document that I could read to understand how I should be doing this. It's 
>>> so frustrating that I don't even want to try writing Clojure code most of 
>>> the time eventhough I'm loving the language.
>>>
>>> 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+unsubscribe@**googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
>>>  
>>>
>>  -- 
>> 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 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

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Dave Kincaid
I'm with you, Peter. The problem is I can't get lein swank and 
slime-connect working in a consistent way. It starts up fine but can't find 
any dependencies that I try to (use ...) or even any of the code in my .clj 
files that I try to access. I just can't understand what it's using as a 
classpath when it's launched. When I do stumble on the right combination of 
directory, lein swank and emacs buffer it is awesome!

On Friday, June 15, 2012 5:42:59 PM UTC-5, Peter wrote:
>
> Once I got lein swank and slime-connect working in emacs, I essentially 
> stopped using the repl directly. The real magic and beauty of writing 
> clojure in emacs is that I can write a fn, then C-x C-e to evaluate it 
> right there in the file. I can evaluate inner forms, test every line of the 
> file to confirm it works, experiment, etc, and the code is all saved in the 
> file. 
>
> I don't want to write anything *other* than clojure because it's such a 
> beautiful and effective experience. 
> --
> *From: * Dave Kincaid  
> *Sender: * clojure@googlegroups.com 
> *Date: *Fri, 15 Jun 2012 14:47:10 -0700 (PDT)
> *To: *
> *ReplyTo: * clojure@googlegroups.com 
> *Subject: *Classpath set by lein swank or clojure-jack-in
>
> One of the things that really been holding me back from moving ahead with 
> Clojure is the difficulty I have running code that I'm writing using a 
> repl. I generally use Emacs to code Clojure and I really don't understand 
> how the classpath gets set when I use either "lein swank + slime-connect" 
> or "clojure-jack-in". I can't seem to get it to find either any 
> dependencies that I've included in the project.clj or any of my own code 
> without a lot of hit and miss trial and error. Eventually I can usually get 
> it to work by doing all kind of things like compiling the .clj file, 
> launching lein swank from different directories, etc. Is there a good 
> document that I could read to understand how I should be doing this. It's 
> so frustrating that I don't even want to try writing Clojure code most of 
> the time eventhough I'm loving the language.
>
> 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 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

Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Dave Kincaid
One of the things that really been holding me back from moving ahead with 
Clojure is the difficulty I have running code that I'm writing using a 
repl. I generally use Emacs to code Clojure and I really don't understand 
how the classpath gets set when I use either "lein swank + slime-connect" 
or "clojure-jack-in". I can't seem to get it to find either any 
dependencies that I've included in the project.clj or any of my own code 
without a lot of hit and miss trial and error. Eventually I can usually get 
it to work by doing all kind of things like compiling the .clj file, 
launching lein swank from different directories, etc. Is there a good 
document that I could read to understand how I should be doing this. It's 
so frustrating that I don't even want to try writing Clojure code most of 
the time eventhough I'm loving the language.

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