Re: Question about lein swank and emacs

2010-10-26 Thread David Jagoe
On 26 October 2010 04:36, Mark Engelberg mark.engelb...@gmail.com wrote:
 When I do restart-inferior-lisp, it says, no inferior lisp process.

Yeah, that'll only work if you originally started swank from emacs as
the inferior lisp process. If you're doing 'lein swank' on the command
line it won't work - looks like elein is the way to go in that case.

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


c.c.monads z Clojure 1.3.0-alpha2

2010-10-26 Thread Jacek Laskowski
Hi,

I suppose I should be using appropriate version of clojure-contrib for
Clojure 1.3.0-alpha2 as 1.2 gives me CNFE upon loading c.c.monads.

Clojure 1.3.0-alpha2
user= (use 'clojure.contrib.monads)
CompilerException java.lang.ClassNotFoundException: clojure.set,
compiling:(clojure/contrib/accumulators.clj:121)

Where can I find clojure-contrib for 1.3.0-alpha2? Thanks.

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://jaceklaskowski.pl

-- 
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: Images in autodoc?

2010-10-26 Thread Tom Faulhaber
It's on the roadmap.

I haven't really figured out a way to do it that fits in with other
uses of doc strings.

I do know that I want the images to be able to be embedded in the doc
string so that programs like incanter can use the image as part of the
narrative, but I want the markup that does it to feel natural to
readers who aren't seeing the image.

Tom

On Oct 25, 7:05 pm, Chris christopher.ma...@gmail.com wrote:
 Is it possible to add images to autodoc-generated pages like javadoc
 can?  I'm interested in adding explanatory diagrams to function
 documentation as opposed to adding things like logos to the HTML
 pages.

 Thanks,
 Chris

-- 
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 performance on shootout

2010-10-26 Thread Marko Kocić
Clojure has recently been added to http://shootout.alioth.debian.org/
benchmarks. I know there are a lot of objections and excuses about
this benchmark, but that is defacto go to place when talking about
language implementation performance.

The problems is that performance is not that great as it could /
should be. Yes, it is a couple times faster then Ruby or Python, but
everyone's faster then those.

It still lags far behind Java, it is usually ~4 times slower then
Java, although the code seems heavily optimized thus making it even
more verbose then Java code. When running the same benchmarks with
Clojure 1.3 snapshots I didn't notice fundamental speed difference.

Scala performance is on par with Java.

Now, the questions are:
- Could benchmarks themselves be better optimized to better represent
Clojure?
- Is there a fundamental reason why Clojure can't reach Scala speed,
except for maturity?
- What are the plans regarding performance optimizations in near and
distant future?

I have seen some microbenchmarks where Clojure reaches almost Java
speed, but in general it is still much slower. I know that performace
is not reason d'etre of Clojure, but it is still important.

Regards,
Marko

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


Re: Clojure performance on shootout

2010-10-26 Thread nicolas.o...@gmail.com
Maybe optimizing now is a bit early, as a lot of the performance
caracteristics of clojure programs will
change with 1.3.

Might be better to start writing programs that will be fast with 1.3.

On Tue, Oct 26, 2010 at 9:46 AM, Marko Kocić marko.ko...@gmail.com wrote:
 Clojure has recently been added to http://shootout.alioth.debian.org/
 benchmarks. I know there are a lot of objections and excuses about
 this benchmark, but that is defacto go to place when talking about
 language implementation performance.

 The problems is that performance is not that great as it could /
 should be. Yes, it is a couple times faster then Ruby or Python, but
 everyone's faster then those.

 It still lags far behind Java, it is usually ~4 times slower then
 Java, although the code seems heavily optimized thus making it even
 more verbose then Java code. When running the same benchmarks with
 Clojure 1.3 snapshots I didn't notice fundamental speed difference.

 Scala performance is on par with Java.

 Now, the questions are:
 - Could benchmarks themselves be better optimized to better represent
 Clojure?
 - Is there a fundamental reason why Clojure can't reach Scala speed,
 except for maturity?
 - What are the plans regarding performance optimizations in near and
 distant future?

 I have seen some microbenchmarks where Clojure reaches almost Java
 speed, but in general it is still much slower. I know that performace
 is not reason d'etre of Clojure, but it is still important.

 Regards,
 Marko

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

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To 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 performance on shootout

2010-10-26 Thread Santosh Rajan
Here is another speed comparison. Of note is that there is another jvm based
lisp dialect kawa.
http://per.bothner.com/blog/2010/Kawa-in-shootout/

On Tue, Oct 26, 2010 at 2:16 PM, Marko Kocić marko.ko...@gmail.com wrote:

 Clojure has recently been added to http://shootout.alioth.debian.org/
 benchmarks. I know there are a lot of objections and excuses about
 this benchmark, but that is defacto go to place when talking about
 language implementation performance.

 The problems is that performance is not that great as it could /
 should be. Yes, it is a couple times faster then Ruby or Python, but
 everyone's faster then those.

 It still lags far behind Java, it is usually ~4 times slower then
 Java, although the code seems heavily optimized thus making it even
 more verbose then Java code. When running the same benchmarks with
 Clojure 1.3 snapshots I didn't notice fundamental speed difference.

 Scala performance is on par with Java.

 Now, the questions are:
 - Could benchmarks themselves be better optimized to better represent
 Clojure?
 - Is there a fundamental reason why Clojure can't reach Scala speed,
 except for maturity?
 - What are the plans regarding performance optimizations in near and
 distant future?

 I have seen some microbenchmarks where Clojure reaches almost Java
 speed, but in general it is still much slower. I know that performace
 is not reason d'etre of Clojure, but it is still important.

 Regards,
 Marko

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




-- 
http://hi.im/santosh

-- 
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: Images in autodoc?

2010-10-26 Thread Andrew Gwozdziewycz
On Tue, Oct 26, 2010 at 3:50 AM, Tom Faulhaber tomfaulha...@gmail.com wrote:
 It's on the roadmap.

 I haven't really figured out a way to do it that fits in with other
 uses of doc strings.

 I do know that I want the images to be able to be embedded in the doc
 string so that programs like incanter can use the image as part of the
 narrative, but I want the markup that does it to feel natural to
 readers who aren't seeing the image.

I'm not sure what sort of markup you've already thought of, but using
something similar to markdown which has the ability to embed resources
within, but specify them later seems to make sense for this purpose:

(defn foo
   this function computes foo, given bar, and returns a handle to a
java.awt.image.BufferedImage, which shows a 3D graph (![example
graph][1]) of the function.

[1]: http://foo.bar/examples/foo-bar.png;
  [bar]
  ...)





-- 
http://www.apgwoz.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


Re: Images in autodoc?

2010-10-26 Thread Chris
On Oct 26, 3:50 am, Tom Faulhaber tomfaulha...@gmail.com wrote:
 I do know that I want the images to be able to be embedded in the doc
 string so that programs like incanter can use the image as part of the
 narrative, but I want the markup that does it to feel natural to
 readers who aren't seeing the image.

Maybe something like Markdown link references? E.g.,

(defn foo [x y]
  Blah blah blah, blah blah blah.  Blah blah,
   as seen here:

   [Figure 1][]

   Also remember blah blah blah, and blah blah
   as well. Blah blah blah blah blah blah blah
   blah blah blah blah blah blah blah.

   [Figure 1]: /doc-files/figure-1.png

   (+ x y))

Basically, have all the image file addresses as footnotes.  If you're
reading the docs in the REPL, for instance, you don't have big URL-ish
strings distracting you from the documentation, but all the info is
still there to be parsed out by autodoc.

Chris

-- 
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 performance on shootout

2010-10-26 Thread B Smith-Mannschott
On Tue, Oct 26, 2010 at 11:27, Santosh Rajan santra...@gmail.com wrote:
 Here is another speed comparison. Of note is that there is another jvm based
 lisp dialect kawa.
 http://per.bothner.com/blog/2010/Kawa-in-shootout/

Yes, this one is interesting. Might not figuring out what Kawa is
doing differently yield some ideas to improve Clojure perf?

// ben

-- 
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 performance on shootout

2010-10-26 Thread Stuart Halloway
The 1.3 release for Clojure aims for parity with Java performance, with less 
explicit optimization and hinting than required in 1.2 (or in Java). It would 
be great to have people in the community share the effort of writing and 
testing benchmarks, and to facilitate this I have created a top-level skeleton 
project for a benchmark and regression suite for clojure 
(http://github.com/clojure/test.benchmark). Andy Fingerhut, who wrote most of 
the current alioth benchmarks, has signed a CA and will be contributing his 
code to this project.

We will primarily be targeting benchmarks for 1.3. performance, but will keep a 
separate 1.2 directory in the project for anyone who is interested.

As an aside: You will not be able to just run benchmarks carefully tuned for 
1.2 under 1.3 and get best performance, as some of the performance tricks are 
now counter-indicated.

Stu


 Clojure has recently been added to http://shootout.alioth.debian.org/
 benchmarks. I know there are a lot of objections and excuses about
 this benchmark, but that is defacto go to place when talking about
 language implementation performance.
 
 The problems is that performance is not that great as it could /
 should be. Yes, it is a couple times faster then Ruby or Python, but
 everyone's faster then those.
 
 It still lags far behind Java, it is usually ~4 times slower then
 Java, although the code seems heavily optimized thus making it even
 more verbose then Java code. When running the same benchmarks with
 Clojure 1.3 snapshots I didn't notice fundamental speed difference.
 
 Scala performance is on par with Java.
 
 Now, the questions are:
 - Could benchmarks themselves be better optimized to better represent
 Clojure?
 - Is there a fundamental reason why Clojure can't reach Scala speed,
 except for maturity?
 - What are the plans regarding performance optimizations in near and
 distant future?
 
 I have seen some microbenchmarks where Clojure reaches almost Java
 speed, but in general it is still much slower. I know that performace
 is not reason d'etre of Clojure, but it is still important.
 
 Regards,
 Marko
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To 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 performance on shootout

2010-10-26 Thread Marko Kocić
It would be very good if 1.3 delivers on its goal, and it is nice to
see that performance is important to the core team.
Here's the quick test on binarytrees benchmark that I submitted to the
shootout. It is not optimized at all, besides eliminating reflection
warnings. On my box results for binarytrees 20 are:
clojure-1.2 - ~4min
clojure-1.3-current-snapshot - ~3min
java -server - 1min.

As one can see, althoug 1.3 is nice improvement over 1.2, it's still
far from java :(

As another point, it is good that you created project for benchmarks,
it even make sense to make those benchmarks official regression test
suite, but it is also important to contribute benchmarks to the
shootout itself, since that is the place one goes to see which
language is the fastest.

Regards,
Marko

On 26 окт, 13:17, Stuart Halloway stuart.hallo...@gmail.com wrote:
 The 1.3 release for Clojure aims for parity with Java performance, with less 
 explicit optimization and hinting than required in 1.2 (or in Java). It would 
 be great to have people in the community share the effort of writing and 
 testing benchmarks, and to facilitate this I have created a top-level 
 skeleton project for a benchmark and regression suite for clojure 
 (http://github.com/clojure/test.benchmark). Andy Fingerhut, who wrote most of 
 the current alioth benchmarks, has signed a CA and will be contributing his 
 code to this project.

 We will primarily be targeting benchmarks for 1.3. performance, but will keep 
 a separate 1.2 directory in the project for anyone who is interested.

 As an aside: You will not be able to just run benchmarks carefully tuned for 
 1.2 under 1.3 and get best performance, as some of the performance tricks are 
 now counter-indicated.

 Stu







  Clojure has recently been added tohttp://shootout.alioth.debian.org/
  benchmarks. I know there are a lot of objections and excuses about
  this benchmark, but that is defacto go to place when talking about
  language implementation performance.

  The problems is that performance is not that great as it could /
  should be. Yes, it is a couple times faster then Ruby or Python, but
  everyone's faster then those.

  It still lags far behind Java, it is usually ~4 times slower then
  Java, although the code seems heavily optimized thus making it even
  more verbose then Java code. When running the same benchmarks with
  Clojure 1.3 snapshots I didn't notice fundamental speed difference.

  Scala performance is on par with Java.

  Now, the questions are:
  - Could benchmarks themselves be better optimized to better represent
  Clojure?
  - Is there a fundamental reason why Clojure can't reach Scala speed,
  except for maturity?
  - What are the plans regarding performance optimizations in near and
  distant future?

  I have seen some microbenchmarks where Clojure reaches almost Java
  speed, but in general it is still much slower. I know that performace
  is not reason d'etre of Clojure, but it is still important.

  Regards,
  Marko

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

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To 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 performance on shootout

2010-10-26 Thread Meikel Brandmeyer
Hi,

On 26 Okt., 13:17, Stuart Halloway stuart.hallo...@gmail.com wrote:

 As an aside: You will not be able to just run benchmarks carefully tuned for 
 1.2 under 1.3 and get best performance, as some of the performance tricks are 
 now counter-indicated.

Is there some documentation how tuning against 1.3 works? I got a list
implementation with fast random lookup written in Clojure (internally
it ended up basically like a vector type of thing) whose speed is on
par with that of a vector written in Java. I haven't tested it against
1.3 though. And optimising against 1.2 felt a little like dark
wizardry. So a short guide on how to optimise for 1.3 would be cool.

Sincerely
Meikel

-- 
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: Getting this error regarding duck-streams/spit ...

2010-10-26 Thread Dave Ray
Hey.

Until this message, I hadn't noticed that duck-streams was deprecated.
Is the stuff in clojure.java.io the official replacement for that
functionality? So now rather than duck-streams/read-lines, I'd
manually combine with-open, clojure.java.io/reader, and line-seq?

Just checking.

Thanks,

Dave

On Tue, Oct 26, 2010 at 12:46 AM, Btsai benny.t...@gmail.com wrote:
 I don't think it's a mistake or accident that spit exists in
 clojure.core.  In 1.2, duck-streams became deprecated and functions
 such as spit were incorporated into clojure.core:

 http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/spit
 http://clojure.github.com/clojure-contrib/duck-streams-api.html

 Are you using anything beyond spit and slurp*?  If not, I think you
 can switch to clojure.core's slurp and spit and drop duck-streams
 altogether.

 On Oct 25, 8:59 pm, Victor Olteanu bluestar...@gmail.com wrote:
 Thank you.

 The following statement worked for me:
 (:require [clojure.contrib.duck-streams :as d])

 As I was using slurp and slurp*, I then had to do the following:

 use the form d/slurp* instead (prefixed with d/)
 use slurp without a change

 This brings up a related point - I can see that there are functions with the
 same name in different packages, which I believe it's quite unfortunate.
 There is slurp in clojure.core and there is duck-streams/slurp* , along with
 other functions such as spit...

 I hope this kind of things might be addressed in future versions of
 Clojure...


 --
 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: Images in autodoc?

2010-10-26 Thread Chris
Come to think of it, it might be cool to write doc strings in a kind
of Clojure-flavored Markdown... that'd give us images, links, lists,
formatting, etc.  It's also got the benefit of being a familiar
format, and easy to read in unprocessed form.

Chris

On Oct 26, 6:05 am, Chris christopher.ma...@gmail.com wrote:
 On Oct 26, 3:50 am, Tom Faulhaber tomfaulha...@gmail.com wrote:

  I do know that I want the images to be able to be embedded in the doc
  string so that programs like incanter can use the image as part of the
  narrative, but I want the markup that does it to feel natural to
  readers who aren't seeing the image.

 Maybe something like Markdown link references? E.g.,

 (defn foo [x y]
   Blah blah blah, blah blah blah.  Blah blah,
    as seen here:

    [Figure 1][]

    Also remember blah blah blah, and blah blah
    as well. Blah blah blah blah blah blah blah
    blah blah blah blah blah blah blah.

    [Figure 1]: /doc-files/figure-1.png

    (+ x y))

 Basically, have all the image file addresses as footnotes.  If you're
 reading the docs in the REPL, for instance, you don't have big URL-ish
 strings distracting you from the documentation, but all the info is
 still there to be parsed out by autodoc.

 Chris

-- 
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: Getting this error regarding duck-streams/spit ...

2010-10-26 Thread Sean Devlin
The stuff in Clojure.java.io would be the preferred tool, yes.
However, if contrib has something that solves your problem, go ahead
and use it.  Be careful though, because contrib is much more likely to
change than something officially in core.

On Oct 26, 8:51 am, Dave Ray dave...@gmail.com wrote:
 Hey.

 Until this message, I hadn't noticed that duck-streams was deprecated.
 Is the stuff in clojure.java.io the official replacement for that
 functionality? So now rather than duck-streams/read-lines, I'd
 manually combine with-open, clojure.java.io/reader, and line-seq?

 Just checking.

 Thanks,

 Dave

 On Tue, Oct 26, 2010 at 12:46 AM, Btsai benny.t...@gmail.com wrote:
  I don't think it's a mistake or accident that spit exists in
  clojure.core.  In 1.2, duck-streams became deprecated and functions
  such as spit were incorporated into clojure.core:

 http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/...
 http://clojure.github.com/clojure-contrib/duck-streams-api.html

  Are you using anything beyond spit and slurp*?  If not, I think you
  can switch to clojure.core's slurp and spit and drop duck-streams
  altogether.

  On Oct 25, 8:59 pm, Victor Olteanu bluestar...@gmail.com wrote:
  Thank you.

  The following statement worked for me:
  (:require [clojure.contrib.duck-streams :as d])

  As I was using slurp and slurp*, I then had to do the following:

  use the form d/slurp* instead (prefixed with d/)
  use slurp without a change

  This brings up a related point - I can see that there are functions with 
  the
  same name in different packages, which I believe it's quite unfortunate.
  There is slurp in clojure.core and there is duck-streams/slurp* , along 
  with
  other functions such as spit...

  I hope this kind of things might be addressed in future versions of
  Clojure...

  --
  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: Images in autodoc?

2010-10-26 Thread Andrew Gwozdziewycz
On Tue, Oct 26, 2010 at 9:27 AM, Chris christopher.ma...@gmail.com wrote:
 Come to think of it, it might be cool to write doc strings in a kind
 of Clojure-flavored Markdown... that'd give us images, links, lists,
 formatting, etc.  It's also got the benefit of being a familiar
 format, and easy to read in unprocessed form.

I like that idea, especially if it could be extended to reference other code:

(defn foo
   Creates an echo server using
[create-server][ref:clojure.contrib.server-socket/create-server].
Returns the result of the create-server call which can be shutdown by
using [close-server][ref:clojure.contrib.server-socket/close-server].
   [bar]
   ...)

I think it'd be easy enough, the markdown compiler would just know
that certain prefixes to references are treated differently.



 On Oct 26, 6:05 am, Chris christopher.ma...@gmail.com wrote:
 On Oct 26, 3:50 am, Tom Faulhaber tomfaulha...@gmail.com wrote:

  I do know that I want the images to be able to be embedded in the doc
  string so that programs like incanter can use the image as part of the
  narrative, but I want the markup that does it to feel natural to
  readers who aren't seeing the image.

 Maybe something like Markdown link references? E.g.,

 (defn foo [x y]
   Blah blah blah, blah blah blah.  Blah blah,
    as seen here:

    [Figure 1][]

    Also remember blah blah blah, and blah blah
    as well. Blah blah blah blah blah blah blah
    blah blah blah blah blah blah blah.

    [Figure 1]: /doc-files/figure-1.png

    (+ x y))

 Basically, have all the image file addresses as footnotes.  If you're
 reading the docs in the REPL, for instance, you don't have big URL-ish
 strings distracting you from the documentation, but all the info is
 still there to be parsed out by autodoc.

 Chris

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



-- 
http://www.apgwoz.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


Re: Images in autodoc?

2010-10-26 Thread Chris
On Oct 26, 9:54 am, Andrew Gwozdziewycz apg...@gmail.com wrote:
 I like that idea, especially if it could be extended to reference other code:

Agreed.  So now that's links to images, web pages, Clojure vars...
anything else?

Chris

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


Detecting More than one matching method

2010-10-26 Thread Maks Romih
Hi!

I stumbled on a difference of behavior in using a variable vs. let
binding. It may even be a bug in Clojure.

Using Java 1.6 and Clojure 1.1 or 1.2, if you execute the following
code

code
(import
 'javax.xml.crypto.dsig.XMLSignatureFactory
 'javax.xml.crypto.dsig.Transform)

(def fac (XMLSignatureFactory/getInstance DOM))

(let [tf (. fac newTransform Transform/ENVELOPED nil)]
  tf)

(let [fac (XMLSignatureFactory/getInstance DOM)
  tf (. fac newTransform Transform/ENVELOPED nil)]
  tf)
/code

the first let works OK while the second one breaks with stack trace
and the error More than one matching method found: newTransform.
There are really two methods with this name and the second parameter
nil does not differentiate them enough, but I'd like to know why the
first call, with the fac as a variable, succeeds. Which method of the
two does it call?

Maks.

-- 
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: Images in autodoc?

2010-10-26 Thread Andrew Gwozdziewycz
On Tue, Oct 26, 2010 at 10:30 AM, Chris christopher.ma...@gmail.com wrote:
 On Oct 26, 9:54 am, Andrew Gwozdziewycz apg...@gmail.com wrote:
 I like that idea, especially if it could be extended to reference other code:

 Agreed.  So now that's links to images, web pages, Clojure vars...
 anything else?

Well, if the markdown generator was written correctly (is there a
markdown.clj? or is this going to be a fresh write? and who's doing
it?) it'd support a way to dispatch the generation based on the prefix
passed to the reference, so supporting other things deemed necessary
wouldn't be so bit a deal.

 Chris

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



-- 
http://www.apgwoz.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


Re: Images in autodoc?

2010-10-26 Thread Eric Schulte
Chris christopher.ma...@gmail.com writes:

 On Oct 26, 9:54 am, Andrew Gwozdziewycz apg...@gmail.com wrote:
 I like that idea, especially if it could be extended to reference other code:

 Agreed.  So now that's links to images, web pages, Clojure vars...
 anything else?


LaTeX equations.  Which are increasingly easy to render in HTML
(e.g. http://www.mathjax.org/).

-- Eric


 Chris

-- 
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: Images in autodoc?

2010-10-26 Thread Andrew Gwozdziewycz
On Tue, Oct 26, 2010 at 12:21 PM, Eric Schulte schulte.e...@gmail.com wrote:
 Chris christopher.ma...@gmail.com writes:

 On Oct 26, 9:54 am, Andrew Gwozdziewycz apg...@gmail.com wrote:
 I like that idea, especially if it could be extended to reference other 
 code:

 Agreed.  So now that's links to images, web pages, Clojure vars...
 anything else?


 LaTeX equations.  Which are increasingly easy to render in HTML
 (e.g. http://www.mathjax.org/).

I guess the problem is actually making a patch to autodoc to do this all :)



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



-- 
http://www.apgwoz.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


Re: Question about lein swank and emacs

2010-10-26 Thread Drew Raines
David Jagoe wrote:

 On 26 October 2010 04:36, Mark Engelberg mark.engelb...@gmail.com wrote:
 When I do restart-inferior-lisp, it says, no inferior lisp process.

 Yeah, that'll only work if you originally started swank from emacs
 as the inferior lisp process. If you're doing 'lein swank' on the
 command line it won't work - looks like elein is the way to go in
 that case.

Ah, you're right.  In that case just hit M-x lein swank RET again.
It'll reap the old process.

-Drew

-- 
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: Images in autodoc?

2010-10-26 Thread Tom Faulhaber
Nah, changing the autodoc generation is easy (though we need to figure
out where images go on the input and output sides and move them
around, but that shouldn't be too much of a problem).

The bigger problem is figuring out what to tell folks who type (doc
foo) at the REPL and get a bunch of gobbledegook back. That's the
thing that's been making me look for a better format than markdown.
(Autodoc already does markdown translation for supporting
documentation).

Tom

On Oct 26, 9:25 am, Andrew Gwozdziewycz apg...@gmail.com wrote:
 On Tue, Oct 26, 2010 at 12:21 PM, Eric Schulte schulte.e...@gmail.com wrote:
  Chris christopher.ma...@gmail.com writes:

  On Oct 26, 9:54 am, Andrew Gwozdziewycz apg...@gmail.com wrote:
  I like that idea, especially if it could be extended to reference other 
  code:

  Agreed.  So now that's links to images, web pages, Clojure vars...
  anything else?

  LaTeX equations.  Which are increasingly easy to render in HTML
  (e.g.http://www.mathjax.org/).

 I guess the problem is actually making a patch to autodoc to do this all :)

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

 --http://www.apgwoz.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


ANN: A clojure port of the compiler

2010-10-26 Thread Juha Arpiainen
Hello group!

I've been working on a clojure port of the clojure compiler and have
just reached a good point to announce the project: the compiler can
now compile its own source code and a substantial part of clojure/
core.clj. The code is hosted at http://github.com/jarpiain/cljc and
some information about bootstrapping is at http://subluminal.org/cljc
.

Included also is a bytecode assembler/disassembler and a binary format
parser/writer library.

--
Juha Arpiainen
jarpi...@iki.fi

-- 
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: Question about lein swank and emacs

2010-10-26 Thread Drew Raines
For some reason I missed the original slime-connect mention.  In that
case, David's right that there isn't any way apart from TERMing the
lein swank process.  When I start swank that way I do it within an
Emacs shell so that I only have to switch buffers to restart.

-Drew



On Tue, Oct 26, 2010 at 11:53, Drew Raines aarai...@gmail.com wrote:
 David Jagoe wrote:

 On 26 October 2010 04:36, Mark Engelberg mark.engelb...@gmail.com wrote:
 When I do restart-inferior-lisp, it says, no inferior lisp process.

 Yeah, that'll only work if you originally started swank from emacs
 as the inferior lisp process. If you're doing 'lein swank' on the
 command line it won't work - looks like elein is the way to go in
 that case.

 Ah, you're right.  In that case just hit M-x lein swank RET again.
 It'll reap the old process.

 -Drew


-- 
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: Question about lein swank and emacs

2010-10-26 Thread Mark Engelberg
I'm confused.  Is there a better way to get a REPL going in Emacs
other than lein swank from a command line combined with M-x
slime-connect in Emacs?

On Tue, Oct 26, 2010 at 10:28 AM, Drew Raines aarai...@gmail.com wrote:
 For some reason I missed the original slime-connect mention.  In that
 case, David's right that there isn't any way apart from TERMing the
 lein swank process.  When I start swank that way I do it within an
 Emacs shell so that I only have to switch buffers to restart.

 -Drew



-- 
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: Wildcards on multimethod matching

2010-10-26 Thread Paul Gearon
On Sat, Oct 23, 2010 at 5:16 PM, Paul Richards paul.richa...@gmail.com wrote:
 Hi,
 I have a multimethod which is dispatched on two arguments:

 (defmulti bar (fn [x y] [x y]))
 (defmethod bar [1 2] ..)
 (defmethod bar [3 4] ..)

 Is there a way I can define methods on this which use wildcards?


What about something like:

(defmulti bar (fn [x y] [(if (= y 16) :any x) (if (= x 42) :any y)])

(defmethod bar [42 :any] [x y] ...)
(defmethod bar [:any 16] [x y] ...)
(defmethod bar [:any :any] [x y] ...)
(defmethod bar :default [x y] ...)

The function is a little less pretty, but it does the job. The only
trick is that (bar 42 16) comes back as the [:any :any] case, but you
could always let that fall through to the default.


Regards,
Paul

-- 
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: Images in autodoc?

2010-10-26 Thread Chris Maier
On Tue, Oct 26, 2010 at 1:08 PM, Tom Faulhaber tomfaulha...@gmail.com wrote:
 The bigger problem is figuring out what to tell folks who type (doc
 foo) at the REPL and get a bunch of gobbledegook back. That's the
 thing that's been making me look for a better format than markdown.
 (Autodoc already does markdown translation for supporting
 documentation).

Is it really that bad reading unformatted markdown, though?  I find it
pretty readable, myself, particularly if all the link addresses are
stashed at the bottom as footnotes.  LaTeX equations, on the other
hand, could get quite hairy (unless they can be footnoted, too)

Are we talking about making changes to the doc macro itself to somehow
either filter or otherwise prettify this markup for REPL consumption?

Tom, what kind of other formats have you been experimenting with?

Chris

-- 
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: Images in autodoc?

2010-10-26 Thread Andrew Gwozdziewycz
On Tue, Oct 26, 2010 at 2:06 PM, Chris Maier
christopher.ma...@gmail.com wrote:
 On Tue, Oct 26, 2010 at 1:08 PM, Tom Faulhaber tomfaulha...@gmail.com wrote:
 The bigger problem is figuring out what to tell folks who type (doc
 foo) at the REPL and get a bunch of gobbledegook back. That's the
 thing that's been making me look for a better format than markdown.
 (Autodoc already does markdown translation for supporting
 documentation).

 Is it really that bad reading unformatted markdown, though?  I find it
 pretty readable, myself, particularly if all the link addresses are
 stashed at the bottom as footnotes.  LaTeX equations, on the other
 hand, could get quite hairy (unless they can be footnoted, too)

I agree. There seems to be a subset of things that people would
actually even use:

(lists-- maybe numbered and bulleted)
* `inline code`
* *bold*
* _underline_

Areas likely to include gobbledegook:
1. images
2. links (internal. for external links, just use fully qualified URI)
3. equations

I'd agree that markdown images and links can get a bit challenging to
read if dense, but maybe an autodoc specific markup language that
addresses the noise and keeps to (sane) conventions is a worthy
approach.


-- 
http://www.apgwoz.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


Re: First function

2010-10-26 Thread Brody Berg
Thanks for all the excellent, concise advice!

For code and idiomatic improvements, from these messages I have the
following

   - For order 1 access use vector
   - Use subvectors for efficient partitioning
   - Case/compare is concise, powerful and readable
   - Use seq idiom to proceed or return nil
   - Two spaces for indentation
   - Indentation: parameters at same level, flow control at next level
   - Line up trailing parens
   - Dash, not underscore
   - =, unless data is integer and we have performance measurements that
   demand ==
   - inc more idiomatic than (+ number 1)

Awesome advice, getting into this has been totally great.

Brody

On Thu, Oct 21, 2010 at 11:50 AM, Jürgen Hötzel juer...@hoetzel.infowrote:

 2010/10/21 Brody Berg brodyb...@gmail.com:
  (defn binary-search
 Search sorted list for target using binary search technique

 Binary search is only useful on indexed data types like Clojure Vectors.

 ([m_list target]
 (if (empty? m_list)
 false
 (binary-search m_list 0 (- (count m_list) 1) target))
 )
 ([m_list m_left m_right target]

 Because  Vectors are persistent you can create Sub-Vectors instead of
 keeping tracking offsets.

 (let [gap (- m_right m_left)]
 (if (= 0 gap)
 (if (== (nth m_list m_left) target)
 (nth m_list m_left)
 false

 No need for explicit false.

 Using case/compare you can also replace multiple tests by a single
 comparison and constant time lookup:

 (defn binary-search [v x]
  (if (seq v)
(let [half (quot (count v) 2)
  middle (v half)]
  (case (compare middle x)
-1 (recur (subvec v (inc half)) x)
1 (recur (subvec v 0 half) x)
true

 Jürgen

 --
 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.comclojure%2bunsubscr...@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: Images in autodoc?

2010-10-26 Thread Timo Mihaljov
On Tue, Oct 26, 2010 at 02:15:21PM -0400, Andrew Gwozdziewycz wrote:
 Areas likely to include gobbledegook:
 [...]
 2. links (internal. for external links, just use fully qualified URI)

Internal links could be easily handled by trying to resolve all `code
blocks` with ns-resolve in the namespace containing the docstring. If
the block resolves to a var, make it a link. No gobbledegook needed.
(In practice you'd need a slightly more complicated algorithm to
handle cases where e.g. a parameter shadows an existing var.)

If you wanted to get real fancy, you could even check if the code
block is a list, and then resolve each symbol inside the list, so
that, for example, resolve's docstring would look like this at the
REPL:

user= (doc resolve)
-
clojure.core/resolve
([sym])
  same as `(ns-resolve *ns* sym)`

But in the HTML documentation `ns-resolve` and `*ns*` would be
hyperlinks.

--
Timo

-- 
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: Images in autodoc?

2010-10-26 Thread Andrew Gwozdziewycz
On Tue, Oct 26, 2010 at 4:44 PM, Timo Mihaljov noid@gmail.com wrote:
 On Tue, Oct 26, 2010 at 02:15:21PM -0400, Andrew Gwozdziewycz wrote:
 Areas likely to include gobbledegook:
 [...]
 2. links (internal. for external links, just use fully qualified URI)

 Internal links could be easily handled by trying to resolve all `code
 blocks` with ns-resolve in the namespace containing the docstring. If
 the block resolves to a var, make it a link. No gobbledegook needed.
 (In practice you'd need a slightly more complicated algorithm to
 handle cases where e.g. a parameter shadows an existing var.)

 If you wanted to get real fancy, you could even check if the code
 block is a list, and then resolve each symbol inside the list, so
 that, for example, resolve's docstring would look like this at the
 REPL:

 user= (doc resolve)
 -
 clojure.core/resolve
 ([sym])
  same as `(ns-resolve *ns* sym)`

 But in the HTML documentation `ns-resolve` and `*ns*` would be
 hyperlinks.

I like that idea. And it does make sense to do that rather than create
some special syntax for those cases. So, that leaves images, and
equations, and any other rich types we haven't thought of.

Tom, does this all seem reasonable? If so, how can I help?

Andrew


 --
 Timo

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



-- 
http://www.apgwoz.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


Re: Question about lein swank and emacs

2010-10-26 Thread Mark Engelberg
So what steps do you need to go through so that M-x lein-swank works?
(When I type that, nothing happens).

On Tue, Oct 26, 2010 at 1:17 PM, Drew Raines aarai...@gmail.com wrote:
 It's subjective.  I like M-x lein-swank because it retains control of
 the swank process as an inferior-lisp, which lets you do things
 discussed earlier in the thread.  There was swank-clojure-project a
 while back, but that's deprecated.  There is also durendal[1], which
 contains another way to start swank, but it's basically a wrapper
 around lein-swank.

 -Drew


-- 
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: Images in autodoc?

2010-10-26 Thread Chris Maier
 On Tue, Oct 26, 2010 at 4:44 PM, Timo Mihaljov noid@gmail.com wrote:
 If you wanted to get real fancy, you could even check if the code
 block is a list, and then resolve each symbol inside the list, so
 that, for example, resolve's docstring would look like this at the
 REPL:

 user= (doc resolve)
 -
 clojure.core/resolve
 ([sym])
  same as `(ns-resolve *ns* sym)`

 But in the HTML documentation `ns-resolve` and `*ns*` would be
 hyperlinks.

That is slick.

If there's any way I can help out, too, sign me up.

Chris

-- 
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-contrib 1.3.0-alpha2 deployed to build.clojure.org

2010-10-26 Thread Stuart Sierra
blah

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


Odds for tail calls in JVM

2010-10-26 Thread Aravindh Johendran
John Rose of Oracle has posted a very articulate message on the
chances of having tail calls in the JVM.
http://mail.openjdk.java.net/pipermail/mlvm-dev/2010-October/002016.html

I feel pessimistic about the chances. I doubt tail calls will be a
priority for Oracle and IBM. I don't even see it mentioned on the list
of things for JDK 7 and 8. Maybe it'll get tacked on to the Project
Lambda JSR.

BTW, if you follow the link on the post to the discussion in the
Fortress blog, why is Guy Steele unable to easily justify tail calls
in the real world in a blog post in response to jyasskin?







-- 
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: Odds for tail calls in JVM

2010-10-26 Thread Aravindh Johendran
Sorry, forgot to post the link discussing upcoming jdk features:

http://blogs.sun.com/mr/entry/plan_b_details

-- 
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: Question about lein swank and emacs

2010-10-26 Thread Drew Raines
Mark Engelberg wrote:

 So what steps do you need to go through so that M-x lein-swank
 works?  (When I type that, nothing happens).

Oh.  I forgot that's not part of lein proper.  Phil posted some
code earlier this year that binds a process started by `lein swank`
to a *lein-swank* buffer.

http://groups.google.com/group/swank-clojure/msg/b7135fd33cb1c10d

Then you'll be able to M-x lein-swank to start or restart your swank.

-Drew

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


challenge with vectors

2010-10-26 Thread Glen Rubin
I have a sequence like this:

[ [a b] [a b] [a b] [a b] ]

where a and b are numbers.  I would like to return the vector and its
index for which b is the least in this collection.

For example, if my data is as follows

[ [22 5] [56 8] [99 3] [43 76] ]

I would like to return 3rd vector in the collection where b is lowest
[99 3], but I also would like to know that it is the 3rd vector, so
maybe something like:

[99 3 3]

any suggestions???

thx a mil!!

-- 
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: challenge with vectors

2010-10-26 Thread Stuart Campbell
On 27 October 2010 12:54, Glen Rubin rubing...@gmail.com wrote:

 I have a sequence like this:

 [ [a b] [a b] [a b] [a b] ]

 where a and b are numbers.  I would like to return the vector and its
 index for which b is the least in this collection.

 For example, if my data is as follows

 [ [22 5] [56 8] [99 3] [43 76] ]

 I would like to return 3rd vector in the collection where b is lowest
 [99 3], but I also would like to know that it is the 3rd vector, so
 maybe something like:

 [99 3 3]

 any suggestions???

 thx a mil!!


Hi Glen,

Here's a solution:

user (- [[22 5] [56 8] [99 3] [43 76]]
   (map-indexed #(conj %2 (inc %1)))
   (sort-by second)
   (first))
[99 3 3]

Regards,
Stuart

-- 
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: challenge with vectors

2010-10-26 Thread Btsai
Is it ok if the index starts at 0?

(use '[clojure.contrib.seq :only (indexed)])

(defn get-min-and-index [coll]
  (apply min-key #(second (second %)) (indexed coll)))

user= (get-min-and-index [[22 5] [56 8] [99 3] [43 76]])
[2 [99 3]]

On Oct 26, 7:54 pm, Glen Rubin rubing...@gmail.com wrote:
 I have a sequence like this:

 [ [a b] [a b] [a b] [a b] ]

 where a and b are numbers.  I would like to return the vector and its
 index for which b is the least in this collection.

 For example, if my data is as follows

 [ [22 5] [56 8] [99 3] [43 76] ]

 I would like to return 3rd vector in the collection where b is lowest
 [99 3], but I also would like to know that it is the 3rd vector, so
 maybe something like:

 [99 3 3]

 any suggestions???

 thx a mil!!

-- 
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-contrib 1.3.0-alpha2 deployed to build.clojure.org

2010-10-26 Thread Btsai
Is there still a complete jar somewhere that has all the modules?  If
so, I can't seem to find it.  Or is that a thing of the past now?

On Oct 26, 6:03 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:
 blah

-- 
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: Odds for tail calls in JVM

2010-10-26 Thread Tom Marble
On 10/26/2010 07:34 PM, Aravindh Johendran wrote:
 John Rose of Oracle has posted a very articulate message on the
 chances of having tail calls in the JVM.
 http://mail.openjdk.java.net/pipermail/mlvm-dev/2010-October/002016.html
 
 I feel pessimistic about the chances. I doubt tail calls will be a
 priority for Oracle and IBM. I don't even see it mentioned on the list
 of things for JDK 7 and 8. Maybe it'll get tacked on to the Project
 Lambda JSR.

Well, realize that 2 out of 3 isn't too bad (1. Engineering,
2. Design, 3. Standardization).

And, in general, we can be fairly concerned about standardization
via the JCP due to Doug Lea's departure [0] [1].

On the bright side the community has really leveraged and added
cool features to OpenJDK [2] [3].  Even MacOS hackers have indicated
interest in OpenJDK [4] [5] [6]. One viewpoint is that
desktop Java is dead, it really only impacts a couple IDE's anyway
and developers can use emacs.  Clearly the goal to make the platform
*simple* means that any given UI binding is not going to slow the
enthusiasm for Clojure.  (And the headless MacOS port is done [7]).

At the conj I asked Rich about Clojure leveraging TCO in OpenJDK
(as well as other recent additions such as Jigsaw [8]).  He said that
Clojure relies on JDK 5 for the broadest possible platform support.
However he went on to say that for the purpose of experimenting and
proof of concept work that using OpenJDK would make sense.

So this suggests we should, among other things, consider respinning
the shootout (or other benchmarks) using Clojure 1.3 (with Rich's
latest fixes, and Stu's updated (removed) performance tricks) and
OpenJDK *trunk*.  Sounds like fun!

Regards,

--Tom

[0] http://gee.cs.oswego.edu/dl/html/jcp22oct10.html
[1] http://blogs.oracle.com/henrik/2010/10/doug_lea_leaves_the_jcp_ec.html
[2] 
http://gnu.wildebeest.org/blog/mjw/2010/10/22/doug-lea-on-leaving-the-jcp-and-the-way-forward/
[3] http://icedtea.classpath.org/wiki/Main_Page
[4] 
http://blogs.computerworlduk.com/simon-says/2010/10/apple-tosses-java-off-the-mac/index.htm
[5] http://www.subfurther.com/blog/?p=1305
[6] http://www.petitionspot.com/petitions/macjdk
[7] http://landonf.bikemonkey.org/static/soylatte/
[8] http://penta.debconf.org/dc10_schedule/events/558.en.html

-- 
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: challenge with vectors

2010-10-26 Thread Aravindh Johendran
What kind of an answer are you looking for? Just the quickest way to
do it? Do you want an idiomatic clojure solution or are you learning
functional programming using clojure? There are many ways to do this.
Others have provided cool solutions.

Here's a way of doing it if you are interested in filled-with-fun bare-
bones no-frills functional code. It will NOT be the fastest solution.


(defn min-b [vctr collection-function]
  (let [current-item (first vctr)]
(cond (empty? vctr) (collection-function [] -1)
  (= 1 (count vctr)) (collection-function current-item 1)
  :else (min-b (rest vctr) (fn [next-item pos] (if ( (second next-
item) (second current-item))
 
(collection-function next-item (inc pos))
 
(collection-function current-item pos)))

The initial function you pass in will contain the logic to print out
the result. Over here we are making a simple list out of the result .
You can modify it to print out whatever you want done with the result
(min-b [ [22 5] [56 8] [99 3] [43 76] ]  (fn [x y] (list x y)))
or
(min-b [ [22 5] [56 8] [99 3] [43 76] ]  (fn [x y] (println (str
Value:  x  Position:  y


If you have a large data set and are worried about blowing the stack,
you'll have to use recur and trampoline. Notice the extra # before the
returned functions

(defn min-b [vctr collection-function]
  (let [current-item (first vctr)]
(cond (empty? vctr) (collection-function [] -1)
  (= 1 (count vctr)) #(collection-function current-item 1)
  :else (recur (rest vctr) (fn [next-item pos] (if ( (second next-
item) (second current-item))
 
#(collection-function next-item (inc pos))
 
#(collection-function current-item pos)))

(trampoline (min-b (vec (take 5000 (cycle [ [22 5] [56 8] [99 3] [43
76] ])))  (fn [x y] (list x y


This example should demonstrate why hard tail calls are not a mere
recursion thing.

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


a function to list the namespaces that a namespace refers to ...

2010-10-26 Thread Sunil S Nandihalli
Hello everybody,
 I currently do the following to find a set of namespaces that a namespace
refers to

(- 'clojure.contrib.monads ns-refers (map #(- % second meta :ns
ns-name)) set)

It is not that it is very hard but .. an inbuilt function might be better
..

or even better is if somebody just mentions as to how it is supposed to be
 done.

 Thanks .. for reading this ..
Sunil.

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