Is apply not as lazy as it could be?

2011-05-17 Thread Ken Wesson
It seems that apply realizes one more element than is required to a)
bind all non-rest arguments and b) determine/validate the arity, in
the case that the function has a rest argument.

user= (defn report-seq [] (iterate (fn [n] (println n) (inc n)) 0))
#'user/report-seq
user= (doall (take 3 (report-seq)))
0
1
(0 1 2)

As you can see, this sequence's realization has side effects for all
but the first element. Realizing each number after that prints the
number that is one lower.

user= (defn test1 [ xs])
#'user/test1

This function has a single rest argument and never uses it.

user= (apply test1 (report-seq))
0
nil

As you can see, apply causes it to call the iterate function once, so
it's realizing both the 0 and the 1 at the start of the sequence. In
theory it doesn't need to realize any.

user= (defn test2 [x  xs])
#'user/test2

Has a single argument before the rest argument.

user= (apply test2 (report-seq))
0
1
nil

Apply with this one realizes three elements.

user= (defn test3 [x1 x2  xs])
#'user/test3
user= (apply test3 (report-seq))
0
1
2
nil

And now four. It seems, in general, to look two elements ahead of
where it needs to.

Even worse, if given a function without a rest argument and a too-long
sequence, it doesn't just halt and generate an arity exception as soon
as it discovers 1 more element in the sequence than the maximum arity
of the function:

user= (defn test4 [x1 x2])
#'user/test4
user= (apply test4 (take 10 (report-seq)))
0
1
2
3
4
5
6
7
8
#CompilerException java.lang.IllegalArgumentException: Wrong number
of args (10) passed to: user$eval273$test4 (NO_SOURCE_FILE:0)

It realizes the entire seq! The best case would have been if it had printed

user= (defn test4 [x1 x2])
#'user/test4
user= (apply test4 (take 10 (report-seq)))
0
1
#CompilerException java.lang.IllegalArgumentException: Wrong number
of args (10) passed to: user$eval273$test4 (NO_SOURCE_FILE:0)

i.e. realized the 0, then the 1 (printing 0), then the 2 (printing 1)
as it checked whether there were any more elements in the sequence.

Is there a solid reason for this behavior of apply? If you ask me,
when the function has rest arguments, it should realize only as much
of the sequence as is needed to bind the non-rest arguments and bind
the rest argument to (nthrest x the-input-seq), realizing two fewer
elements than the current implementation; or if it's desired that the
rest argument be bound to nil if that's empty, to (nthnext x
the-input-seq), realizing one fewer. And when the function does not,
it should *never* realize more than one more than however many
elements are in the longest of the function's arglists -- one more in
the case that the sequence is longer than the longest arglist, to
discover that fact and then throw an exception.

Unless, of course, there's a very good reason (efficiency?) for the
current behavior (two-element lookahead with rest args, and apparently
calling doall or count on the sequence without).

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


Comparison of CCW and Enclojure

2011-05-17 Thread Ken Wesson
I have gotten a more recent version of CCW up and running in Eclipse
and can now compare some aspects of their behavior, particularly
regarding the REPL.


On the plus side for CCW:


* No timeout bug starting REPLs. The timeout period seems much longer
than Enclojure's. (The Enclojure Google Group seems to have a recent
thread about this issue, with a link to a patch to lengthen the
timeout recently having been posted by the maintainer, but the
instructions for applying it seem both awkward and somewhat vague --
where is the manual override for the update site URL supposed to be
set, and how do you undo this later? Not mentioned in the post. The
awkward bit being the need to override something like that at all.)


* Correct behavior of *print-length*, e.g.

= (set! *print-length* 20)
20
= (iterate inc 0)
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...)
= 42 ; Look, ma! It didn't hang!
42


* None of several NetBeans REPL bugs, such as

user= (defn foo [x]
 (let [bar (frobulate x)
user= #CompilerException java.lang.Exception: unmatched delimeter '['
user= #CompilerException java.lang.Exception: unmatched delimeter '('
#CompilerException java.lang.Exception: unmatched delimeter '('
user=

and the ability to sometimes hang or otherwise b0rk up the Enclojure
REPL by terminating a line inside a string or character constant or by
having an unescaped backslash in a string literal.


* Eclipse tools such as built-in diffs/history can easily be applied
to Clojure source files.


* Rainbow parens.


* Whole thing seems snappier, in particular not freezing for extended
periods after being left idle for a while. Memory consumption by
Eclipse seems lower than by NetBeans.


On the minus side for CCW:


* There's no easy way to restart a REPL or close one; one must close
the REPL tab and also find and kill a java process using ps/kill or
Windows Task Manager or whatever tool, depending on OS.


* There seems to be no right click menu option to (re)load a source
file (either from the open file in the editor, or from the file's
listing in the package explorer) in an open REPL. Run... will start a
new REPL for each file/reload; to (re)load in an existing REPL seems
to require select all, copy, paste, enter, which will clutter up the
REPL history with (possibly very long) blocks of code. Drag and drop
from editor to either pane of REPL does not accomplish anything
either.


* No separate option to start a project-classpath'd REPL without
loading any files initially.


* Namespace Browser is nifty, appearing to introspect on the open REPL
to maintain a set of defined symbols; similarly, autocomplete sees
your REPL-defined functions and vars. However, it won't update if a
var is redef'd with changed metadata; e.g. if you define a function
without a docstring, then redefine it with a docstring, the docstring
won't get added to the tooltip for its symbol in the Namespace
Browser. In fact, under some circumstances (I'm not sure what), it
won't update promptly to reflect a new function definition at all.
Oddly, it will update eventually but I'm not sure what triggers it. On
the other hand, it has a handy incremental search box at the top.


* Editor doesn't seem to have an option to reindent a block of code;
going line by line and hitting tab seems to be the only method
provided, short of fully-manual reindentation.


* REPL editor turns a dark gray if there's an unmatched close
delimiter, which on my monitor/system, at least, makes it difficult to
see the insertion point and paren-matching marker box, and thus to
find and remove the mismatched delimiter (or add its missing mate).
The main editor also turns dark gray under similar circumstances,
except, crucially, for the line containing the insertion point. Also,
unmatched delimiters aren't always detected, e.g. (defn foo [x (] bar)
does not flag the unmatched ( inside the arglist.


* There seems to be no easy way to get the REPL to use the -server vm.
Eclipse seems to only look for JRE runtimes, not JDK runtimes, and if
manually pointed to a JDK directory, it says it can't recognize the
runtime library, whereas if pointed to the JDK /bin subdirectory, it
says it can't recognize the java executable. So it doesn't seem to
provide a way to use the JDK's java runtime instead of the JRE's, and
the JRE's does not recognize the -server flag, at least not on
Windows, for whatever reason. The only apparent workaround is to
manually launch the JDK's java.exe with a manually-set classpath and
appropriate arguments to run the REPL server in it, and then manually
connect to that server to get a REPL pane in Eclipse.



All in all, the bugs/awkwardness factor seems similar for both options
at this point. There is an odd pattern though. Most of the Enclojure
bugs make it easier to crash the REPL and harder to restart it when it
goes, and/or make using the thing slow in general. There's a few
missing features that might be desired, such as rainbow parens. On the
CCW side, 

Re: ClojureQL and Oracle

2011-05-17 Thread Corvette
 On 19 April 2011 22:34, Michael michael-a...@db.com wrote:
 I've used it with Oracle for basic select/join/union queries. I didn't
 try any update operations. The only read operation I had a problem
 with was 'take', as Oracle doesn't support LIMIT, but then I was just
 playing around, not trying to test exhaustively.

 Ray.

There is workaround for LIMIT functionality a href=http://
groups.google.com/group/clojure/browse_thread/thread/a948a16a831c790/
fb7275000d7baf3ehere/a.

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


Re: Joy of Clojure errata: Chapter 5

2011-05-17 Thread Ken Wesson
On Mon, May 16, 2011 at 9:44 AM, Fogus mefo...@gmail.com wrote:
 Hi Ken,

 Thanks for this.  I agree that a different name would be much more
 clear.

Here's one from chapter 7. Section 7.1.2, near the end, has:

Perhaps you see a familiar pattern: we apply the column-names vector
as a function across a set of indices, building a sequence of its
elements at those indices. This action will return a sequence of the
values of that row for the supplied column names, which is then turned
into a vector so that it can then be used as the sorting function

This does not seem to be correct. It seems to be applying the row map
as a function across a seq of column names, building a sequence of its
elements at those column keys. This action will return a sequence of
the values of that row for the supplied column names, which is then
turned into a vector so that it can then be used as the sort key. The
function that *returns* the vector is the sorting function.

(Interesting that sort will sort vectors, by lexicographic ordering.
It doesn't seem to like lists, though, which is odd since the same
rule would naturally apply. (Sure it could hang on infinite seqs, but
so do lots of other functions, such as print and doall. And it could
be implemented, probably fairly easily, to consume only as much of a
seq as was needed to determine the sort position; then it would only
hang if it hit two infinite seqs that were equal, e.g. two copies of
(iterate inc 1).))

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: ClojureQL and Oracle

2011-05-17 Thread Rick Moynihan
On 19 April 2011 22:34, Michael michael-a...@db.com wrote:

 As far as I can tell, ClojureQL does not directly support Oracle. Has
 anybody been able to get Clojure QL to work with Oracle?  Are there
 plans to directly support it? Would be great to use this with Clojure
 inside the corporate ship.

While we're on this subject, does anyone know if it works with Apache
Derby / JavaDB?

R.

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


Unchecked floating point division

2011-05-17 Thread Ken Wesson
How does one perform an unchecked floating point division? (/ 1.0 0.0)
throws an exception -- what goes in place of _ to make (_ 1.0 0.0)
produce Double/POSITIVE_INFINITY? (And run faster than something that
does checking instead of just boiling down to a single FDIV
instruction post-JIT.)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

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

2011-05-17 Thread Timothy Washington
For the record, I'm trying to get a better understanding of the issues
myself. So mea culpa. I should have provided more context on technomancy's
statement. From my understanding, the issue had to do with technomancy not
getting patches accepted at a faster pace, into clojure core (anyone with
more insight, please chime in):

http://offtopic.bestinclass.dk/post/2532135003/has-clojure-development-stalled


But that's also been countered with the opposite - that Clojure has had
breakneck pace and innovation (which from my vantage point, seems to be
true). So I just took the broader acceptance / clojure stack vs. not, to be
another aspect of which direction to pull the community (or, is the
community saying yes enough). Sean, you're correct that they're not
directly related technically.


I'm a former java developer, whose tried scala, ruby, etc. And with clojure,
I haven't been this intellectually excited since I designed my first DSL :)
So I'm interested to know if there are any problems and how to address.
Thanks for the comments - clarifies things for me.



On Mon, May 16, 2011 at 11:50 PM, Ken Wesson kwess...@gmail.com wrote:

 On Mon, May 16, 2011 at 10:33 PM, Timothy Washington twash...@gmail.com
 wrote:
  This is an interesting discussion. Rich Hickey and Steve Yegge recently
  weighed in on the Seajure discussion group (and later discussed on HN).
  Yegge basically takes Laszlo's position (clojure needs to start saying
 yes),
  while Hickey takes Nick's position.
 
  http://groups.google.com/group/seajure/msg/2d2ec7ac9f2b4713
  http://news.ycombinator.com/item?id=2466731
  https://groups.google.com/group/seajure/msg/daa02d326a9ec69a

 After a cursory look at the first of these, I'd have to sympathize
 with Hickey here.

 Point 1: Yegge says To get users, languages have to say Yes. You
 can't ever say No.

 This is a false dicohtomy. It's certainly possible to say Yes some of
 the time, without saying Yes all of the time.

 Point 2: Yegge says You shouldn't force people to code in a certain
 style -- and by 'force' I mean exerting cultural pressure by saying
 things like 'If you would rather use Common Lisp, go ahead'.

 But if Clojure starts accepting any randomly suggested features into
 core (and particularly lots of mutable this, non-threadsafe that,
 etc.) it will stop being Clojure and *become* Common Lisp, or
 something more like it than like Clojure is now. And there's no point
 in that. If you want a thread-unsafe, non-lazy, mutable Common Lisp
 running on the JVM and calling Java libraries we already have Armed
 Bear. Clojure must distinguish itself rather than be very like, but
 incompatible with, an existing language if it is to survive. And so
 far it has, but not if Yegge had his way.

 But then there is a point that both sides have missed. Hickey says
 this in response: As far as 'languages have to say yes', I propose
 the following thought experiment - YesLang. Each user of YesLang will
 get a coupon entitling them to add or change one feature as their
 needs require.

 But each user of Clojure already has this coupon, and in a reusable
 form. It's called defmacro. If you want to significantly change or
 add to Clojure, you can, even down to a pretty low level. If you want
 other people to use your shiny new feature you can make your macro(s)
 and supporting code available as a library -- though people may very
 well choose not to use it. You can even implement your own reader, add
 reader macros, and preprocess your code through that if you want to,
 though nobody seems to bother, or fork the whole project, since it is
 open source.

 We also have:

  Technomancy has complained that...
   Many patches etc run afoul of that because they don't meet that
  standard.
  The problem is not that they aren't applied, it's that they are
 ignored
  without discussion of their faults

 If this is true, and the faults weren't so self-evident that they
 didn't need any discussion, then we may have a problem. I'd need to
 hear both sides of the story here though to judge, as I hope would
 anyone in a stronger position to exert influence.

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

[ANN] Radial layout for the Lacij graph visualization library

2011-05-17 Thread Pierre Allix
Hello,

I'm pleased to announce that a radial layout has been added to the
Lacij graph visualization library.

Here is an example of how the radial layout looks:

https://github.com/pallix/lacij/raw/master/resources/lacij/examples/radial.png

It's an implementation of the algorithm described in

Wills, Graham J. 1999.
   'NicheWorks: Interactive Visualization of Very Large
Graphs.'
Journal of Computational and Graphical Statistics 8(2):
190.


Please get in touch if you want to help the Lacij project and
implement additional layouts algorithms.



The library is available on GitHub:
https://github.com/pallix/lacij

and Clojars:
http://clojars.org/lacij

From the README:
Lacij is a graph visualization library written in Clojure. It allows
the display and the dynamic modification of graphs as SVG documents
that can be viewed with a Web browser or with a Swing component. Undo/
redo is supported for the dynamic modification. Automatic layout is
provided for the visualization.

-- 
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: Comparison of CCW and Enclojure

2011-05-17 Thread Chas Emerick

On May 17, 2011, at 4:57 AM, Ken Wesson wrote:

 * There's no easy way to restart a REPL or close one; one must close
 the REPL tab and also find and kill a java process using ps/kill or
 Windows Task Manager or whatever tool, depending on OS.

Cleaning up a REPL involves closing the REPL interaction view, and then 
stopping the corresponding JVM process via its console (which will be brought 
to the front if you click the corresponding button in the REPL view — which 
oddly does not have the right icon in the latest 0.2.1 release…).

Note that there are two views because there are 2+ things to manage: the JVM 
process, and N REPL sessions you have to that JVM.  We'll probably add a button 
to the REPL view itself for sessions connected to VMs started explicitly for 
REPL interaction (vs. sessions that are connected to an arbitrary network REPL) 
to close the REPL view and kill the corresponding process in one action.

 * There seems to be no right click menu option to (re)load a source
 file (either from the open file in the editor, or from the file's
 listing in the package explorer) in an open REPL. Run... will start a
 new REPL for each file/reload; to (re)load in an existing REPL seems
 to require select all, copy, paste, enter, which will clutter up the
 REPL history with (possibly very long) blocks of code. Drag and drop
 from editor to either pane of REPL does not accomplish anything
 either.

You certainly can load sources from open editors with one keystroke -- the 
default is Ctrl-L (maybe Cmd-L on Macs).  The contextual menu item (if you 
right-click in the editor itself) is under Clojure  Load File in REPL (you'll 
see the current keybinding for your environment there as well).  There are also 
shortcuts for loading only the current top-level expression, and switching to 
the current file's namespace in the current REPL.

 * No separate option to start a project-classpath'd REPL without
 loading any files initially.

Not true. Right click a project's icon in either the Package Explorer or 
Project Explorer views, and you'll find a Run As  Clojure Application menu 
item that will start a VM and connect a REPL to it.  This is roughly the only 
way I ever start REPLs (I dislike having run configurations set up that 
automatically load files on startup, etc).

 * Namespace Browser is nifty, appearing to introspect on the open REPL
 to maintain a set of defined symbols; similarly, autocomplete sees
 your REPL-defined functions and vars. However, it won't update if a
 var is redef'd with changed metadata; e.g. if you define a function
 without a docstring, then redefine it with a docstring, the docstring
 won't get added to the tooltip for its symbol in the Namespace
 Browser. In fact, under some circumstances (I'm not sure what), it
 won't update promptly to reflect a new function definition at all.
 Oddly, it will update eventually but I'm not sure what triggers it. On
 the other hand, it has a handy incremental search box at the top.

I believe the namespace browser currently only updates on a focus change.  
Perhaps not ideal, but we also don't want to constantly be polling the process 
for namespace info either…

 * Editor doesn't seem to have an option to reindent a block of code;
 going line by line and hitting tab seems to be the only method
 provided, short of fully-manual reindentation.

This is a much-requested item, and I think is blocked by some of the underlying 
parser bits.  The issue to watch: 
http://code.google.com/p/counterclockwise/issues/detail?id=139

 * There seems to be no easy way to get the REPL to use the -server vm.
 Eclipse seems to only look for JRE runtimes, not JDK runtimes, and if
 manually pointed to a JDK directory, it says it can't recognize the
 runtime library, whereas if pointed to the JDK /bin subdirectory, it
 says it can't recognize the java executable. So it doesn't seem to
 provide a way to use the JDK's java runtime instead of the JRE's, and
 the JRE's does not recognize the -server flag, at least not on
 Windows, for whatever reason. The only apparent workaround is to
 manually launch the JDK's java.exe with a manually-set classpath and
 appropriate arguments to run the REPL server in it, and then manually
 connect to that server to get a REPL pane in Eclipse.

This is very easy to set up.  First, the JVM stuff is all eclipse-land, and 
definitely supports using JDKs.  Perhaps the relevant documentation would help?

http://help.eclipse.org/helios/topic/org.eclipse.jdt.doc.user/tasks/tasks-JREs.htm

The Java  Installed JREs panel in the Eclipse preferences is wanting JDK home 
directories, not /bin directories or any other.

You can set -server (or any other VM argument) for any REPL configuration by 
going to the Run  Run Configurations menu item.  In the Run Configurations 
window, you'll see all of the configs associated with REPLs you've started in 
the past; clicking on any of them will allow you to modify command line args, 
VM args, make manual 

Re: Clojure stack

2011-05-17 Thread Chas Emerick
That particular soap opera found its local minima here:

http://news.ycombinator.com/item?id=2053908

I don't think that that is germane to the Clojure stack question though.

There are innumerable ways to assemble Clojure applications for any scale 
desired; they're discussed here and in #clojure and on Twitter daily.  So far, 
no one has staked out a claim on the Enterprise Clojure stack, which will 
simply be a subset of those ways of assembling Clojure apps plus probably 
something approaching a metric ton of EAI glue to be able to plug into the 
legacy systems of the customers that would find such a stack desirable.  
There's nothing stopping someone (or five someones) from the Clojure community 
doing exactly that.

The tooling part of Typesafe is interesting — it would seem that they're simply 
bundling the Eclipse Scala plugin (a very sane choice IMO, given Eclipse's 
market position).  Again, the same could be done for any of the Clojure 
development environments in conjunction with an Enterprise Clojure stack.  
This is a little tougher given the more fractured state of Clojure tooling.  A 
company making this play would need to make sure that their endorsed tooling 
was clearly separated from the pack (as the Eclipse Scala plugin already was 
AFAIK).

Finally, there's no reason why people need to restrict themselves to the 
enterprise when contemplating commercial, Clojure-centric endeavors.  There 
are a _lot_ of domains for which Clojure provides attractive leverage, and if 
you can credibly assemble an offering that surrounds Clojure with 
domain-specific bits to make it shine and outshine the incumbent 
language/technology/platform/whatever, it might be worth taking a swing.  
Serious data analysis is an obvious trendy option: Clojure + 
Incanter/Clojuratica + a bunch of additional goodies and polish + some 
pre-cooked datasets/streams would probably be a very compelling start depending 
on which industries you'd like to target.

- Chas

On May 17, 2011, at 8:34 AM, Timothy Washington wrote:

 For the record, I'm trying to get a better understanding of the issues 
 myself. So mea culpa. I should have provided more context on technomancy's 
 statement. From my understanding, the issue had to do with technomancy not 
 getting patches accepted at a faster pace, into clojure core (anyone with 
 more insight, please chime in): 
 http://offtopic.bestinclass.dk/post/2532135003/has-clojure-development-stalled
 
 But that's also been countered with the opposite - that Clojure has had 
 breakneck pace and innovation (which from my vantage point, seems to be 
 true). So I just took the broader acceptance / clojure stack vs. not, to be 
 another aspect of which direction to pull the community (or, is the community 
 saying yes enough). Sean, you're correct that they're not directly related 
 technically. 
 
 I'm a former java developer, whose tried scala, ruby, etc. And with clojure, 
 I haven't been this intellectually excited since I designed my first DSL :) 
 So I'm interested to know if there are any problems and how to address. 
 Thanks for the comments - clarifies things for me. 
 
 
 
 On Mon, May 16, 2011 at 11:50 PM, Ken Wesson kwess...@gmail.com wrote:
 On Mon, May 16, 2011 at 10:33 PM, Timothy Washington twash...@gmail.com 
 wrote:
  This is an interesting discussion. Rich Hickey and Steve Yegge recently
  weighed in on the Seajure discussion group (and later discussed on HN).
  Yegge basically takes Laszlo's position (clojure needs to start saying yes),
  while Hickey takes Nick's position.
 
  http://groups.google.com/group/seajure/msg/2d2ec7ac9f2b4713
  http://news.ycombinator.com/item?id=2466731
  https://groups.google.com/group/seajure/msg/daa02d326a9ec69a
 
 After a cursory look at the first of these, I'd have to sympathize
 with Hickey here.
 
 Point 1: Yegge says To get users, languages have to say Yes. You
 can't ever say No.
 
 This is a false dicohtomy. It's certainly possible to say Yes some of
 the time, without saying Yes all of the time.
 
 Point 2: Yegge says You shouldn't force people to code in a certain
 style -- and by 'force' I mean exerting cultural pressure by saying
 things like 'If you would rather use Common Lisp, go ahead'.
 
 But if Clojure starts accepting any randomly suggested features into
 core (and particularly lots of mutable this, non-threadsafe that,
 etc.) it will stop being Clojure and *become* Common Lisp, or
 something more like it than like Clojure is now. And there's no point
 in that. If you want a thread-unsafe, non-lazy, mutable Common Lisp
 running on the JVM and calling Java libraries we already have Armed
 Bear. Clojure must distinguish itself rather than be very like, but
 incompatible with, an existing language if it is to survive. And so
 far it has, but not if Yegge had his way.
 
 But then there is a point that both sides have missed. Hickey says
 this in response: As far as 'languages have to say yes', I propose
 the following thought 

Clojure ant tasks: Now with Clojure 1.2

2011-05-17 Thread Ilya Kasnacheev
Hi *,

As if somebody cared, I made clojure-ant-tasks to run with Clojure 1.2

https://github.com/alamar/clojure-ant-tasks

Here is the checklist of things I want to implement but hasn't yet in
case I forget something:

* Fix a bug where compilepath property on clojure-compile is relative
to current work dir, not to the project build root.
* Add support of junit/TAP output for clojure-test.
* Possibly write Teamcity output.

Otherwise it works just fine.

By the way, if I write (with-teamcity-output) for tests, is there a
chance it would be accepted into Clojure mainline? The teamcity output
format is documented here:
http://confluence.jetbrains.net/display/TCD6/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingTests
And would surely be handy for people who want painless teamcity
integration.

-- 
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: Learning Idiomatic Clojure

2011-05-17 Thread J.R. Garcia
Thanks all for the recommendation of The Joy of Clojure! I received my
copy in the mail about two hours ago and I've already read up to
Chapter 2 (am I the only that reads the foreword and
acknowledgments?). It's hard to work with this book sitting next to
me. It's been great so far!

Thanks again,

J.R. Garcia

On May 12, 5:27 pm, Paul deGrandis paul.degran...@gmail.com wrote:
 I'll also jump on that, I'm on my second or third full read of Joy of
 Clojure.  Just a great book about the why and when of the language
 features (why does feature X exist, when should I use it, when am I
 abusing it).

 Paul

 On May 12, 2:55 pm, Sean Corfield seancorfi...@gmail.com wrote:







  I'll +1 on The Joy of Clojure. I have the PDF on my iPhone and dip
  into it early and often. Probably on my fourth full read of it now on
  my iPad too.

  On Thu, May 12, 2011 at 9:31 AM, Islon Scherer islonsche...@gmail.com 
  wrote:
   Read the joy of clojure, it's an amazing book that will teach you the
   way 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


Re: Clojure stack

2011-05-17 Thread Sean Corfield
On Tue, May 17, 2011 at 5:34 AM, Timothy Washington twash...@gmail.com wrote:
 I'm a former java developer, whose tried scala, ruby, etc. And with clojure,
 I haven't been this intellectually excited since I designed my first DSL :)

My commercial background is primarily (in historical order): C, C++,
Java, CFML - then later Groovy, Scala and now Clojure. Back at
university, I worked with Lisp a fair bit (and Prolog) and spent three
years doing research on functional language design and implementation
- then OO came along (with C++) and steamrollered everything else :)
I'm very pleased to see functional programming being taken seriously
again these days and attracting people from mainstream / OO
backgrounds!

 So I'm interested to know if there are any problems and how to address.

As Chas and others have hinted, tooling support is fairly immature for
Clojure and there's quite a split between the old school Lispers
with Emacs / Slime / Swank / etc (not intended as a knock but it seems
the folks who favor this stuff are long time Emacs and/or Lisp users?)
and the former Java devs with Eclipse / IntelliJ / NetBeans and
their plugins. Even on the build tool side we have Leiningen, Cake and
Maven fans. It's hard to tell whether a single choice at any level
will become the clear winner (and I'm not convinced such a thing
would be a good idea).

If you have a favorite IDE with your Java / Scala background, there's
a Clojure plugin for it that will probably suit you.

The game changer is likely to be having a live REPL in your IDE and
using it to adopt a very incremental, experimental approach to writing
code. I'm just getting into that mode now (after first picking up
Clojure about a year ago!) and finding it to be immensely productive -
and a radical change to how I used to develop. I find it much easier
now to figure out and build up solutions, a piece at a time, teasing
tests and small reusable functions out of my experiments so I
gradually evolve toward a clean, well-tested solution to each problem.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

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


Re: Joy of Clojure errata: Chapter 5

2011-05-17 Thread Alan
On May 17, 4:35 am, Ken Wesson kwess...@gmail.com wrote:
 On Mon, May 16, 2011 at 9:44 AM, Fogus mefo...@gmail.com wrote:
  Hi Ken,

  Thanks for this.  I agree that a different name would be much more
  clear.

 Here's one from chapter 7. Section 7.1.2, near the end, has:

 Perhaps you see a familiar pattern: we apply the column-names vector
 as a function across a set of indices, building a sequence of its
 elements at those indices. This action will return a sequence of the
 values of that row for the supplied column names, which is then turned
 into a vector so that it can then be used as the sorting function

 This does not seem to be correct. It seems to be applying the row map
 as a function across a seq of column names, building a sequence of its
 elements at those column keys. This action will return a sequence of
 the values of that row for the supplied column names, which is then
 turned into a vector so that it can then be used as the sort key. The
 function that *returns* the vector is the sorting function.

 (Interesting that sort will sort vectors, by lexicographic ordering.
 It doesn't seem to like lists, though, which is odd since the same
 rule would naturally apply. (Sure it could hang on infinite seqs, but
 so do lots of other functions, such as print and doall. And it could
 be implemented, probably fairly easily, to consume only as much of a
 seq as was needed to determine the sort position; then it would only
 hang if it hit two infinite seqs that were equal, e.g. two copies of
 (iterate inc 1).))

Vectors implement Comparable, and lists don't. I don't see any clear
reason for this, but patching sort is the wrong answer: instead
implement Comparable for lists.

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

2011-05-17 Thread Alan
On May 17, 11:00 am, Sean Corfield seancorfi...@gmail.com wrote:
 On Tue, May 17, 2011 at 5:34 AM, Timothy Washington twash...@gmail.com 
 wrote:
  I'm a former java developer, whose tried scala, ruby, etc. And with clojure,
  I haven't been this intellectually excited since I designed my first DSL :)

 My commercial background is primarily (in historical order): C, C++,
 Java, CFML - then later Groovy, Scala and now Clojure. Back at
 university, I worked with Lisp a fair bit (and Prolog) and spent three
 years doing research on functional language design and implementation
 - then OO came along (with C++) and steamrollered everything else :)
 I'm very pleased to see functional programming being taken seriously
 again these days and attracting people from mainstream / OO
 backgrounds!

Me! I used Java and C for years before my abortive attempt to learn
CL, followed by a more enthusiastic leap towards Clojure.

 As Chas and others have hinted, tooling support is fairly immature for
 Clojure and there's quite a split between the old school Lispers
 with Emacs / Slime / Swank / etc (not intended as a knock but it seems
 the folks who favor this stuff are long time Emacs and/or Lisp users?)
 and the former Java devs with Eclipse / IntelliJ / NetBeans and
 their plugins.

For what it's worth, a year ago I had never touched Emacs and was
terrified by it, partly because of the attitude of superiority Emacs
users tend to have. But I was learning lisp, and Emacs was reported to
be the best tool for lisp, so by God I learned Emacs. A year later: I
still use Eclipse for Java, and occasionally for its Team SVN
features, but I use Emacs for everything else. I try to hide my new-
found attitude of superiority :).

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

2011-05-17 Thread László Török
Chas, Sean, Alan,

thank you for taking the discussion back on track. I completely support
Rich's position re protecting Clojure form becoming bloated with half-baked
features. (half-baked = conceptually and practically mature)

I'm happy to have Rich as a benevolent dictator for life :) ( live a happy
and long life, Rich, a keep the Clojure ball rolling! ).

However, I'm not really ready to accept the fact that you have to be an
old-school lisper (with Emacs et. al) to be able to use it with pleasure. I
tried Emacs on Ubuntu, and I quit after two weeks, because I was simply much
more productive using Enclojure. Maybe it's unfair, but every time I try a
functional language IDE, I compare it to coding in F# using Visual Studio,
which was a very pleasant experience.

I'd say, it still wasn't quite 100%, but the editor, auto-complete, the REPL
got better with every release.

I'm probably unfair, as Enclojure will probably never get the financial
backing as F# and VS has.

Maybe I'll just try using Aquamacs again, and this time I'll try harder...

Bests,

Laszlo

2011/5/17 Alan a...@malloys.org

 On May 17, 11:00 am, Sean Corfield seancorfi...@gmail.com wrote:
  On Tue, May 17, 2011 at 5:34 AM, Timothy Washington twash...@gmail.com
 wrote:
   I'm a former java developer, whose tried scala, ruby, etc. And with
 clojure,
   I haven't been this intellectually excited since I designed my first
 DSL :)
 
  My commercial background is primarily (in historical order): C, C++,
  Java, CFML - then later Groovy, Scala and now Clojure. Back at
  university, I worked with Lisp a fair bit (and Prolog) and spent three
  years doing research on functional language design and implementation
  - then OO came along (with C++) and steamrollered everything else :)
  I'm very pleased to see functional programming being taken seriously
  again these days and attracting people from mainstream / OO
  backgrounds!

 Me! I used Java and C for years before my abortive attempt to learn
 CL, followed by a more enthusiastic leap towards Clojure.

  As Chas and others have hinted, tooling support is fairly immature for
  Clojure and there's quite a split between the old school Lispers
  with Emacs / Slime / Swank / etc (not intended as a knock but it seems
  the folks who favor this stuff are long time Emacs and/or Lisp users?)
  and the former Java devs with Eclipse / IntelliJ / NetBeans and
  their plugins.

 For what it's worth, a year ago I had never touched Emacs and was
 terrified by it, partly because of the attitude of superiority Emacs
 users tend to have. But I was learning lisp, and Emacs was reported to
 be the best tool for lisp, so by God I learned Emacs. A year later: I
 still use Eclipse for Java, and occasionally for its Team SVN
 features, but I use Emacs for everything else. I try to hide my new-
 found attitude of superiority :).

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




-- 
László Török

Skype: laczoka2000
Twitter: @laczoka

-- 
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 build failure on win7

2011-05-17 Thread chris nuernberger
Hey all,

I am running a fairly new win7-64 system (jdk6-64) and the maven build
of clojure contrib fails due to test failures in at least logging.

Do you want stack traces and debug logs and such?

Chris

-- 
A foolish consistency is the hobgoblin of little minds - Emerson

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

2011-05-17 Thread Sean Corfield
On Tue, May 17, 2011 at 11:16 AM, Alan a...@malloys.org wrote:
 For what it's worth, a year ago I had never touched Emacs and was
 terrified by it, partly because of the attitude of superiority Emacs
 users tend to have. But I was learning lisp, and Emacs was reported to
 be the best tool for lisp, so by God I learned Emacs. A year later: I
 still use Eclipse for Java, and occasionally for its Team SVN
 features, but I use Emacs for everything else. I try to hide my new-
 found attitude of superiority :).

I used Emacs fairly heavily back in the version 18 / 19 days (I had to
go look that up in Wikipedia... I actually thought I'd been using
Emacs 17 so maybe I started with it earlier than I now think), and it
was the best thing around (for the C and assembler I was writing).

Over the years, I've gotten used to other IDEs that feel more
integrated with their environment. Emacs hasn't really changed (which
is part of its strength, if you like that). Because of its association
with Lisp and the fact that so many Clojurians swear by Emacs, I tried
it again recently for Clojure but I couldn't get back into it after so
many years using Eclipse... and since I do work in several other
JVM-based languages, Eclipse was really a better fit for me anyway.
It's clearly a very personal choice tho' - I know lots of people who
don't like Eclipse and prefer IntelliJ or NetBeans, both of which I've
tried and can't get along with either :(
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

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


extending types

2011-05-17 Thread jlk
Hello

Apologies if I'm misunderstanding something here, but is it possible
to easily extend to a new java type?  For example:

proxy - allows you to implement methods that are already defined in
an interface or class, so you can redefine methods

(proxy [ClassA] []
(thisMustBeDefinedInClassA [] ...)

extend-type - allows you to extend an existing java type

(extend-type [String]
AProtocol
(nowAllStringsCanDothis [this] ...)

but what about

(proxy2  [String]
AProtocol?
(theseBehaveAsStringsWithThisAdded [] ...)

leaving regular Strings unaffected?

do I need to fall back to using gen-class?

Thank you for any suggestions!


- Lachlan

-- 
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: Joy of Clojure errata: Chapter 5

2011-05-17 Thread pmbauer
Manning's forum would be a better home for errata than the Clojure mailing 
list.
http://www.manning-sandbox.com/forum.jspa?forumID=624

-- 
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 build failure on win7

2011-05-17 Thread pmbauer
clojure-contrib was left broken 1.5 months past.
clojure/core are no longer maintaining the monolithic clojure-contrib 
library as it is deprecated.

A bunch of new projects are starting to fill the void (see listing at 
https://github.com/clojure)
Some functionality isn't making the migration - some from lack of support - 
and much work is left.

For details: http://dev.clojure.org/display/design/Clojure+Contrib

-- 
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: Comparison of CCW and Enclojure

2011-05-17 Thread Sean Corfield
On Tue, May 17, 2011 at 6:04 AM, Chas Emerick cemer...@snowtide.com wrote:
 You certainly can load sources from open editors with one keystroke -- the 
 default is Ctrl-L (maybe Cmd-L on Macs).

Opt-Cmd-L on Mac. Ctl-Alt-S on Ubuntu. The difference between
platforms is kind of annoying (since I switch back and forth between
Mac and Ubuntu a lot).

Switch namespace is Ctl-Alt-N on Mac and Ubuntu tho'.

Execute selection or top-level s-expression is ctl-enter on Ubuntu and
Shift-Cmd-X on Mac.

Navigating the REPL history is Ctl-Up / Ctl-Down on Ubuntu but that
doesn't work on Mac and I haven't figured what does...

 Not true. Right click a project's icon in either the Package Explorer or 
 Project Explorer views, and you'll find a Run As  Clojure Application menu 
 item that will start a VM and connect a REPL to it.  This is roughly the only 
 way I ever start REPLs (I dislike having run configurations set up that 
 automatically load files on startup, etc).

Ah, I hadn't thought to dig into the project context menu - nice.

BTW, CCW 0.2.0.STABLE001 on my Mac works fine with Clojure 1.3.0 if I
have nrepl 0.0.5 on the classpath. Doesn't work on Ubuntu. That might
be a useful data point for tracking down that problem I talked to you
about off-list. I'll try 0.2.1 and no nrepl on Mac and see if that
works.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

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


Re: extending types

2011-05-17 Thread Ken Wesson
On Tue, May 17, 2011 at 5:52 PM, jlk lachlan.kana...@gmail.com wrote:
 Hello

 Apologies if I'm misunderstanding something here, but is it possible
 to easily extend to a new java type?  For example:

 proxy - allows you to implement methods that are already defined in
 an interface or class, so you can redefine methods

 (proxy [ClassA] []
 (thisMustBeDefinedInClassA [] ...)

 extend-type - allows you to extend an existing java type

 (extend-type [String]
 AProtocol
 (nowAllStringsCanDothis [this] ...)

 but what about

 (proxy2  [String]
 AProtocol?
 (theseBehaveAsStringsWithThisAdded [] ...)

 leaving regular Strings unaffected?

 do I need to fall back to using gen-class?

 Thank you for any suggestions!

You can use gen-class to extend existing Java classes and add new
methods. But not String. String is final and the JVM enforces that it
can't be subclassed (unlike, say, checked exceptions, which javac
enforces but the JVM does not, hence why Clojure can lack that
feature).

What you can do is extend CharSequence to a new String-like class and
use that. The problem is that you won't be able to pass it to
functions that hint it as String and call String methods on it without
getting a CCE. Anything that assumes merely CharSequence is fine
though.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: Joy of Clojure errata: Chapter 5

2011-05-17 Thread Ken Wesson
On Tue, May 17, 2011 at 5:57 PM, pmbauer paul.michael.ba...@gmail.com wrote:
 Manning's forum would be a better home for errata than the Clojure mailing
 list.
 http://www.manning-sandbox.com/forum.jspa?forumID=624

Sorry; I don't really care for web forums much. I think mailing lists
and Usenet are much to be preferred.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: Comparison of CCW and Enclojure

2011-05-17 Thread Ken Wesson
On Tue, May 17, 2011 at 9:04 AM, Chas Emerick cemer...@snowtide.com wrote:

 On May 17, 2011, at 4:57 AM, Ken Wesson wrote:

 * There's no easy way to restart a REPL or close one; one must close
 the REPL tab and also find and kill a java process using ps/kill or
 Windows Task Manager or whatever tool, depending on OS.

 Cleaning up a REPL involves closing the REPL interaction view, and then 
 stopping the corresponding JVM process via its console (which will be brought 
 to the front if you click the corresponding button in the REPL view — which 
 oddly does not have the right icon in the latest 0.2.1 release…).

 Note that there are two views because there are 2+ things to manage: the JVM 
 process, and N REPL sessions you have to that JVM.  We'll probably add a 
 button to the REPL view itself for sessions connected to VMs started 
 explicitly for REPL interaction (vs. sessions that are connected to an 
 arbitrary network REPL) to close the REPL view and kill the corresponding 
 process in one action.

Thanks.

So, it can manage multiple REPLs on the same JVM? If one hangs (e.g.
an infinite loop) is there a way to start a second REPL on that JVM,
then get some kind of handle on the hung thread and kill it with
Thread.stop()? That would lead to a greater capability for session
recovery than what Enclojure currently seems to have.

 * There seems to be no right click menu option to (re)load a source
 file (either from the open file in the editor, or from the file's
 listing in the package explorer) in an open REPL. Run... will start a
 new REPL for each file/reload; to (re)load in an existing REPL seems
 to require select all, copy, paste, enter, which will clutter up the
 REPL history with (possibly very long) blocks of code. Drag and drop
 from editor to either pane of REPL does not accomplish anything
 either.

 You certainly can load sources from open editors with one keystroke -- the 
 default is Ctrl-L (maybe Cmd-L on Macs).  The contextual menu item (if you 
 right-click in the editor itself) is under Clojure  Load File in REPL 
 (you'll see the current keybinding for your environment there as well).  
 There are also shortcuts for loading only the current top-level expression, 
 and switching to the current file's namespace in the current REPL.

Ooh! Missed that, somehow. I think because it's buried in a submenu,
and not the same one (Run As) where the REPL can be launched.
Enclojure added most of these to the top level of the right click menu
in .clj edit panes, by contrast.

Good, good. I see some nifty stuff here like evaluate top level sexp
under the cursor and run tests in REPL, as well as load and change to
file N/S which I used frequently from Enclojure.

 * No separate option to start a project-classpath'd REPL without
 loading any files initially.

 Not true. Right click a project's icon in either the Package Explorer or 
 Project Explorer views, and you'll find a Run As  Clojure Application menu 
 item that will start a VM and connect a REPL to it.  This is roughly the only 
 way I ever start REPLs (I dislike having run configurations set up that 
 automatically load files on startup, etc).

Ah. I thought that attempted to build and run an AOT-compiled Clojure
project with a -main function. Clojure Application suggests that.
Clojure REPL might be better text for that menu option. Also in the
single-file Run As menu that loads the file.

 * Namespace Browser is nifty, appearing to introspect on the open REPL
 to maintain a set of defined symbols; similarly, autocomplete sees
 your REPL-defined functions and vars. However, it won't update if a
 var is redef'd with changed metadata; e.g. if you define a function
 without a docstring, then redefine it with a docstring, the docstring
 won't get added to the tooltip for its symbol in the Namespace
 Browser. In fact, under some circumstances (I'm not sure what), it
 won't update promptly to reflect a new function definition at all.
 Oddly, it will update eventually but I'm not sure what triggers it. On
 the other hand, it has a handy incremental search box at the top.

 I believe the namespace browser currently only updates on a focus change.  
 Perhaps not ideal, but we also don't want to constantly be polling the 
 process for namespace info either…

So it's a pull model, rather than a push. The ideal architecture
would be a push one, where you hooked into the REPL process to get
notification pushed to the namespace browser functionality on any
change to any namespace. In principle, if you could get into the guts
of the namespace's mappings and add a watch to it with add-watch ...
but that might not be possible without modifying
clojure.lang.Namespace's Java source.

 * Editor doesn't seem to have an option to reindent a block of code;
 going line by line and hitting tab seems to be the only method
 provided, short of fully-manual reindentation.

 This is a much-requested item, and I think is blocked by some of the 
 underlying parser bits.  

Re: Comparison of CCW and Enclojure

2011-05-17 Thread Sean Corfield
On Tue, May 17, 2011 at 4:09 PM, Sean Corfield seancorfi...@gmail.com wrote:
 BTW, CCW 0.2.0.STABLE001 on my Mac works fine with Clojure 1.3.0 if I
 have nrepl 0.0.5 on the classpath. Doesn't work on Ubuntu. That might
 be a useful data point for tracking down that problem I talked to you
 about off-list. I'll try 0.2.1 and no nrepl on Mac and see if that
 works.

It does. I'm able to start the REPL by right-clicking on the project
in the navigator and Run As... Clojure Application for Clojure
1.3.0-alpha7 with CCW 0.2.1 with nrepl 0.0.5 on my classpath.

So I went back to my Ubuntu netbook and tried it there: I can always
start the REPL by right-clicking on the project - but it always fails
trying to start it via Load File in REPL (for Clojure 1.3.0). So I
have a workaround now!
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

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


Re: Comparison of CCW and Enclojure

2011-05-17 Thread Sean Corfield
On Tue, May 17, 2011 at 6:50 PM, Ken Wesson kwess...@gmail.com wrote:
 There doesn't seem to be a way to get CCW's version reported, short
 perhaps of triggering an attempt to update it, but I think it's
 0.2.something.

Help  About Eclipse SDK  Installation Details - You'll see a list of
all installed plugins and their versions.

 2. Enter in the middle of a REPL submission breaks the line even if
 the sexp lacks unmatched delims, unlike Enclojure.

I've gotten used to using ctl-enter or shift-cmd-x to just submit the
form I'm typing so I don't need to jump to the end of the form. I like
that the REPL has full editing capability, just like a source file -
including using enter to add line breaks.

 3. A few things seem a bit less self-evident without looking at either
 Eclipse or CCW documentation than is the case with NB/Enclojure,
 including (sorry to harp on this) the install's extra step and the
 behavior of some of the other things.

Well, there's certainly a lot of Eclipse functionality that is
definitely less than obvious - even with all the Eclipse documentation
out there - and I suspect some of that carries over to CCW. But, yes,
CCW's docs are... thin...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

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


Re: Joy of Clojure errata: Chapter 5

2011-05-17 Thread Aaron Bedra

On 05/17/2011 09:21 PM, Ken Wesson wrote:

On Tue, May 17, 2011 at 5:57 PM, pmbauerpaul.michael.ba...@gmail.com  wrote:

Manning's forum would be a better home for errata than the Clojure mailing
list.
http://www.manning-sandbox.com/forum.jspa?forumID=624

Sorry; I don't really care for web forums much. I think mailing lists
and Usenet are much to be preferred.

Please do use Manning's forum for this.  It will help the authors and 
the publisher track the errata in the proper way and reduce the traffic 
on this list.


--
Cheers,

Aaron Bedra
--
Clojure/core
http://clojure.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: Comparison of CCW and Enclojure

2011-05-17 Thread Chas Emerick

On May 17, 2011, at 10:42 PM, Sean Corfield wrote:

 2. Enter in the middle of a REPL submission breaks the line even if
 the sexp lacks unmatched delims, unlike Enclojure.
 
 I've gotten used to using ctl-enter or shift-cmd-x to just submit the
 form I'm typing so I don't need to jump to the end of the form. I like
 that the REPL has full editing capability, just like a source file -
 including using enter to add line breaks.

Indeed, this is very intentional.  Many people (myself included now that the 
REPL area is just a mostly-full-featured Clojure editor) do a fair bit of 
editing in the REPL input area, so Ctrl-Enter is mandatory unless you're at the 
end of the form.

 3. A few things seem a bit less self-evident without looking at either
 Eclipse or CCW documentation than is the case with NB/Enclojure,
 including (sorry to harp on this) the install's extra step and the
 behavior of some of the other things.
 
 Well, there's certainly a lot of Eclipse functionality that is
 definitely less than obvious - even with all the Eclipse documentation
 out there - and I suspect some of that carries over to CCW. But, yes,
 CCW's docs are... thin...

FWIW, if anyone likes CCW, and believes they're using it effectively, by all 
means cut a screencast or two.  That's a great way to help out the project 
assuming you're not up for contributing code, and is surely more fun than 
writing dry textual documentation.

- 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


Re: Comparison of CCW and Enclojure

2011-05-17 Thread Chas Emerick

On May 17, 2011, at 10:27 PM, Sean Corfield wrote:

 On Tue, May 17, 2011 at 4:09 PM, Sean Corfield seancorfi...@gmail.com wrote:
 BTW, CCW 0.2.0.STABLE001 on my Mac works fine with Clojure 1.3.0 if I
 have nrepl 0.0.5 on the classpath. Doesn't work on Ubuntu. That might
 be a useful data point for tracking down that problem I talked to you
 about off-list. I'll try 0.2.1 and no nrepl on Mac and see if that
 works.
 
 It does. I'm able to start the REPL by right-clicking on the project
 in the navigator and Run As... Clojure Application for Clojure
 1.3.0-alpha7 with CCW 0.2.1 with nrepl 0.0.5 on my classpath.
 
 So I went back to my Ubuntu netbook and tried it there: I can always
 start the REPL by right-clicking on the project - but it always fails
 trying to start it via Load File in REPL (for Clojure 1.3.0). So I
 have a workaround now!

Thank you for that hint — I had plugged away at the bug you reported for a bit, 
but was unable to replicate (similar to Laurent).  As I said, I always start 
REPLs at the project level, so I didn't think to check for file-originated REPL 
starting bugs.  I'll give that a shot next time I have a chance.

- 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


Re: Comparison of CCW and Enclojure

2011-05-17 Thread Chas Emerick

On May 17, 2011, at 9:50 PM, Ken Wesson wrote:

 On Tue, May 17, 2011 at 9:04 AM, Chas Emerick cemer...@snowtide.com wrote:
 
 On May 17, 2011, at 4:57 AM, Ken Wesson wrote:
 
 * There's no easy way to restart a REPL or close one; one must close
 the REPL tab and also find and kill a java process using ps/kill or
 Windows Task Manager or whatever tool, depending on OS.
 
 Cleaning up a REPL involves closing the REPL interaction view, and then 
 stopping the corresponding JVM process via its console (which will be 
 brought to the front if you click the corresponding button in the REPL view 
 — which oddly does not have the right icon in the latest 0.2.1 release…).
 
 Note that there are two views because there are 2+ things to manage: the JVM 
 process, and N REPL sessions you have to that JVM.  We'll probably add a 
 button to the REPL view itself for sessions connected to VMs started 
 explicitly for REPL interaction (vs. sessions that are connected to an 
 arbitrary network REPL) to close the REPL view and kill the corresponding 
 process in one action.
 
 Thanks.
 
 So, it can manage multiple REPLs on the same JVM? If one hangs (e.g.
 an infinite loop) is there a way to start a second REPL on that JVM,
 then get some kind of handle on the hung thread and kill it with
 Thread.stop()? That would lead to a greater capability for session
 recovery than what Enclojure currently seems to have.

Yes, though at the moment, you'll have to touch nREPL-internal APIs.  Being 
able to get a list of running REPL evaluations and use the UI to kill them is 
planned: http://code.google.com/p/counterclockwise/issues/detail?id=94

 Good, good. I see some nifty stuff here like evaluate top level sexp
 under the cursor and run tests in REPL, as well as load and change to
 file N/S which I used frequently from Enclojure.

Note that the test-running command is broken, ill-defined, and vestigial from 
ccw's shady past.  AFAIK, Laurent plans on removing it.  Especially now that 
there are a multitude of test frameworks, defining what a monolithic run 
tests command would mean is impossible.  Being able to bookmark particular 
expressions (e.g. `(test-ns *ns*)`) and evaluate them in a REPL with a 
keybinding would be far more useful and cover this use case.

 I believe the namespace browser currently only updates on a focus change.  
 Perhaps not ideal, but we also don't want to constantly be polling the 
 process for namespace info either…
 
 So it's a pull model, rather than a push. The ideal architecture
 would be a push one, where you hooked into the REPL process to get
 notification pushed to the namespace browser functionality on any
 change to any namespace. In principle, if you could get into the guts
 of the namespace's mappings and add a watch to it with add-watch ...
 but that might not be possible without modifying
 clojure.lang.Namespace's Java source.

Right, there's no ARefs available for namespaces, file loading, and so on.  
Pull is perfectly fine IMO, perhaps with the addition of a refresh icon on the 
namespace browser.

 This is very easy to set up.
 
 If it were, I would presumably have managed to do so without outside
 help. Clearly it is not as easy as it seems to someone who already
 knows exactly how.

That is to say, the wide swath of Java devs that use Eclipse manage it.  :-)  A 
trip to an Eclipse mailing list or #eclipse irc may help (fairly friendly folks 
in there, seemingly only during U.S. business hours).

 So the REPL has to be started from the project to get its VM
 configuration to appear in Run Configurations?

No, REPLs instigated from a file load should also produce a run configuration.

With that, I will stop plinging the main ML with CCW support discussion.  
Please let's move any remainder of the discussion to the main users' ML for CCW:

http://groups.google.com/group/clojuredev-users

Thanks,

- 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


[ANN] Radically simplified Emacs and SLIME setup

2011-05-17 Thread Phil Hagelberg
I pushed out some changes last night that make it much, much easier to
get set up with Emacs and SLIME. If you've tried it and ended up
bewildered by issues with ELPA or how to launch a swank server, give
it another go! It only takes three steps to get started:

1. Install clojure-mode via git or marmalade-repo.org
2. lein plugin install swank-clojure 1.3.1
3. Invoke M-x clojure-jack-in from a project

More details along with a short screencast are on my blog:
http://technomancy.us/149 60 seconds from zero config to running
SLIME!

-Phil

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


Re: Comparison of CCW and Enclojure

2011-05-17 Thread Ken Wesson
On Tue, May 17, 2011 at 10:42 PM, Sean Corfield seancorfi...@gmail.com wrote:
 On Tue, May 17, 2011 at 6:50 PM, Ken Wesson kwess...@gmail.com wrote:
 There doesn't seem to be a way to get CCW's version reported, short
 perhaps of triggering an attempt to update it, but I think it's
 0.2.something.

 Help  About Eclipse SDK  Installation Details - You'll see a list of
 all installed plugins and their versions.

Ah, thanks. I was looking for plugin version information where plugins
are managed. Most application about boxes don't include plugin version
information, and most application plugin-management menus do, so it's
a bit surprising for Eclipse to be the reverse. :)

It seems to be 0.2.0STABLE001, whatever that last part means.

 2. Enter in the middle of a REPL submission breaks the line even if
 the sexp lacks unmatched delims, unlike Enclojure.

 I've gotten used to using ctl-enter or shift-cmd-x to just submit the
 form I'm typing so I don't need to jump to the end of the form.

Ah. There's nowhere where this seems to be documented, including the
CCW section the install added to the Eclipse help browser.

Thanks.

 3. A few things seem a bit less self-evident without looking at either
 Eclipse or CCW documentation than is the case with NB/Enclojure,
 including (sorry to harp on this) the install's extra step and the
 behavior of some of the other things.

 Well, there's certainly a lot of Eclipse functionality that is
 definitely less than obvious - even with all the Eclipse documentation
 out there - and I suspect some of that carries over to CCW. But, yes,
 CCW's docs are... thin...

Browsing the same help section, I see a couple of things like one
whole section that just says TODO, and also an item somewhere that
ends with (note:. I suppose we shouldn't expect too much of
something whose version number is 0.2. In fact, I've seen version 2.0s
of some products that were less usable (Windows, for one :)).

The help browser responds sluggishly to wheel scroll, but snappily to
dragging the scrollbar thumb around; but this looks like an Eclipse
bug rather than a CCW bug, as it affects other help pages besides the
CCW ones. Indeed, from the clicking noise it makes when links are
clicked I suspect it's actually an embedded Internet Exploder browser
pane (currently at a Windows box here), so it might even be an
Internet Exploder bug. Er ... knowing that particular Microsoft
product, might even be is an understatement; try probably is. :)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

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


Lazy prime sieve

2011-05-17 Thread Ken Wesson
I stumbled onto this and found it quite intriguing:

https://github.com/fredericksgary/lazy-prime-sieve/blob/master/src/primes/core.clj

Unfortunately, there isn't any obvious way in the site's interface to
discover what the project's license is (which I'd have no trouble
finding at e.g. SourceForge). Does anybody know what it is, or how to
find out?

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

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