Re: using -> on a nested hash-map with string keywords.

2012-06-01 Thread Boris V. Schmid
Thanks, it was get-in that I was looking for, but couldn't find. Also 
thanks to Dave for explaining that keywords have some internal magic 
compared to strings. will remember!

On Thursday, 31 May 2012 19:22:50 UTC+2, Alan Malloy wrote:
>
> Yes, but really to GET a value nested IN a series of maps, he should 
> just be using get-in, rather than threading anything at all. 
>
> On May 31, 7:59 am, Dave Ray  wrote: 
> > Keywords implement IFn meaning they can act as functions that look 
> > themselves up in a map. Strings are just strings. Replace "b" with 
> > (get "b") and you'll get the behavior you're looking for. 
> > 
> > Dave 
> > 
> > On Thu, May 31, 2012 at 7:55 AM, Boris V. Schmid  
> wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > Can someone tell me what I'm overlooking (clojure 1.4) 
> > 
> > > (-> (hash-map :b (hash-map :a 3)) :b :a) 
> > > 3 
> > > user> (-> (hash-map "b" (hash-map :a 3)) "b" :a) 
> > > ; Evaluation aborted: java.lang.String cannot be cast to 
> clojure.lang.IFn 
> > 
> > > I'm not sure why the first can work, and the second cannot. Is it a 
> logical 
> > > limitation of the language, or an oversight in how the macro -> is 
> build? 
> > 
> > > -- 
> > > 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: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Jim - FooBar();
After upgrading from preview4 to preview5 I get this when trying to do 
"lein2 repl" inside any project folder...

Is this a known issue? I'm using Jdk 1.7...

Could not find artifact reply:reply:pom:0.1.0-beta8 in central 
(http://repo1.maven.org/maven2)
Could not transfer artifact reply:reply:pom:0.1.0-beta8 from/to clojars 
(https://clojars.org/repo/): sun.security.validator.ValidatorException: 
PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to 
find valid certification path to requested target
Exception in thread "main" 
org.sonatype.aether.resolution.DependencyResolutionException: Failed to 
collect dependencies for clojure.lang.LazySeq@fca6e7f
at 
org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:371)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at 
cemerick.pomegranate.aether$resolve_dependencies.doInvoke(aether.clj:406)

at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:601)
at cemerick.pomegranate$add_dependencies.doInvoke(pomegranate.clj:102)
at clojure.lang.RestFn.invoke(RestFn.java:1096)
at 
leiningen.core.classpath$get_dependencies.doInvoke(classpath.clj:128)

at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:605)
at 
leiningen.core.classpath$resolve_dependencies.doInvoke(classpath.clj:144)

at clojure.lang.RestFn.invoke(RestFn.java:464)
at leiningen.core.project$load_plugins.invoke(project.clj:208)
at leiningen.core.project$load_plugins.invoke(project.clj:209)
at leiningen.core.project$init_project.invoke(project.clj:233)
at leiningen.core.main$_main.doInvoke(main.clj:131)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:415)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.core$apply.invoke(core.clj:601)
at clojure.main$main_opt.invoke(main.clj:324)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at clojure.lang.Var.invoke(Var.java:423)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: org.sonatype.aether.collection.DependencyCollectionException: 
Failed to collect dependencies for clojure.lang.LazySeq@fca6e7f
at 
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
at 
org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:333)

... 32 more
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: 
Failed to read artifact descriptor for reply:reply:jar:0.1.0-beta8
at 
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
at 
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
at 
org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
at 
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)

... 33 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: 
Could not transfer artifact reply:reply:pom:0.1.0-beta8 from/to clojars 
(https://clojars.org/repo/): sun.security.validator.ValidatorException: 
PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to 
find valid certification path to requested target
at 
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at 
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at 
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at 
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)

... 36 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could 
not transfer artifact reply:reply:pom:0.1.0-beta8 from/to clojars 
(https://clojars.org/repo/): sun.security.validator.ValidatorException: 
PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderExcep

Re: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Baishampayan Ghose
And I am facing a JLine related error when I launch the repl.

Full stack trace here https://www.refheap.com/paste/2956

I am using Java6 on Mac OS X.

Regards,
BG

On Fri, Jun 1, 2012 at 1:59 PM, Jim - FooBar();  wrote:
> After upgrading from preview4 to preview5 I get this when trying to do
> "lein2 repl" inside any project folder...
> Is this a known issue? I'm using Jdk 1.7...
> 
> Could not find artifact reply:reply:pom:0.1.0-beta8 in central
> (http://repo1.maven.org/maven2)
> Could not transfer artifact reply:reply:pom:0.1.0-beta8 from/to clojars
> (https://clojars.org/repo/): sun.security.validator.ValidatorException: PKIX
> path building failed:
> sun.security.provider.certpath.SunCertPathBuilderException: unable to find
> valid certification path to requested target
> Exception in thread "main"
> org.sonatype.aether.resolution.DependencyResolutionException: Failed to
> collect dependencies for clojure.lang.LazySeq@fca6e7f
>    at
> org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:371)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>    at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>    at java.lang.reflect.Method.invoke(Method.java:601)
>    at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
>    at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
>    at
> cemerick.pomegranate.aether$resolve_dependencies.doInvoke(aether.clj:406)
>    at clojure.lang.RestFn.applyTo(RestFn.java:137)
>    at clojure.core$apply.invoke(core.clj:601)
>    at cemerick.pomegranate$add_dependencies.doInvoke(pomegranate.clj:102)
>    at clojure.lang.RestFn.invoke(RestFn.java:1096)
>    at leiningen.core.classpath$get_dependencies.doInvoke(classpath.clj:128)
>    at clojure.lang.RestFn.applyTo(RestFn.java:142)
>    at clojure.core$apply.invoke(core.clj:605)
>    at
> leiningen.core.classpath$resolve_dependencies.doInvoke(classpath.clj:144)
>    at clojure.lang.RestFn.invoke(RestFn.java:464)
>    at leiningen.core.project$load_plugins.invoke(project.clj:208)
>    at leiningen.core.project$load_plugins.invoke(project.clj:209)
>    at leiningen.core.project$init_project.invoke(project.clj:233)
>    at leiningen.core.main$_main.doInvoke(main.clj:131)
>
>    at clojure.lang.RestFn.invoke(RestFn.java:408)
>    at clojure.lang.Var.invoke(Var.java:415)
>    at clojure.lang.AFn.applyToHelper(AFn.java:161)
>    at clojure.lang.Var.applyTo(Var.java:532)
>    at clojure.core$apply.invoke(core.clj:601)
>    at clojure.main$main_opt.invoke(main.clj:324)
>    at clojure.main$main.doInvoke(main.clj:427)
>    at clojure.lang.RestFn.invoke(RestFn.java:436)
>    at clojure.lang.Var.invoke(Var.java:423)
>    at clojure.lang.AFn.applyToHelper(AFn.java:167)
>    at clojure.lang.Var.applyTo(Var.java:532)
>    at clojure.main.main(main.java:37)
> Caused by: org.sonatype.aether.collection.DependencyCollectionException:
> Failed to collect dependencies for clojure.lang.LazySeq@fca6e7f
>    at
> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
>    at
> org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:333)
>    ... 32 more
> Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
> Failed to read artifact descriptor for reply:reply:jar:0.1.0-beta8
>    at
> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
>    at
> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
>    at
> org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
>    at
> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
>    ... 33 more
> Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could
> not transfer artifact reply:reply:pom:0.1.0-beta8 from/to clojars
> (https://clojars.org/repo/): sun.security.validator.ValidatorException: PKIX
> path building failed:
> sun.security.provider.certpath.SunCertPathBuilderException: unable to find
> valid certification path to requested target
>    at
> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
>    at
> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
>    at
> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
>    at
> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
>    .

Re: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Jim - FooBar();
Your error seems very similar with mnicky's error which is a known 
issueMy error on the other hand seems to be completely different 
from yours!


Jim

On 01/06/12 09:35, Baishampayan Ghose wrote:

And I am facing a JLine related error when I launch the repl.

Full stack trace here https://www.refheap.com/paste/2956

I am using Java6 on Mac OS X.

Regards,
BG

On Fri, Jun 1, 2012 at 1:59 PM, Jim - FooBar();  wrote:

After upgrading from preview4 to preview5 I get this when trying to do
"lein2 repl" inside any project folder...
Is this a known issue? I'm using Jdk 1.7...

Could not find artifact reply:reply:pom:0.1.0-beta8 in central
(http://repo1.maven.org/maven2)
Could not transfer artifact reply:reply:pom:0.1.0-beta8 from/to clojars
(https://clojars.org/repo/): sun.security.validator.ValidatorException: PKIX
path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target
Exception in thread "main"
org.sonatype.aether.resolution.DependencyResolutionException: Failed to
collect dependencies for clojure.lang.LazySeq@fca6e7f
at
org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:371)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at
cemerick.pomegranate.aether$resolve_dependencies.doInvoke(aether.clj:406)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:601)
at cemerick.pomegranate$add_dependencies.doInvoke(pomegranate.clj:102)
at clojure.lang.RestFn.invoke(RestFn.java:1096)
at leiningen.core.classpath$get_dependencies.doInvoke(classpath.clj:128)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:605)
at
leiningen.core.classpath$resolve_dependencies.doInvoke(classpath.clj:144)
at clojure.lang.RestFn.invoke(RestFn.java:464)
at leiningen.core.project$load_plugins.invoke(project.clj:208)
at leiningen.core.project$load_plugins.invoke(project.clj:209)
at leiningen.core.project$init_project.invoke(project.clj:233)
at leiningen.core.main$_main.doInvoke(main.clj:131)

at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:415)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.core$apply.invoke(core.clj:601)
at clojure.main$main_opt.invoke(main.clj:324)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at clojure.lang.Var.invoke(Var.java:423)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: org.sonatype.aether.collection.DependencyCollectionException:
Failed to collect dependencies for clojure.lang.LazySeq@fca6e7f
at
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
at
org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:333)
... 32 more
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
Failed to read artifact descriptor for reply:reply:jar:0.1.0-beta8
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
at
org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
at
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
... 33 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could
not transfer artifact reply:reply:pom:0.1.0-beta8 from/to clojars
(https://clojars.org/repo/): sun.security.validator.ValidatorException: PKIX
path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at
org.apache.maven.repository.internal.DefaultA

Re: Network Visual Layout Algorithm

2012-06-01 Thread atucker
Spectral Graph Theory?
http://cs-www.cs.yale.edu/homes/spielman/TALKS/haifa1.pdf

On Thursday, 31 May 2012 14:37:21 UTC+1, Sean Devlin wrote:
>
> Hey folks,
> I'm looking for help demonstrating Clojure's superiority to Scala :)
>
> I have a contest going with a colleague, where we each have to render a 
> network layout in SVG.  My gut says that Synthetic Annealing is the right 
> tool for the job here.
>
>1. Does anyone have a better thought than synthetic annealing?  Speed 
>is key in this contest
>2. Does anyone know of an implementation on Clojars, etc?
>
> Thanks,
> Sean
>

-- 
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: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Sun Ning
I'm running preview5 on OpenJDK 7, also got this issue both when upgrade 
and self-install.


On 06/01/2012 02:40 PM, mnicky wrote:
After upgrade from preview4 and installation of OpenJDK, 'lein2 repl' 
worked exactly once. Since then, it fails with:


Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.loadClassForName(RT.java:2056)
at clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at reply.reader.jline$loading__4784__auto__.invoke(jline.clj:1)
at reply.reader.jline__init.load(Unknown Source)
at reply.reader.jline__init.(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.loadClassForName(RT.java:2056)
at clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:805)
at reply.eval_modes.nrepl$loading__4784__auto__.invoke(nrepl.clj:1)
at reply.eval_modes.nrepl__init.load(Unknown Source)
at reply.eval_modes.nrepl__init.(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.loadClassForName(RT.java:2056)
at clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:703)
at reply.main$loading__4784__auto__.invoke(main.clj:1)
at reply.main__init.load(Unknown Source)
at reply.main__init.(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.loadClassForName(RT.java:2056)
at clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:1096)
at leiningen.repl$loading__4784__auto__.invoke(repl.clj:1)
at leiningen.repl__init.load(Unknown Source)
at leiningen.repl__init.(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.loadClassForName(RT.java:2056)
at clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at leiningen.core.main$resolve_task.invoke(main.clj:65)
at leiningen.core.main$resolve_task.invoke(main.clj:73)
at leiningen.core.main$apply_task.invoke(main.clj:84)
at leiningen.core.main$

Re: [ANN] Itsy 0.1.0 released, a threaded web spider written in Clojure

2012-06-01 Thread László Török
Hi,

interesting project. I was wondering though how do you make sure two
crawlers do not crawl the same URL twice if there is no global state? :)

If I read it correctly you're going to have to spawn a lot of threads to
have at least a few busy with extraction at an point in time, as most of
them will be blocked most of the time while waiting for the page to be
retrieved.

You may also consider using the sitemap as a source of urls per domain,
although this depends on the crawling policy.

Regards,

Laszlo

2012/6/1 Lee Hinman 

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi all,
> I'm pleased to announce the initial 0.1.0 release of Itsy. Itsy is a
> threaded web spider written in Clojure. A list of some of the Itsy
> features:
>
> - - Multithreaded, with the ability to add and remove workers as needed
> - - No global state, run multiple crawlers with multiple threads at once
> - - Pre-written handlers for writing to text files and ElasticSearch
> - - Skip URLs that have been seen before
> - - Domain limiting to crawl pages only belonging to a certain domain
>
> You should be able to use it from Clojars[1] with the following:
>
> [itsy "0.1.0"]
>
> Please give it a try and open any issues on the github repo[2] that
> you find. Check out the readme for the full information and usage.
>
> thanks,
> Lee Hinman
>
> [1]: https://clojars.org/itsy
> [2]: https://github.com/dakrone/itsy
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.12 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJPyDu+AAoJEJ1kZdQ6zsrgseoP/0j4HZ4k0Ok0f2u4HB7xm1kc
> V5oE67kqXKCJq7Nb4LQexbxEwbpQF1u6Zg9o7CvtUeMtLkQXAozIjJkk0H05HtEy
> lXINNupW2AylXnTzMd75E0ydeY+pvyNrG1EY5W1i5CcKhiruNcAQUNxh4UeCmMw2
> G/TBhENW+24KtFEJBd1sum2+o86atMHxvlNruwheLYtzq1iSUbpJe6oZu0EzZaa7
> DlrG1r8Gv77Tgbf+pYtFr+Bpf+ILaojh1lBJwb/8jPbaLwrI/TE4qdnOA+BERn0F
> 7qtNErxq5UBVhrYh9Nit53ZEyDkHLYGWc0P39F8nFfWeWN9C8hAd9GWFddyZw3xL
> eop7IF0XerGdPaM93qfnKDMJLUFGfakBeP4hZIH1k5Ouoou+ffqbIZbzKK4yQwlt
> 9VFKq7z0CsoNQ+sMwPWHjXTqNj62k1DYo1iyGFc0RHLyujuGtOna6ksh10PopIpz
> JxZX+txYXI5MsxLo6zGqHbuartXxhNUtoloYBi3BkD1Knmf5qYR/Irlzcy4TUIov
> QK/UNtvESSapKO/95HUgnw9wi0UDpOLHFTBTFU2XZkvNAalLwMLX9YZwAH79+htY
> C4cKLZjkME7wkvgq/HaMbRsPNuuJN8oBqDpmNzKW2DlJ6TZIdcjlgAVDBFL9oI1+
> mMlBkEVBNGMK+9dWMHur
> =BcLy
> -END PGP SIGNATURE-
>
> --
> 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




-- 
László Török

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

When arithmetic on a computer bite back

2012-06-01 Thread kawas
Hi,

Can someone explain to me the behavior of this function when applied
to different kind of numbers.

(defn prime-factors [n]
  (loop [f 2 n n res []]
(cond
  (<= n 1) res
  (zero? (rem n f)) (recur f (quot n f) (conj res f))
  :else (recur (inc f) n res

Problem 1 (solved): If you use (= n 1) in the first cond clause, the
function may not terminate because (= 1 1.0) may be false. But we all
know that :)

Problem 2: Now compare theses function calls
(prime-factors (Math/pow 2 58))
(prime-factors (bigdec (Math/pow 2 58)))
(prime-factors (bigint (bigdec (Math/pow 2 58

The last two function calls are really really slow.
- Is this only a problem of rem/quot slow on big numbers ?

-
Laurent

-- 
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: ANN factual-clojure-driver 1.3.1, Factual's officially supported Clojure driver

2012-06-01 Thread dirtyvagabond
Thanks Sun Ning! Please let me know if there's anything I can do to help. 
Very interested in feedback and suggestions... 8-]


On Thursday, May 31, 2012 8:14:07 PM UTC-7, Sun Ning wrote:
>
>  Awesome geo-data service! Can't wait to try out your APIs.
>
> On 06/01/2012 10:33 AM, dirtyvagabond wrote: 
>
> factual-clojure-driver is Factual's officially supported Clojure driver: 
> https://github.com/Factual/factual-clojure-driver
>
>  Version 1.3.1 has been upgraded to support the latest API feature set:
>  
>- Core: Find places around a given geocode, filter by any combination 
>of attributes, and conduct full-text searches across all attributes 
>- Places Crosswalk - Lookup places and business entities across 40+ 
>services including Facebook, Foursquare, Yelp, and Twitter
> - Resolve: Enrich, augment and de-dupe existing datasets 
>- Geopulse: Low-latency location data for geotargeting
> - Reverse Geocoder: Convert coordinates into addresses
> 
>  -- 
> 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: When arithmetic on a computer bite back

2012-06-01 Thread Tassilo Horn
kawas  writes:

Hi Laurent,

> (defn prime-factors [n]
>   (loop [f 2 n n res []]
> (cond
>   (<= n 1) res
>   (zero? (rem n f)) (recur f (quot n f) (conj res f))
>   :else (recur (inc f) n res
>
> Problem 1 (solved): If you use (= n 1) in the first cond clause, the
> function may not terminate because (= 1 1.0) may be false. But we all
> know that :)

Use (== n 1) instead.

> Problem 2: Now compare theses function calls
> (prime-factors (Math/pow 2 58))
> (prime-factors (bigdec (Math/pow 2 58)))
> (prime-factors (bigint (bigdec (Math/pow 2 58
>
> The last two function calls are really really slow.
> - Is this only a problem of rem/quot slow on big numbers ?

No, debugging it a bit it seems to be a bug in
clojure.lang.Numbers.quotient() applied to BigDecs:

user> (quot 1.4411518807585587E17 2)   ;; correct with doubles
7.2057594037927936E16
user> (quot 1.4411518807585587E+17M 2) ;; wrong with BigDecs
72057594037927935M

Please file a bug report about that.

Bye,
Tassilo

-- 
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: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Phil Hagelberg
On Thu, May 31, 2012 at 10:11 PM, Phil Hagelberg  wrote:
> A few bugs to watch for:
>
> * Traffic to/from Clojars now uses SSL, except on Windows:
> https://github.com/technomancy/leiningen/issues/613
> * Startup takes a few hundred milliseconds more than preview4 for
> unknown reasons: https://github.com/technomancy/leiningen/issues/614
> * Credentials can only be decrypted using gpg-agent on Mac OS X due to
> a bug in GPG: https://github.com/technomancy/leiningen/issues/615

It turns out the problem with SSL is an issue with Oracle's JDK rather
than being specific to Windows; Oracle revoked the certificate
authority used by Clojars. So if you are not using OpenJDK for some
reason this will be a problem. We're working on a workaround; in the
mean time you're best off sticking with preview4 for now. OpenJDK
users aren't affected by this issue, but there's another problem with
the packaging of the repl. I have a fix for this one; it will be
released once the SSL issue is addressed.

tl;dr: hold off on upgrading if you use Oracle's JDK or the repl task;
sorry for the inconvenience.

-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


clojure.reflect annotations

2012-06-01 Thread Jon Rose
Hello,

I am wondering if anyone knows how to get method annotations from a method 
using the clojure.reflect library. I going of a Stuart Sierra 
poston
 Stack Overflow which game me this

user=> (pprint (reflect "hello"))
{:bases
 #{java.io.Serializable java.lang.Comparable java.lang.Object
   java.lang.CharSequence},
 :flags #{:public :final},
 :members
 #{{:name valueOf,
:return-type java.lang.String,
:declaring-class java.lang.String,
:parameter-types [boolean],
:exception-types [],
:flags #{:static :public}}


which works great but I am also hoping to grab method comments. Is this 
possible with using interop?

thanks

jon

-- 
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: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Jim - FooBar();

How come building preview5 from source works just  fine?

Jim


On 01/06/12 18:27, Phil Hagelberg wrote:

It turns out the problem with SSL is an issue with Oracle's JDK rather
than being specific to Windows; Oracle revoked the certificate
authority used by Clojars. So if you are not using OpenJDK for some
reason this will be a problem. We're working on a workaround; in the
mean time you're best off sticking with preview4 for now. OpenJDK
users aren't affected by this issue, but there's another problem with
the packaging of the repl. I have a fix for this one; it will be
released once the SSL issue is addressed.


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

2012-06-01 Thread Jon Rose
sorry, typo. My bluetooth keyboard is geeking out. I meant, is it possible 
to do this with out using the Jave Reflection classes through interop. 

On Friday, June 1, 2012 11:38:17 AM UTC-7, Jon Rose wrote:
>
> Hello,
>
> I am wondering if anyone knows how to get method annotations from a method 
> using the clojure.reflect library. I am going of a Stuart Sierra 
> poston
>  Stack Overflow which gave me this
>
> user=> (pprint (reflect "hello"))
> {:bases
>  #{java.io.Serializable java.lang.Comparable java.lang.Object
>java.lang.CharSequence},
>  :flags #{:public :final},
>  :members
>  #{{:name valueOf,
> :return-type java.lang.String,
> :declaring-class java.lang.String,
> :parameter-types [boolean],
> :exception-types [],
> :flags #{:static :public}}
>
>
> which works great but I am also hoping to grab method comments. Is this 
> possible with out using interop?
>
> thanks
>
> jon
>

On Friday, June 1, 2012 11:38:17 AM UTC-7, Jon Rose wrote:
>
> Hello,
>
> I am wondering if anyone knows how to get method annotations from a method 
> using the clojure.reflect library. I going of a Stuart Sierra 
> poston
>  Stack Overflow which game me this
>
> user=> (pprint (reflect "hello"))
> {:bases
>  #{java.io.Serializable java.lang.Comparable java.lang.Object
>java.lang.CharSequence},
>  :flags #{:public :final},
>  :members
>  #{{:name valueOf,
> :return-type java.lang.String,
> :declaring-class java.lang.String,
> :parameter-types [boolean],
> :exception-types [],
> :flags #{:static :public}}
>
>
> which works great but I am also hoping to grab method comments. Is this 
> possible with using interop?
>
> thanks
>
> jon
>

-- 
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: [ANN] Itsy 0.1.0 released, a threaded web spider written in Clojure

2012-06-01 Thread Michael Klishin
László Török:

> I was wondering though how do you make sure two
> crawlers do not crawl the same URL twice if there is no global state? :)

By adding sharing state, for a single app instance, typically an atom. As for 
separating different instances,
it is not uncommon to hash seed URLs (or domains) in such a way that two 
instances simply won't
crawl the same site in parallel.


> You may also consider using the sitemap as a source of urls per domain,
> although this depends on the crawling policy.

That does not work in practice. One reason is, sitemaps are often incomplete, 
out of date or missing
completely. Another one, for most news websites and blogs, you will discover 
site structure a lot
faster by frequently (within reason, of course) recrawling either first level 
pages or a seed of known
"section" pages.

There is a really good workshop on Web mining video from Strata Santa Clara 
2012, it highlights two dozens
more common problems you face when designing Web crawlers:

http://my.safaribooksonline.com/video/-/9781449336172

Highly recommended for people who are interested or work in this area (I think 
it can be purchased separately, O'Reilly Safari subscribers have access to the 
entire video set)

I am by no means an expert (or even very experienced) in this area but Itsy has 
features that solve several very common
problems out of the box in 0.1.0. Good job.

MK

-- 
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: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Michael Klishin
Phil Hagelberg:

> tl;dr: hold off on upgrading if you use Oracle's JDK or the repl task;
> sorry for the inconvenience.

travis-ci.org now uses preview 5 for lein2, we fixed Oracle JDK issues by 
installing the missing certificate
during provisioning.

Workarounds for OS X and Linux can be found in this thread:

https://github.com/technomancy/leiningen/issues/613

MK

-- 
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: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Phil Hagelberg
On Fri, Jun 1, 2012 at 11:38 AM, Jim - FooBar();  wrote:
> How come building preview5 from source works just  fine?

The JLine/repl bug was due to a mistake I made while generating the
uberjar, so building from source will take care of that.

But the SSL problem is actually something plaguing most JDK builds; I
realized the reason it's not happening on most Linux systems is that
Debian fixes the cert store that the JDK uses. Building from source
will not protect you from this, but using a JDK from Debian will.

I've rolled back the "preview" branch so `lein upgrade` doesn't pull
in the problematic release.

-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


Re: [ANN] Itsy 0.1.0 released, a threaded web spider written in Clojure

2012-06-01 Thread László Török
Hi,

don't want to turn this to a lengthy discussion about crawling, but happy
to continue off list. ;)

Sitemaps work surprisingly well in certain domains (web shops powered by
standard web shop software, large e-commerce sites) and can make life
easier based on our experience.

Another point: i nice addition would be to observe polite crawling (e.g. do
not retrieve more than one page per sec from a domain), we got banned once
due to excessive traffic from a single IP.

Anyway thanks for sharing, I hope to get some hacking time and implement
one of our extractors as a handler in clojure and take out Itsy for a spin.
:)

Las

2012/6/1 Michael Klishin 

> László Török:
>
> > I was wondering though how do you make sure two
> > crawlers do not crawl the same URL twice if there is no global state? :)
>
> By adding sharing state, for a single app instance, typically an atom. As
> for separating different instances,
> it is not uncommon to hash seed URLs (or domains) in such a way that two
> instances simply won't
> crawl the same site in parallel.
>
>
> > You may also consider using the sitemap as a source of urls per domain,
> > although this depends on the crawling policy.
>
> That does not work in practice. One reason is, sitemaps are often
> incomplete, out of date or missing
> completely. Another one, for most news websites and blogs, you will
> discover site structure a lot
> faster by frequently (within reason, of course) recrawling either first
> level pages or a seed of known
> "section" pages.
>
> There is a really good workshop on Web mining video from Strata Santa
> Clara 2012, it highlights two dozens
> more common problems you face when designing Web crawlers:
>
> http://my.safaribooksonline.com/video/-/9781449336172
>
> Highly recommended for people who are interested or work in this area (I
> think it can be purchased separately, O'Reilly Safari subscribers have
> access to the entire video set)
>
> I am by no means an expert (or even very experienced) in this area but
> Itsy has features that solve several very common
> problems out of the box in 0.1.0. Good job.
>
> MK
>
> --
> 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
>



-- 
László Török

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

2012-06-01 Thread Armando Blancas
That's the only way I've seen it done.

Cool source box; how did you get it?


On Friday, June 1, 2012 11:42:19 AM UTC-7, Jon Rose wrote:
>
> sorry, typo. My bluetooth keyboard is geeking out. I meant, is it possible 
> to do this with out using the Jave Reflection classes through interop. 
>
> On Friday, June 1, 2012 11:38:17 AM UTC-7, Jon Rose wrote:
>>
>> Hello,
>>
>> I am wondering if anyone knows how to get method annotations from a 
>> method using the clojure.reflect library. I am going of a Stuart Sierra 
>> poston
>>  Stack Overflow which gave me this
>>
>> user=> (pprint (reflect "hello"))
>> {:bases
>>  #{java.io.Serializable java.lang.Comparable java.lang.Object
>>java.lang.CharSequence},
>>  :flags #{:public :final},
>>  :members
>>  #{{:name valueOf,
>> :return-type java.lang.String,
>> :declaring-class java.lang.String,
>> :parameter-types [boolean],
>> :exception-types [],
>> :flags #{:static :public}}
>>
>>
>> which works great but I am also hoping to grab method comments. Is this 
>> possible with out using interop?
>>
>> thanks
>>
>> jon
>>
>
> On Friday, June 1, 2012 11:38:17 AM UTC-7, Jon Rose wrote:
>>
>> Hello,
>>
>> I am wondering if anyone knows how to get method annotations from a 
>> method using the clojure.reflect library. I going of a Stuart Sierra 
>> poston
>>  Stack Overflow which game me this
>>
>> user=> (pprint (reflect "hello"))
>> {:bases
>>  #{java.io.Serializable java.lang.Comparable java.lang.Object
>>java.lang.CharSequence},
>>  :flags #{:public :final},
>>  :members
>>  #{{:name valueOf,
>> :return-type java.lang.String,
>> :declaring-class java.lang.String,
>> :parameter-types [boolean],
>> :exception-types [],
>> :flags #{:static :public}}
>>
>>
>> which works great but I am also hoping to grab method comments. Is this 
>> possible with using interop?
>>
>> thanks
>>
>> jon
>>
>

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

2012-06-01 Thread Jon Rose
Cool thanks for the info. I just pasted the code snippet in from stack 
overflow so it must copy the styles too. 

On Friday, June 1, 2012 1:39:05 PM UTC-7, Armando Blancas wrote:
>
> That's the only way I've seen it done.
>
> Cool source box; how did you get it?
>
>
> On Friday, June 1, 2012 11:42:19 AM UTC-7, Jon Rose wrote:
>>
>> sorry, typo. My bluetooth keyboard is geeking out. I meant, is it 
>> possible to do this with out using the Jave Reflection classes through 
>> interop. 
>>
>> On Friday, June 1, 2012 11:38:17 AM UTC-7, Jon Rose wrote:
>>>
>>> Hello,
>>>
>>> I am wondering if anyone knows how to get method annotations from a 
>>> method using the clojure.reflect library. I am going of a Stuart Sierra 
>>> poston
>>>  Stack Overflow which gave me this
>>>
>>> user=> (pprint (reflect "hello"))
>>> {:bases
>>>  #{java.io.Serializable java.lang.Comparable java.lang.Object
>>>java.lang.CharSequence},
>>>  :flags #{:public :final},
>>>  :members
>>>  #{{:name valueOf,
>>> :return-type java.lang.String,
>>> :declaring-class java.lang.String,
>>> :parameter-types [boolean],
>>> :exception-types [],
>>> :flags #{:static :public}}
>>>
>>>
>>> which works great but I am also hoping to grab method comments. Is this 
>>> possible with out using interop?
>>>
>>> thanks
>>>
>>> jon
>>>
>>
>> On Friday, June 1, 2012 11:38:17 AM UTC-7, Jon Rose wrote:
>>>
>>> Hello,
>>>
>>> I am wondering if anyone knows how to get method annotations from a 
>>> method using the clojure.reflect library. I going of a Stuart Sierra 
>>> poston
>>>  Stack Overflow which game me this
>>>
>>> user=> (pprint (reflect "hello"))
>>> {:bases
>>>  #{java.io.Serializable java.lang.Comparable java.lang.Object
>>>java.lang.CharSequence},
>>>  :flags #{:public :final},
>>>  :members
>>>  #{{:name valueOf,
>>> :return-type java.lang.String,
>>> :declaring-class java.lang.String,
>>> :parameter-types [boolean],
>>> :exception-types [],
>>> :flags #{:static :public}}
>>>
>>>
>>> which works great but I am also hoping to grab method comments. Is this 
>>> possible with using interop?
>>>
>>> thanks
>>>
>>> jon
>>>
>>

-- 
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: using -> on a nested hash-map with string keywords.

2012-06-01 Thread Sean Corfield
On Fri, Jun 1, 2012 at 12:08 AM, Boris V. Schmid  wrote:
> Thanks, it was get-in that I was looking for, but couldn't find.

At this point I'll give a plug for http://clojureatlas.com as a great
way to explore the Clojure core/libraries by concept.
-- 
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


Re: When arithmetic on a computer bite back

2012-06-01 Thread kawas
I've checked with a python repl, the correct value seems to be the one
using BigDecs

>>> from decimal import *
>>> Decimal('1.4411518807585587E17') / Decimal(2)
Decimal('72057594037927935')

I've submitted a bug and commented on it about BigDecimal constructors
but I may have made a mistake about which value is the correct one...

Bye,
Laurent

On 1 juin, 19:21, Tassilo Horn  wrote:
> kawas  writes:
>
> Hi Laurent,
>
> > (defn prime-factors [n]
> >   (loop [f 2 n n res []]
> >     (cond
> >       (<= n 1) res
> >       (zero? (rem n f)) (recur f (quot n f) (conj res f))
> >       :else (recur (inc f) n res
>
> > Problem 1 (solved): If you use (= n 1) in the first cond clause, the
> > function may not terminate because (= 1 1.0) may be false. But we all
> > know that :)
>
> Use (== n 1) instead.
>
> > Problem 2: Now compare theses function calls
> > (prime-factors (Math/pow 2 58))
> > (prime-factors (bigdec (Math/pow 2 58)))
> > (prime-factors (bigint (bigdec (Math/pow 2 58
>
> > The last two function calls are really really slow.
> > - Is this only a problem of rem/quot slow on big numbers ?
>
> No, debugging it a bit it seems to be a bug in
> clojure.lang.Numbers.quotient() applied to BigDecs:
>
> user> (quot 1.4411518807585587E17 2)   ;; correct with doubles
> 7.2057594037927936E16
> user> (quot 1.4411518807585587E+17M 2) ;; wrong with BigDecs
> 72057594037927935M
>
> Please file a bug report about that.
>
> Bye,
> Tassilo

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