Hooking into doc and source

2013-01-31 Thread Phillip Lord

I'm build a library which provides a DSL for building ontologies.
Underneath this backs onto a Java API. The library works by provide some
macros, which create Java objects then intern them into the local
namespace. 

Now, I would like to be to support documentation and source code lookup.
The ideal way to do this would be to use clojure.repl/doc and source
functionality; I *think* in most cases this would mean that the various
development environments would just work with my DSL. 

With the documentation, I can just add this to the metadata. But there
is a problem; I also need this in the underlying Java objects, so that
when the ontology is serialised, all the documentation goes with it. So
now I have the documentation in two places. 

So, I really would like to hook into the doc function so that I can
return a documentation string pulled directly from the underlying Java
object; I already have a function for doing this, but do not know how to
get the native Clojure facilities to call this, rather than just take
the documentation directly from the metadata. 

Any suggestions gratefully recieved!

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: is intellij idea a good ide for clojure development?

2013-01-31 Thread Niels van Klaveren
Another vote for Eclipse/CCW over Netbeans and IntelliJ. I used all three, 
and CCW's development has proven to be consistently better than plugins for 
the other IDE's. Both CCW's excellent Leiningen and REPL support, as the 
option to link projects when working on multiple sources at the same time 
have proven to be indispensable.

As for Emacs, in my opinion you'd best get a good grip on Clojure 
development before taking on the whole new learning curve Emacs will pose. 
CCW's `strict` mode is almost on par with Emacs paredit, and will be when 
Barf/Slurp are introduced in the not too distant future.

On Monday, January 28, 2013 12:37:54 PM UTC+1, HamsterofDeath wrote:

 the only ides i have used so far for clojure are intellij idea and 
 netbeans. is there one that is a lot better? if yes, why?
 i am not interested in details or single features, i just want to know if 
 there is some magic editor out there that i should look into because it is 
 *obviously a lot* better - like in you should use an ide for java 
 development instead of notepad
  

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




multicore list processing (was Re: abysmal multicore performance, especially on AMD processors)

2013-01-31 Thread Chas Emerick
Keeping the discussion here would make sense, esp. in light of meetup.com's 
horrible discussion board.

I don't have a lot to offer on the JVM/Clojure-specific problem beyond what I 
wrote in that meetup thread, but Lee's challenge(s) were too hard to resist:

 Would your conclusion be something like 'Intensive list processing can't 
 currently be done in Java (or Clojure/JVM) in a way that takes reasonable 
 advantage of multiple cores.'?


 I see that rewrite without lists might be the only way out, but that'd be 
 a bummer. Clojure is a multicore Lisp; if you can't use it for multicore list 
 processing then... sigh.

The nature of the `burn` program is such that I'm skeptical of the ability of 
any garbage-collected runtime (lispy or not) to scale its operation across 
multiple threads.  It generates a huge amount of garbage that is held for a 
very long time (in GC terms), thus producing a great deal of contention on the 
heap between the active job threads and the GC implementation constantly having 
to clean up after them, compact the results, etc.  The workload is not 
CPU-bound, so I don't see it being parallelized effectively.

I'd be very interested in seeing an implementation for a runtime that proves me 
wrong, i.e. can attain significant performance benefits by running the e.g. 8 
`burn` jobs across multiple threads.

In an attempt to do just that (prove myself wrong), I thought I'd golf the 
`burn` program (again; onlookers can go look at the Java implementation I 
knocked out a few days ago here: https://gist.github.com/4682554) on Racket, 
presumably as well-suited to multicore list processing as any other.  The 
results:

https://gist.github.com/4682453

Please forgive my perhaps pitiful Racket-fu.  I'm sure there's threadpool and 
CAS libraries available, but it was entertaining to hack away with the 
threading and semaphore primitives.  If I've goofed something up badly (it's 
been some time since I've schemed), please speak up.

The Racket and Java implementations are effectively equivalent:

`java -server -Xmx2g cemerick.burn $THREAD_COUNT`  (oracle java 1.7.0_09)
1 thread: 61s
2 threads: 126s

`java -server -Xmx2g cemerick.burn $THREAD_COUNT`  (oracle java 1.7.0_09)
1 thread: 47s
2 threads: 92s

`time ./racket -t ~/burn.scm -m $THREAD_COUNT`  (racket 5.3.1)
1 thread: 45s
2 threads: 126s

The above was run on OS X 10.7.5 with 4GB of physical memory.  If someone knows 
of ways to get better perf on racket, let me know.  I tried running from the 
results of `raco make` and such, but saw no improvements; I guess it is 
strictly producing bytecode that is later JIT'ed, and not doing any kind of 
additional AOT optimizations...

It'd be interesting to see timings from different operating systems, and very 
interesting to see timings from running burn.scm on other schemes, or a Common 
Lisp implementation and timings.

Cheers,

- Chas

On Jan 30, 2013, at 9:20 PM, Lee Spector wrote:

 
 FYI we had a bit of a discussion about this at a meetup in Amherst MA 
 yesterday, and while I'm not sufficiently on top of the JVM or system issues 
 to have briefed everyone on all of the details there has been a little of 
 followup since the discussion, including results of some different 
 experiments by Chas Emerick, at: 
 http://www.meetup.com/Functional-Programming-Connoisseurs/messages/boards/thread/30946382
 
 -Lee
 
 On Jan 30, 2013, at 8:39 PM, Marshall Bockrath-Vandegrift wrote:
 
 Apologies for my very-slow reply here.  I keep thinking that I’ll have
 more time to look into this issue, and keep having other things
 requiring my attention.  And on top of that, I’ve temporarily lost the
 many-way AMD system I was using as a test-bed.
 
 I very much want to see if I can get my hands on an Intel system to
 compare to.  My AMD system is in theory 32-way – two physical CPUs, each
 with 16 cores.  However, Linux reports (via /proc/cpuinfo) the cores in
 groups of 8 (“cpu cores : 8” etc).  And something very strange happens
 when extending parallelism beyond 8-way...  I ran several experiments
 using a version of your whole-application benchmark I modified to
 control the level of parallelism.  At parallelism 9+, the real time it
 takes to complete the benchmark hardly budges, but the user/CPU time
 increases linearly with the level of parallelism!  As far as I can tell,
 multi-processor AMD *is* a NUMA architecture, which might potentially
 explain things.  But enabling the JVM NUMA options doesn’t seem to
 affect the benchmark.
 
 I think next steps are two-fold: (1) examine parallelism vs real  CPU
 time on an Intel system, and (2) attempt to reproduce the observed
 behavior in pure Java.  I’m keeping my fingers crossed that I’ll have
 some time to look at this more soon, but I’m honestly not very hopeful.
 
 In the mean time, I hope you’ve managed to exploit multi-process
 parallelism to run more efficiently?
 
 -Marshall
 
 -- 
 -- 
 You received this message because you are subscribed 

Clojure 1.5 RC 4 wants to be Clojure 1.5

2013-01-31 Thread Stuart Halloway
Clojure 1.5 RC 4 is now available via Maven Central:

http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22clojure%22%20AND%20v%3A1.5.0*

Please test 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: multicore list processing (was Re: abysmal multicore performance, especially on AMD processors)

2013-01-31 Thread Marshall Bockrath-Vandegrift
Chas Emerick c...@cemerick.com writes:

 Keeping the discussion here would make sense, esp. in light of
 meetup.com's horrible discussion board.

Excellent.  Solves the problem of deciding the etiquette of jumping on
the meetup board for a meetup one has never been involved in.  :-)

 The nature of the `burn` program is such that I'm skeptical of the
 ability of any garbage-collected runtime (lispy or not) to scale its
 operation across multiple threads.

Bringing you up to speed on this very long thread, I don’t believe the
original `burn` benchmark is a GC issue, due to results cameron first
reported here:

https://groups.google.com/d/msg/clojure/48W2eff3caU/83uXZjLi3iAJ

I that narrowed to what I still believe to be the explanation here:

https://groups.google.com/d/msg/clojure/48W2eff3caU/jd8dpmzEtEYJ

And have more compact demonstration benchmark results here:

https://groups.google.com/d/msg/clojure/48W2eff3caU/tCCkjXxTUMEJ

I haven’t been able to produce those results in a minimal Java-only test
case, though.

Then Wm. Josiah posted a full-application benchmark, which appears to
have entirely different performance problems from the synthetic `burn`
benchmark.  I’d rejected GC as the cause for the slowdown there too, but
ATM can’t recall why or what I tested, so GC may definitely be a
candidate to re-examine:

https://groups.google.com/d/msg/clojure/48W2eff3caU/K224Aqwkn5YJ

Quite looking forward to additional insight...

-Marshall

-- 
-- 
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: is intellij idea a good ide for clojure development?

2013-01-31 Thread Laurent PETIT
2013/1/31 Niels van Klaveren niels.vanklave...@gmail.com:
 Another vote for Eclipse/CCW over Netbeans and IntelliJ. I used all three,
 and CCW's development has proven to be consistently better than plugins for
 the other IDE's. Both CCW's excellent Leiningen and REPL support, as the
 option to link projects when working on multiple sources at the same time
 have proven to be indispensable.

 As for Emacs, in my opinion you'd best get a good grip on Clojure
 development before taking on the whole new learning curve Emacs will pose.
 CCW's `strict` mode is almost on par with Emacs paredit, and will be when
 Barf/Slurp are introduced in the not too distant future.

which will in fact be the next release, since Tom Hickey added it and
the push request has been issued !



 On Monday, January 28, 2013 12:37:54 PM UTC+1, HamsterofDeath wrote:

 the only ides i have used so far for clojure are intellij idea and
 netbeans. is there one that is a lot better? if yes, why?
 i am not interested in details or single features, i just want to know if
 there is some magic editor out there that i should look into because it is
 *obviously a lot* better - like in you should use an ide for java
 development instead of notepad

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



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




Re: multicore list processing (was Re: abysmal multicore performance, especially on AMD processors)

2013-01-31 Thread Chas Emerick
On Jan 31, 2013, at 9:23 AM, Marshall Bockrath-Vandegrift wrote:

 Chas Emerick c...@cemerick.com writes:
 
 The nature of the `burn` program is such that I'm skeptical of the
 ability of any garbage-collected runtime (lispy or not) to scale its
 operation across multiple threads.
 
 Bringing you up to speed on this very long thread, I don’t believe the
 original `burn` benchmark is a GC issue, due to results cameron first
 reported here:
 
https://groups.google.com/d/msg/clojure/48W2eff3caU/83uXZjLi3iAJ
 
 I that narrowed to what I still believe to be the explanation here:
 
https://groups.google.com/d/msg/clojure/48W2eff3caU/jd8dpmzEtEYJ
 
 And have more compact demonstration benchmark results here:
 
https://groups.google.com/d/msg/clojure/48W2eff3caU/tCCkjXxTUMEJ
 
 I haven’t been able to produce those results in a minimal Java-only test
 case, though.
 
 Then Wm. Josiah posted a full-application benchmark, which appears to
 have entirely different performance problems from the synthetic `burn`
 benchmark.  I’d rejected GC as the cause for the slowdown there too, but
 ATM can’t recall why or what I tested, so GC may definitely be a
 candidate to re-examine:
 
https://groups.google.com/d/msg/clojure/48W2eff3caU/K224Aqwkn5YJ
 
 Quite looking forward to additional insight...

Yeah, the thread is far too large for me to reasonably digest (and there's 
inevitably a lot of noise in rounds of microbenchmarking golf ;-)

BTW, I just realized I copy/pasted the wrong command for the faster of the Java 
implementation benchmarks in the previous mail; it used -XX:-UseParallelGC:

`java -server -Xmx2g -XX:-UseParallelGC cemerick.burn $THREAD_COUNT`

I've not looked at clojush at all; it is AFAICT a complex application in its 
own right, and I wouldn't know where to start.  My understanding is that the 
`burn` function is considered representative of the bulk of operations in 
clojush, but I'm happy to assume that that's not the case.  There's likely a 
number of things that go into the results of the `burn` benchmark, nevermind 
the apparent performance of clojush.

Here's what I know:

* Two separate implementations (Java and Racket) exhibit very similar multicore 
performance characteristics.  In particular, the Java implementation would not 
suffer from any particular megamorphic inefficiencies, since no such calls are 
made in that program.  Racket is far more of a black box to me than the JVM, 
but it does not provide much of any polymorphism at all, so JIT-related issues 
are presumably not in scope there.

* Broadly speaking, heap allocation and its evil twin, GC, sabotages 
parallelism and performance in general.  Functional programming with immutable 
values has been made possible in large part by the gains registered by 
persistent data structures, structural sharing, lazy evaluation, and so on; 
without them, we're back to copy-on-write, which is roughly what `burn` 
represents in grand style.

Now, all this digital ink spilled, and just for kicks, I go back to run the 
Clojure `burn` again (https://gist.github.com/4683413 in a 1.5.0-RC2 REPL 
started with jvm args of `-Xmx2g -XX:-UseParallelGC`):

1 thread: 38s
2 threads: 32s
4 threads: 23s

Hardly a 2x or 4x improvement, but I had previously obtained badly degrading 
timings corresponding to those in my previous mail.  Microbenchmarking sucks.   
At least I got to twiddle with Racket again.  :-P

Cheers,

- Chas

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




ANN Spyglass 1.1.0-beta2

2013-01-31 Thread Michael Klishin
Spyglass is a very fast Clojure client for Memcached
(as well as Couchbase and Kestrel) built on top of SpyMemcached.

Release notes:
http://blog.clojurewerkz.org/blog/2013/01/31/spyglass-1-dot-1-0-beta2-is-released/
-- 
MK

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

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




Re: GSOC 2013 projects?

2013-01-31 Thread Dmitry Groshev
I would really like to try to participate this year too. I was thinking 
about porting ClojureScript to ErlangVM (BEAM); not in fully compatible 
with standard JS-CLJS way, I think, but at least as an alternative 
language for BEAM. There is a clear lack of decent language for hard 
problems now in Erlang ecosystem; I'm not sure if this is a solution, but 
maybe CLJS over BEAM can be a way to go.

On Thursday, January 31, 2013 1:35:58 AM UTC+4, Omer Iqbal wrote:

 Hey folks,
 Even though  it hasn't been announced yet, I was wondering about project 
 ideas for this year's GSOC. I was looking at a few projects from last year, 
 which seemed pretty interesting. 
 Is there any official list btw?
 *I'm rather enthusiastic about taking part this summer :D*
 (cheers)
 Omer


-- 
-- 
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: screencast: friend and creating a login form

2013-01-31 Thread Timothy Washington
Wow, this is great. And it came just in time, as I want to use compojure +
friend + an account chooser (accountchooser.com). Account Chooser uses
OpenID in the background, so hopefully I can use that friend workflow out
of the box. But if anyone's had experience with friend + accountchooser,
I'd love to know more.

Keep up the awesome screencasts :)

Tim

-- 
-- 
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: multicore list processing (was Re: abysmal multicore performance, especially on AMD processors)

2013-01-31 Thread Lee Spector

On Jan 31, 2013, at 10:15 AM, Chas Emerick wrote:
 
 Then Wm. Josiah posted a full-application benchmark, which appears to
 have entirely different performance problems from the synthetic `burn`
 benchmark.  I’d rejected GC as the cause for the slowdown there too, but
 ATM can’t recall why or what I tested, so GC may definitely be a
 candidate to re-examine:
 
 
 I've not looked at clojush at all; it is AFAICT a complex application in its 
 own right, and I wouldn't know where to start.  My understanding is that the 
 `burn` function is considered representative of the bulk of operations in 
 clojush, but I'm happy to assume that that's not the case.  There's likely a 
 number of things that go into the results of the `burn` benchmark, nevermind 
 the apparent performance of clojush.

FWIW I wrote the burn benchmark because lots of intensive list manipulation 
is at the heart of our real applications, and that seemed to be a nicely 
minimal way to see how that could scale across cores.

Our real applications may indeed raise other issues too, but getting lots of 
intensive list manipulation to scale well is bound to be good.

FWIW the full-application benchmark that Josiah posted was made deterministic 
in a way that means that big chunks of our code won't actually be executing. 
The system generates and interprets lots of Push programs, and if I recall 
correctly the benchmark hardcodes all of the Push programs to be the same 
constant program, meaning that not all of the Push instructions will run, etc. 
It'd be trickier to get the real mix of instructions in a way that makes for 
an easily reproducible benchmark, and this benchmark is at least testing the 
basic interpreter and population-level infrastructure. If we can get this to 
scale reasonably then we could try to see how much that helps under 
more-completely real conditions.

 -Lee

-- 
-- 
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: GSOC 2013 projects?

2013-01-31 Thread David Nolen
I helped manage the process last year. It's not a small amount of work. I
don't think I have the time to put into it this year, though I'd be willing
to be a mentor.

Anybody want to step forward and lead that process?

David


On Thu, Jan 31, 2013 at 10:23 AM, Dmitry Groshev lambdadmi...@gmail.comwrote:

 I would really like to try to participate this year too. I was thinking
 about porting ClojureScript to ErlangVM (BEAM); not in fully compatible
 with standard JS-CLJS way, I think, but at least as an alternative
 language for BEAM. There is a clear lack of decent language for hard
 problems now in Erlang ecosystem; I'm not sure if this is a solution, but
 maybe CLJS over BEAM can be a way to go.


 On Thursday, January 31, 2013 1:35:58 AM UTC+4, Omer Iqbal wrote:

 Hey folks,
 Even though  it hasn't been announced yet, I was wondering about project
 ideas for this year's GSOC. I was looking at a few projects from last year,
 which seemed pretty interesting.
 Is there any official list btw?
 *I'm rather enthusiastic about taking part this summer :D*
 (cheers)
 Omer

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




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




Re: Hooking into doc and source

2013-01-31 Thread Brian Marick

On Jan 31, 2013, at 5:50 AM, Phillip Lord phillip.l...@newcastle.ac.uk wrote:
 So, I really would like to hook into the doc function so that I can
 return a documentation string pulled directly from the underlying Java
 object; I already have a function for doing this, but do not know how to
 get the native Clojure facilities to call this, rather than just take
 the documentation directly from the metadata. 


Could you wrap clojure.repl/print-doc using something like Robert Hooke? 
https://github.com/technomancy/robert-hooke


Looking for 1/2-time employment as a Clojure programmer
Latest book: /Functional Programming for the Object-Oriented Programmer/
https://leanpub.com/fp-oo

-- 
-- 
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 error: : Could not find or load main class –jar

2013-01-31 Thread larry google groups
I wrote a small Clojure app (1.4) and then bundled it up with lein 
uberjar. This app uses Ring and Jetty so it handles the webserver itself. 

On my local machine, a Macintosh, in the terminal, I can start it with:

java -jar kiosk.clj 3

This works fine. 

I also moved to another server, running Centos, and I used yum install to 
install a JVM and then I again did: 

java -jar kiosk.clj 3

and that worked fine.

Then I gave the app to the sysadmin, and he tried to spin it up on another 
server, and on startup he got the error:

Could not find or load main class –jar

What does this mean? 



-- 
-- 
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: the semantic of if-let macro

2013-01-31 Thread Stuart Halloway
The docs are clear that the test occurs before the bindings:

(doc if-let)
-
clojure.core/if-let
([bindings then] [bindings then else  oldform])
Macro
  bindings = binding-form test

  If test is true, evaluates then with binding-form bound to the value of
  test, if not, yields else

Cheers,
Stu


On Thu, Jan 31, 2013 at 2:43 AM, Mimmo Cosenza mimmo.cose...@gmail.comwrote:


 On Thursday, January 31, 2013 1:49:40 AM UTC+1, Sean Corfield wrote:

 but now that you've posted this, I
 can see some potential for confusion when folks first encounter
 if-let... Presumably the same confusion could arise for when-let?


 yes, this is the confusion that you can incur in.

 mimmo

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




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




Re: strange error: : Could not find or load main class –jar

2013-01-31 Thread larry google groups
This does not seem to apply:

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

I suspect you're missing a :gen-class declaration in src/cljmx/core.clj.

But this is what I have:

(ns kiosks-clojure.core
  (:gen-class)
  (:import
   (java.net URL)
   (java.io ByteArrayInputStream)
   (org.apache.commons.mail SimpleEmail)
   (org.apache.commons.mail HtmlEmail)
   (java.text SimpleDateFormat))


Again, this worked fine on my local machine, and also on another server 
that the company gave me, but when I give it to the sysadmin, he gets the 
error. Perhaps this has something to do with the classpath? In the past, I 
was always the one to install the jvm, and I ran the uberjars from my 
directory. But maybe something needs to be made more specific for a 
sysadmin to run this in any directory they like? 





W dniu czwartek, 31 stycznia 2013 13:06:26 UTC-5 użytkownik larry google 
groups napisał:

 I wrote a small Clojure app (1.4) and then bundled it up with lein 
 uberjar. This app uses Ring and Jetty so it handles the webserver itself. 

 On my local machine, a Macintosh, in the terminal, I can start it with:

 java -jar kiosk.clj 3

 This works fine. 

 I also moved to another server, running Centos, and I used yum install 
 to install a JVM and then I again did: 

 java -jar kiosk.clj 3

 and that worked fine.

 Then I gave the app to the sysadmin, and he tried to spin it up on another 
 server, and on startup he got the error:

 Could not find or load main class -jar

 What does this mean? 





-- 
-- 
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 error: : Could not find or load main class –jar

2013-01-31 Thread larry google groups
More info about my problem:

java version 1.7.0_11

Java(TM) SE Runtime Environment (build 1.7.0_11-b21)

Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)




W dniu czwartek, 31 stycznia 2013 13:19:34 UTC-5 użytkownik larry google 
groups napisał:

 This does not seem to apply:

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

 I suspect you're missing a :gen-class declaration in src/cljmx/core.clj.

 But this is what I have:

 (ns kiosks-clojure.core
   (:gen-class)
   (:import
(java.net URL)
(java.io ByteArrayInputStream)
(org.apache.commons.mail SimpleEmail)
(org.apache.commons.mail HtmlEmail)
(java.text SimpleDateFormat))


 Again, this worked fine on my local machine, and also on another server 
 that the company gave me, but when I give it to the sysadmin, he gets the 
 error. Perhaps this has something to do with the classpath? In the past, I 
 was always the one to install the jvm, and I ran the uberjars from my 
 directory. But maybe something needs to be made more specific for a 
 sysadmin to run this in any directory they like? 





 W dniu czwartek, 31 stycznia 2013 13:06:26 UTC-5 użytkownik larry google 
 groups napisał:

 I wrote a small Clojure app (1.4) and then bundled it up with lein 
 uberjar. This app uses Ring and Jetty so it handles the webserver itself. 

 On my local machine, a Macintosh, in the terminal, I can start it with:

 java -jar kiosk.clj 3

 This works fine. 

 I also moved to another server, running Centos, and I used yum install 
 to install a JVM and then I again did: 

 java -jar kiosk.clj 3

 and that worked fine.

 Then I gave the app to the sysadmin, and he tried to spin it up on 
 another server, and on startup he got the error:

 Could not find or load main class -jar

 What does this mean? 





-- 
-- 
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: GSOC 2013 projects?

2013-01-31 Thread Daniel Solano Gómez
On Thu Jan 31 11:52 2013, David Nolen wrote:
 I helped manage the process last year. It's not a small amount of work. I
 don't think I have the time to put into it this year, though I'd be willing
 to be a mentor.
 
 Anybody want to step forward and lead that process?

I'd be happy to give it a go.  I thought it was a really good experience
last year, and I'd love to see Clojure participate again.

Sincerely,

Daniel


signature.asc
Description: Digital signature


Re: Hooking into doc and source

2013-01-31 Thread Hugo Duncan
phillip.l...@newcastle.ac.uk (Phillip Lord) writes:

 I'm build a library which provides a DSL for building ontologies.
 Underneath this backs onto a Java API. The library works by provide some
 macros, which create Java objects then intern them into the local
 namespace. 

 With the documentation, I can just add this to the metadata. But there
 is a problem; I also need this in the underlying Java objects, so that
 when the ontology is serialised, all the documentation goes with it. So
 now I have the documentation in two places. 

Could you initialise the var metadata using the docstring pulled from
the java object. You would probably need your macros to generate
alter-var-root forms to add the metadata.

Hugo

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




Re: strange error: : Could not find or load main class –jar

2013-01-31 Thread larry google groups

Any suggestion, no matter how far fetched, will be welcome. I am ignorant 
about the JVM so I am having trouble debugging this problem. 



W dniu czwartek, 31 stycznia 2013 13:22:20 UTC-5 użytkownik larry google 
groups napisał:

 More info about my problem:

 java version 1.7.0_11

 Java(TM) SE Runtime Environment (build 1.7.0_11-b21)

 Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)




 W dniu czwartek, 31 stycznia 2013 13:19:34 UTC-5 użytkownik larry google 
 groups napisał:

 This does not seem to apply:

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

 I suspect you're missing a :gen-class declaration in src/cljmx/core.clj
 .

 But this is what I have:

 (ns kiosks-clojure.core
   (:gen-class)
   (:import
(java.net URL)
(java.io ByteArrayInputStream)
(org.apache.commons.mail SimpleEmail)
(org.apache.commons.mail HtmlEmail)
(java.text SimpleDateFormat))


 Again, this worked fine on my local machine, and also on another server 
 that the company gave me, but when I give it to the sysadmin, he gets the 
 error. Perhaps this has something to do with the classpath? In the past, I 
 was always the one to install the jvm, and I ran the uberjars from my 
 directory. But maybe something needs to be made more specific for a 
 sysadmin to run this in any directory they like? 





 W dniu czwartek, 31 stycznia 2013 13:06:26 UTC-5 użytkownik larry google 
 groups napisał:

 I wrote a small Clojure app (1.4) and then bundled it up with lein 
 uberjar. This app uses Ring and Jetty so it handles the webserver itself. 

 On my local machine, a Macintosh, in the terminal, I can start it with:

 java -jar kiosk.clj 3

 This works fine. 

 I also moved to another server, running Centos, and I used yum install 
 to install a JVM and then I again did: 

 java -jar kiosk.clj 3

 and that worked fine.

 Then I gave the app to the sysadmin, and he tried to spin it up on 
 another server, and on startup he got the error:

 Could not find or load main class -jar

 What does this mean? 





-- 
-- 
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 error: : Could not find or load main class –jar

2013-01-31 Thread larry google groups

I am using wrap-resource instead of wrap-file. Could that cause some issues 
with the path? (And, is this a path issue?)

(def app
  (- app-routes
  (wrap-resource public)
  (wrap-session {:cookie-name timeout-discovery-session :cookie-attrs 
{:max-age 1 }})
  (wrap-cookies)
  (wrap-keyword-params)
  (wrap-nested-params)
  (wrap-params)))




W dniu czwartek, 31 stycznia 2013 15:01:07 UTC-5 użytkownik larry google 
groups napisał:


 Any suggestion, no matter how far fetched, will be welcome. I am ignorant 
 about the JVM so I am having trouble debugging this problem. 



 W dniu czwartek, 31 stycznia 2013 13:22:20 UTC-5 użytkownik larry google 
 groups napisał:

 More info about my problem:

 java version 1.7.0_11

 Java(TM) SE Runtime Environment (build 1.7.0_11-b21)

 Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)




 W dniu czwartek, 31 stycznia 2013 13:19:34 UTC-5 użytkownik larry google 
 groups napisał:

 This does not seem to apply:

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

 I suspect you're missing a :gen-class declaration in src/cljmx/core.clj
 .

 But this is what I have:

 (ns kiosks-clojure.core
   (:gen-class)
   (:import
(java.net URL)
(java.io ByteArrayInputStream)
(org.apache.commons.mail SimpleEmail)
(org.apache.commons.mail HtmlEmail)
(java.text SimpleDateFormat))


 Again, this worked fine on my local machine, and also on another server 
 that the company gave me, but when I give it to the sysadmin, he gets the 
 error. Perhaps this has something to do with the classpath? In the past, I 
 was always the one to install the jvm, and I ran the uberjars from my 
 directory. But maybe something needs to be made more specific for a 
 sysadmin to run this in any directory they like? 





 W dniu czwartek, 31 stycznia 2013 13:06:26 UTC-5 użytkownik larry google 
 groups napisał:

 I wrote a small Clojure app (1.4) and then bundled it up with lein 
 uberjar. This app uses Ring and Jetty so it handles the webserver itself. 

 On my local machine, a Macintosh, in the terminal, I can start it with:

 java -jar kiosk.clj 3

 This works fine. 

 I also moved to another server, running Centos, and I used yum 
 install to install a JVM and then I again did: 

 java -jar kiosk.clj 3

 and that worked fine.

 Then I gave the app to the sysadmin, and he tried to spin it up on 
 another server, and on startup he got the error:

 Could not find or load main class -jar

 What does this mean? 





-- 
-- 
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 error: : Could not find or load main class –jar

2013-01-31 Thread Marko Topolnik
The java command is interpreting -jar as the name of a class instead of a 
command-line option. Something is messed up in the way the command is 
executed in your sysadmin's context.

On Thursday, January 31, 2013 9:01:07 PM UTC+1, larry google groups wrote:


 Any suggestion, no matter how far fetched, will be welcome. I am ignorant 
 about the JVM so I am having trouble debugging this problem. 



 W dniu czwartek, 31 stycznia 2013 13:22:20 UTC-5 użytkownik larry google 
 groups napisał:

 More info about my problem:

 java version 1.7.0_11

 Java(TM) SE Runtime Environment (build 1.7.0_11-b21)

 Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)




 W dniu czwartek, 31 stycznia 2013 13:19:34 UTC-5 użytkownik larry google 
 groups napisał:

 This does not seem to apply:

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

 I suspect you're missing a :gen-class declaration in src/cljmx/core.clj
 .

 But this is what I have:

 (ns kiosks-clojure.core
   (:gen-class)
   (:import
(java.net URL)
(java.io ByteArrayInputStream)
(org.apache.commons.mail SimpleEmail)
(org.apache.commons.mail HtmlEmail)
(java.text SimpleDateFormat))


 Again, this worked fine on my local machine, and also on another server 
 that the company gave me, but when I give it to the sysadmin, he gets the 
 error. Perhaps this has something to do with the classpath? In the past, I 
 was always the one to install the jvm, and I ran the uberjars from my 
 directory. But maybe something needs to be made more specific for a 
 sysadmin to run this in any directory they like? 





 W dniu czwartek, 31 stycznia 2013 13:06:26 UTC-5 użytkownik larry google 
 groups napisał:

 I wrote a small Clojure app (1.4) and then bundled it up with lein 
 uberjar. This app uses Ring and Jetty so it handles the webserver itself. 

 On my local machine, a Macintosh, in the terminal, I can start it with:

 java -jar kiosk.clj 3

 This works fine. 

 I also moved to another server, running Centos, and I used yum 
 install to install a JVM and then I again did: 

 java -jar kiosk.clj 3

 and that worked fine.

 Then I gave the app to the sysadmin, and he tried to spin it up on 
 another server, and on startup he got the error:

 Could not find or load main class -jar

 What does this mean? 





-- 
-- 
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 error: : Could not find or load main class –jar

2013-01-31 Thread Marshall Bockrath-Vandegrift
larry google groups lawrencecloj...@gmail.com writes:

 Any suggestion, no matter how far fetched, will be welcome. I am
 ignorant about the JVM so I am having trouble debugging this problem. 

 java -jar kiosk.clj 3

These are weird (.clj vs .jar), but since you say whatever you actually
ran worked...

 Then I gave the app to the sysadmin, and he tried to spin
 it up on another server, and on startup he got the error:
 
 Could not find or load main class –jar

I’m guessing encoding error.  In fact, if that error is a direct
copy-paste from either the exact error or what you sent the sysadmin, it
completely explains it.  Your `-` character in `-jar` above is in fact
`-` (en-dash), which is causing `java` to search the classpath for a
class named `–jar`.

-Marshall

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




extended mode for format strings?

2013-01-31 Thread Rich Morin
Looking at complicated format strings (in cl-format) such as:

  ~:~:@{[~25s ~30s]~:^~:@_~}~:

I'm struck with a desire to break up the string, comment it, etc.  In fact, in
http://wiki.cfcl.com/bin/view/Projects/Clojure/CP_pprint, I did so:

  ~:~:@{[~25s ~30s]~:^~:@_~}~:  ; the entire format string
   ~:~:   ; creates a logical block
  ~:@{  ~}  ; iterates through the vectors in the list
  [ ]   ; creates a pair of literal brackets
   ~25s ~30s; creates a pair of fixed-width columns
 ~:^; breaks the iteration on the last pair
~:@_; creates a mandatory newline


This works OK as an expository format, but it seems a bit picky and inflexible
(ie, placement of white space is critical).  It might also be hard to parse.


Perl Regular expressions can be written in an extended mode where white space
(including comments) is ignored.  Something like this might work for cl-format,
using ~w to generate white space:

  (def fmt (em 
~: ~:@{   ; create logical block, iterate through list
[ ~25s ~w ~30s ]   ; create bracketed, fixed-width columns
~:^ ~:@_   ; break iteration, create mandatory newline
~} ~: ; close out iteration and logical block
  ))

However, I'm not convinced that this is the ideal syntax.  Suggestions?

-r

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

Software system design, development, and documentation


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




Re: strange error: : Could not find or load main class –jar

2013-01-31 Thread larry google groups
 java -jar kiosk.clj 3 

 These are weird (.clj vs .jar), but since you say whatever you 
 actually ran worked... 


Apologies. I re-typed and stupidly typed clj. But what I sent to the 
sysadmin was a copy and paste of what I had used in my terminal to get the 
app running. 

I like your idea about the encoding error. He is about to test that idea. 



W dniu czwartek, 31 stycznia 2013 15:16:37 UTC-5 użytkownik Marshall 
Bockrath-Vandegrift napisał:

 larry google groups lawrenc...@gmail.com javascript: writes: 

  Any suggestion, no matter how far fetched, will be welcome. I am 
  ignorant about the JVM so I am having trouble debugging this problem.  

  java -jar kiosk.clj 3 

 These are weird (.clj vs .jar), but since you say whatever you actually 
 ran worked... 

  Then I gave the app to the sysadmin, and he tried to spin 
  it up on another server, and on startup he got the error: 
  
  Could not find or load main class -jar 

 I'm guessing encoding error.  In fact, if that error is a direct 
 copy-paste from either the exact error or what you sent the sysadmin, it 
 completely explains it.  Your `-` character in `-jar` above is in fact 
 `-` (en-dash), which is causing `java` to search the classpath for a 
 class named `-jar`. 

 -Marshall 



-- 
-- 
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 error: : Could not find or load main class –jar

2013-01-31 Thread larry google groups
 I'm guessing encoding error.  In fact, if that error is a direct 
 copy-paste from either the exact error or what you sent the sysadmin, it 
 completely explains it.  Your `-` character in `-jar` above is in fact 
`-` (en-dash), which is causing `java` to search the classpath 
 for a class named `-jar`. 


Good lord, you were correct! We re-typed it at the terminal and everything 
worked great. Very perceptive, that you figured that out. I would not have 
guessed that error even if I had one million years to figure out the 
problem.







W dniu czwartek, 31 stycznia 2013 15:16:37 UTC-5 użytkownik Marshall 
Bockrath-Vandegrift napisał:

 larry google groups lawrenc...@gmail.com javascript: writes: 

  Any suggestion, no matter how far fetched, will be welcome. I am 
  ignorant about the JVM so I am having trouble debugging this problem.  

  java -jar kiosk.clj 3 

 These are weird (.clj vs .jar), but since you say whatever you actually 
 ran worked... 

  Then I gave the app to the sysadmin, and he tried to spin 
  it up on another server, and on startup he got the error: 
  
  Could not find or load main class -jar 

 I'm guessing encoding error.  In fact, if that error is a direct 
 copy-paste from either the exact error or what you sent the sysadmin, it 
 completely explains it.  Your `-` character in `-jar` above is in fact 
 `-` (en-dash), which is causing `java` to search the classpath for a 
 class named `-jar`. 

 -Marshall 



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




clojure web developer job offer

2013-01-31 Thread Vagif Verdi
Our company is looking for a full time or consultant developer.

The job is to maintain and continue actively develop web application / 
internal webservices written in clojure.

We use compojure web framework, darcs for repository.

Remote work via ssh is ok.

Haskell knowledge is a big plus. We have internal web services written in 
haskell.

We are located in San Dimas, CA. But relocation is not necessary.

Requirements: good grasp of functional programming, at least one year of 
production coding with clojure or haskell.

Contact me if intrested.

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




(into [] (take n v)) vs (subvec v 0 n)

2013-01-31 Thread Don Jackson

In the app I am working on, I have a number of  pre-computed,cached 
collections, 
and for each collection, I have an accessor function that returns either the 
entire collection or the first n elements.

Currently the underlying collection is a vector, so I had something like this:

(defn foo-accessor
  ([] foo-vector)
  ([n] (take n foo-vector)))

It occurred to me that take returns a list, and so the type returned by my 
accessor was dependent on how it was called,
I thought I would change that, and remembered subvec, so I substituted in 
subvec for take, like this:

([n] (subvec foo-vector 0 n))

That worked great until ( (count foo-vector) n), and I got an 
IndexOutOfBoundsException

So, then without thinking much, I wrote 

(defn  subvec-safe
  subvec fails if you specify an end that is greater than count.  This version 
checks that, and DoesTheRightThing!
  ([v start]
 (subvec v start))
  ([v start end]
 (if ( (count v)
end)
   (subvec v
   start
   end)
   (subvec v
   start
   (count v)

(Yes, it is safe ONLY for the end value…)

And
(defn takev
   take for a vector, returns a subvec or the vector itself. Uses subvec-safe 
so specifying a n longer than (count v) works
   [n vec]
   (subvec-safe vec
0
n))

Even before finishing takev, it occurred to me that

(defn- takev
  take for a vector
  [n vec]
  (into []
(take n
  vec)))

Might be easier/faster. 

subvec returns a clojure.lang.APersistentVector$SubVector

whereas (into [] (take …)) returns a vector.

Any thoughts on which of the above is better?

Thanks,

Don



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




How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-01-31 Thread Leandro Moreira


The problem is known as Collatz Conjecture (also 3n + 1 conjecture).
Basically given a n number then you apply the following rule.

If n is even then n/2 otherwise 3 * n + 1, you keep applying this until you 
reach the number 1.
For instance, starting with *n = 6*, one gets the sequence 6, 3, 10, 5, 16, 8, 
4, 2, 1. (with *8 items*)

Now the challenge tell the *n* with n descending from 100 to 1 and with the 
*greater number of items*.

Then I did the program bellow (I'm very happy for feedback since I'm totally 
noobie to clj), but it takes forever, there is anyway to make it fast?

(defn- apply-collatz-conjecture 
Given n, it returns n/2 if it's even or n*3+1 if it's odd.
[n]
(if (even? n)
(/ n 2)
(+ (* 3 n) 1)))
 
(defn- collatz-conjecture-seq
Given n, it returns the sequence of collatz-conjecture.
[n]
(loop [n n sequence []]
(if (not= n 1)
(recur (apply-collatz-conjecture n) (cons 
(apply-collatz-conjecture n) sequence))
(reverse sequence
 
(defn- collatz-conjecture-number-of-items
It returns a map with n and number of items on its collatz-conjecture 
sequence.
[n]
{ :n n :count (count (collatz-conjecture-seq n)) } )
 
(defn- greater 
Given x and y, it returns the element with greater count.
[x y]
(if ( (:count x) (:count y))
x
y))
 
(defn n-with-more-items
Given n, it applies collatz-conjecture for the range 1..n 
and return the n with more items.
[n]
(reduce greater (pmap collatz-conjecture-number-of-items (range 1 n


The only thing I thought was use pmap but it didn't make it super fast.

*Using only map*
user= (time (n-with-more-items  99))
Elapsed time: *21191.762883 msecs*
{:n 837799, :count 524}

*Using pmap*
user= (time (n-with-more-items  99))
Elapsed time: *13230.919979 msecs*
{:n 837799, :count 524}

Any thoughts on how can I apply parallelism to solve this (especially on 
my frustrate try of use map and reduce)?

-- 
-- 
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: *read-eval* vulnerability

2013-01-31 Thread Chas Emerick

On Jan 30, 2013, at 5:59 PM, Michał Marczyk wrote:

 On 30 January 2013 23:32, Chas Emerick c...@cemerick.com wrote:
 On Jan 30, 2013, at 12:23 PM, Michael Fogus wrote:
 
 RuntimeException EvalReader not allowed when *read-eval* is false.
 
 The problem is that the second eval gets (the actual + function 1 2
 3) which invokes the right pathway triggering the exception.  You can
 trigger the same exception by:
 
 (binding [*read-eval* false] (eval (list + 1 2 3)))
 
 Re-reading this, I'm clearly not grokking something here.  Maybe I'm having 
 a slow afternoon; send help. :-P
 
 This obviously ends up running through EvalReader — but why?  How is 
 LispReader ever involved at all?
 
 I believe the story goes like so:
 
 The eval call here compiles a list of a function object and three
 numbers. The function object gets compiled to code which effectively
 calls readString on #=(clojure.core$_PLUS_. ). (It so happens that
 print-dup knows how to handle functions; if it didn't, an exception
 would be thrown during compilation with the message Can't embed
 object in code, maybe print-dup not defined: ) When the compiled
 code is executed, readString gets called to reconstruct the function,
 and since *read-eval* is false, this fails.

Whoo, sneaky.  If only fns carried (most of) the metadata that their 
originating vars were defined with, print-dup would be able to emit a 
fully-qualified symbol instead of that bonkers ctor call...I think.

This explains why my plan for a nuclear option for fixing *read-eval*'s 
default doesn't work when outside of a bare `java -cp ... clojure.main` REPL:

https://gist.github.com/4674181

Much of the initialization of the nREPL / Leiningen / Reply toolchain involves 
evaluating code that's been prn'ed, and there may very well be a couple of 
nested `eval` usages lurking in there similar to what Fogus raised.

So, getting *read-eval* to a safe default is going to require more than just 
setting its default to false; all usages of #= in 
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj 
need to be eliminated.  Will be peeking at that next...

- Chas

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




Re: Installing Clojure on Windows 7

2013-01-31 Thread James Wildheit
meant to say in my post entitled instructions for windows 7 to install 
clojure - leiningen - eclipse - counterclockwise:

if Ctrl (not Cmd) Enter does not work in windows 7 try:
Ctrl Alt S

when done don't forget to restart after re-enabling your firewall and UAC

(otherwise UAC will remain off and your hair will catch fire)

also, i suppose java knows very well what to do with the windows default 
folder name Program Files (x86) which requires spaces in its pathway: 
C:\Program Files (x86)
and expect changing it will also spontaneously combust your hair.

On Thursday, January 24, 2013 12:56:59 PM UTC-5, sampso...@googlemail.com 
wrote:

 Apparently installing a development environment for Clojure on Windows 7 
 is very difficult. What is the best way, that has a chance that it might 
 work?


-- 
-- 
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: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-01-31 Thread Zack Maril
Take a look at this gist:
https://gist.github.com/4688693

It uses memoize to eek out a little bit more performance.
λ ~/Projects/experiments/collatz  lein run
Compiling collatz.core
[9 19]
Elapsed time: 30.236 msecs
[97 118]
Elapsed time: 5.532 msecs
[871 178]
Elapsed time: 22.529 msecs
[6171 261]
Elapsed time: 114.061 msecs
[77031 350]
Elapsed time: 578.955 msecs
[837799 524]
Elapsed time: 3686.937 msecs
[8400511 685]
Elapsed time: 40478.64 msecs

On my machine it is usually significantly faster than when I run the 
provided code:
λ ~/Projects/experiments/collatz  lein run
Compiling collatz.core
{:n 9, :count 19}
Elapsed time: 22.024 msecs
{:n 97, :count 118}
Elapsed time: 6.838 msecs
{:n 871, :count 178}
Elapsed time: 56.313 msecs
{:n 6171, :count 261}
Elapsed time: 293.266 msecs
{:n 77031, :count 350}
Elapsed time: 962.113 msecs
{:n 837799, :count 524}
Elapsed time: 9529.107 msecs
λ ~/Projects/experiments/collatz  lein run
Compiling collatz.core
{:n 9, :count 19}
Elapsed time: 28.077 msecs
{:n 97, :count 118}
Elapsed time: 8.1 msecs
{:n 871, :count 178}
Elapsed time: 31.023 msecs
{:n 6171, :count 261}
Elapsed time: 144.956 msecs
{:n 77031, :count 350}
Elapsed time: 944.857 msecs
{:n 837799, :count 524}
Elapsed time: 10030.467 msecs
{:n 8400511, :count 685}
Elapsed time: 113490.494 msecs

Of course, there is a bunch of optimizations you can take mathematically:
http://en.wikipedia.org/wiki/Collatz_conjecture
-Zack
On Friday, February 1, 2013 4:29:53 AM UTC+4, Leandro Moreira wrote:

 The problem is known as Collatz Conjecture (also 3n + 1 conjecture).
 Basically given a n number then you apply the following rule.

 If n is even then n/2 otherwise 3 * n + 1, you keep applying this until you 
 reach the number 1.
 For instance, starting with *n = 6*, one gets the sequence 6, 3, 10, 5, 16, 
 8, 4, 2, 1. (with *8 items*)

 Now the challenge tell the *n* with n descending from 100 to 1 and with 
 the *greater number of items*.

 Then I did the program bellow (I'm very happy for feedback since I'm totally 
 noobie to clj), but it takes forever, there is anyway to make it fast?

 (defn- apply-collatz-conjecture 
   Given n, it returns n/2 if it's even or n*3+1 if it's odd.
   [n]
   (if (even? n)
   (/ n 2)
   (+ (* 3 n) 1)))
  
 (defn- collatz-conjecture-seq
   Given n, it returns the sequence of collatz-conjecture.
   [n]
   (loop [n n sequence []]
   (if (not= n 1)
   (recur (apply-collatz-conjecture n) (cons 
 (apply-collatz-conjecture n) sequence))
   (reverse sequence
  
 (defn- collatz-conjecture-number-of-items
   It returns a map with n and number of items on its collatz-conjecture 
 sequence.
   [n]
   { :n n :count (count (collatz-conjecture-seq n)) } )
  
 (defn- greater 
   Given x and y, it returns the element with greater count.
   [x y]
   (if ( (:count x) (:count y))
   x
   y))
  
 (defn n-with-more-items
   Given n, it applies collatz-conjecture for the range 1..n 
   and return the n with more items.
   [n]
   (reduce greater (pmap collatz-conjecture-number-of-items (range 1 n


 The only thing I thought was use pmap but it didn't make it super fast.

 *Using only map*
 user= (time (n-with-more-items  99))
 Elapsed time: *21191.762883 msecs*
 {:n 837799, :count 524}

 *Using pmap*
 user= (time (n-with-more-items  99))
 Elapsed time: *13230.919979 msecs*
 {:n 837799, :count 524}

 Any thoughts on how can I apply parallelism to solve this (especially on 
 my frustrate try of use map and reduce)?


-- 
-- 
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: Prismatic Plumbing and Graph Open-Source Release

2013-01-31 Thread Alex Miller
The video of the talk on Graph from Strange Loop just came 
out: http://www.infoq.com/presentations/Graph-Clojure-Prismatic

On Tuesday, January 29, 2013 12:46:54 PM UTC-6, Aria Haghighi wrote:

 Hey all,

  Prismatic has open-sourced our Plumbing and Graph library on 
 githubhttps://github.com/prismatic/plumbing. 
 Jason Wolfe gave a 
 talkhttp://blog.getprismatic.com/blog/2012/10/1/prismatics-graph-at-strange-loop.htmlabout
  how we use graph for systems composition at Strange loop last year. 
 Please give the library
 a whirl and let us know if you're using it and if you find any issues or 
 feature requests. We use this library very heavily throughout our code and 
 hope others find it useful as well.

  Best, Aria


-- 
-- 
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: Prismatic Plumbing and Graph Open-Source Release

2013-01-31 Thread AtKaaZ
if you put that on youtube, let me know, currently I cannot see the slides
or they are simply stuck on the first slide and never change (the video
works though)


On Fri, Feb 1, 2013 at 5:31 AM, Alex Miller a...@puredanger.com wrote:

 The video of the talk on Graph from Strange Loop just came out:
 http://www.infoq.com/presentations/Graph-Clojure-Prismatic


 On Tuesday, January 29, 2013 12:46:54 PM UTC-6, Aria Haghighi wrote:

 Hey all,

  Prismatic has open-sourced our Plumbing and Graph library on 
 githubhttps://github.com/prismatic/plumbing.
 Jason Wolfe gave a 
 talkhttp://blog.getprismatic.com/blog/2012/10/1/prismatics-graph-at-strange-loop.htmlabout
  how we use graph for systems composition at Strange loop last year.
 Please give the library
 a whirl and let us know if you're using it and if you find any issues or
 feature requests. We use this library very heavily throughout our code and
 hope others find it useful as well.

  Best, Aria

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






-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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: Prismatic Plumbing and Graph Open-Source Release

2013-01-31 Thread Baishampayan Ghose
Try Firefox. ~BG

On Fri, Feb 1, 2013 at 10:08 AM, AtKaaZ atk...@gmail.com wrote:
 if you put that on youtube, let me know, currently I cannot see the slides
 or they are simply stuck on the first slide and never change (the video
 works though)


 On Fri, Feb 1, 2013 at 5:31 AM, Alex Miller a...@puredanger.com wrote:

 The video of the talk on Graph from Strange Loop just came out:
 http://www.infoq.com/presentations/Graph-Clojure-Prismatic


 On Tuesday, January 29, 2013 12:46:54 PM UTC-6, Aria Haghighi wrote:

 Hey all,

  Prismatic has open-sourced our Plumbing and Graph library on github.
 Jason Wolfe gave a talk about how we use graph for systems composition at
 Strange loop last year. Please give the library
 a whirl and let us know if you're using it and if you find any issues or
 feature requests. We use this library very heavily throughout our code and
 hope others find it useful as well.

  Best, Aria

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






 --
 Please correct me if I'm wrong or incomplete,
 even if you think I'll subconsciously hate 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.





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




AW: (into [] (take n v)) vs (subvec v 0 n)

2013-01-31 Thread Meikel Brandmeyer
Hi,

how about simply doing this:

(defn foo-accessor
  ([] foo-vector)
  ([n] (subvec foo-vector 0 (min n (count foo-vector)

I wouldn't worry too much about subvectors. Unless you identify them as a 
bottleneck with the profiler.

Kind regards
Meikel

Durch MOTOBLUR™ verbunden

-Ursprüngliche Nachricht-
Von: Don Jackson cloj...@clark-communications.com
An: clojure@googlegroups.com clojure@googlegroups.com
Gesendet: Fr, 01 Feb 2013, 01:23:36 MEZ
Betreff: (into [] (take n v)) vs (subvec v 0 n)


In the app I am working on, I have a number of  pre-computed,cached 
collections, 
and for each collection, I have an accessor function that returns either the 
entire collection or the first n elements.

Currently the underlying collection is a vector, so I had something like this:

(defn foo-accessor
  ([] foo-vector)
  ([n] (take n foo-vector)))

It occurred to me that take returns a list, and so the type returned by my 
accessor was dependent on how it was called,
I thought I would change that, and remembered subvec, so I substituted in 
subvec for take, like this:

([n] (subvec foo-vector 0 n))

That worked great until ( (count foo-vector) n), and I got an 
IndexOutOfBoundsException

So, then without thinking much, I wrote 

(defn  subvec-safe
  subvec fails if you specify an end that is greater than count.  This version 
checks that, and DoesTheRightThing!
  ([v start]
 (subvec v start))
  ([v start end]
 (if ( (count v)
end)
   (subvec v
   start
   end)
   (subvec v
   start
   (count v)

(Yes, it is safe ONLY for the end value…)

And
(defn takev
   take for a vector, returns a subvec or the vector itself. Uses subvec-safe 
so specifying a n longer than (count v) works
   [n vec]
   (subvec-safe vec
0
n))

Even before finishing takev, it occurred to me that

(defn- takev
  take for a vector
  [n vec]
  (into []
(take n
  vec)))

Might be easier/faster. 

subvec returns a clojure.lang.APersistentVector$SubVector

whereas (into [] (take …)) returns a vector.

Any thoughts on which of the above is better?

Thanks,

Don



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



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




Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-01-31 Thread Leandro Moreira
Running through this problem I also faced the weird situation, so:

Given two maps
(def mario {:color red :power 45})
(def luigi {:color green :power 40})

I want the max between both but based on :power key.
It would be something like this.

(max mario luigi)
I expect max return not only 45 but the whole map Is there any built in 
function for that?

-- 
-- 
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: Prismatic Plumbing and Graph Open-Source Release

2013-01-31 Thread AtKaaZ
Thanks, I am already using it v 19.0, at one time I was unable to see any
videos on infoq but then I realized that's because I perma-denied*flash*.exe
*outgoing in firewall but as soon as I upgraded flash the newly named exe
trying outgoing made the firewall prompt me and realized that's why some
flash-based things weren't working before (like sites that allow free
uploading images). In truth if I ran firefox without any addons it would
probably work on infoq ... even though I did my best to allow all needed in
noscript+requestpolicy+refcontrol (addons)...


On Fri, Feb 1, 2013 at 5:39 AM, Baishampayan Ghose b.gh...@gmail.comwrote:

 Try Firefox. ~BG

 On Fri, Feb 1, 2013 at 10:08 AM, AtKaaZ atk...@gmail.com wrote:
  if you put that on youtube, let me know, currently I cannot see the
 slides
  or they are simply stuck on the first slide and never change (the video
  works though)
 
 
  On Fri, Feb 1, 2013 at 5:31 AM, Alex Miller a...@puredanger.com wrote:
 
  The video of the talk on Graph from Strange Loop just came out:
  http://www.infoq.com/presentations/Graph-Clojure-Prismatic
 
 
  On Tuesday, January 29, 2013 12:46:54 PM UTC-6, Aria Haghighi wrote:
 
  Hey all,
 
   Prismatic has open-sourced our Plumbing and Graph library on github.
  Jason Wolfe gave a talk about how we use graph for systems composition
 at
  Strange loop last year. Please give the library
  a whirl and let us know if you're using it and if you find any issues
 or
  feature requests. We use this library very heavily throughout our code
 and
  hope others find it useful as well.
 
   Best, Aria
 
  --
  --
  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.
 
 
 
 
 
 
  --
  Please correct me if I'm wrong or incomplete,
  even if you think I'll subconsciously hate 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.
 
 



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





-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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.




Efficient idioms to handle large lists?

2013-01-31 Thread bruce li
Hello, everyone. I'm experience some performance issue when using clojure.
The scenario is as follows:

I have a huge list of xls files to process. I used the
org.clojars.boechat107/cloxls  to read the files which for each file
generates a list(approximately 65,000 elements). Now I need to concatenate
all of them. I used (mapcat read-worksheet files) to get the final list,
but it soon reports out of heap space. Then I tried to use mutable
structures:

  (doseq [f files]
(swap! sheet concat (read-worksheet f)))

where sheet is defined as (def sheet (atom [])))

But the concat seems to slow down a lot when the list grows larger. I'm
wondering if in clojure there is some efficient idiom to handle such
situation such as efficient concatenation?

Thanks,
Bruce Li

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