Re: Mac Emacs users: which version do you prefer (Aquamacs, Carbon Emacs, other?)

2010-06-13 Thread Thomas Kjeldahl Nilsson
Weird - I installed the Cocoa build last night, and got everything set
up via elpa including swank-clojure. Some local problem?

Regards,
Thomas Kjeldahl Nilsson


On Sun, Jun 13, 2010 at 2:02 AM, Rob Lachlan  wrote:
> I agree that the cocoa builds are the nicest.  But there is one
> problem that I've had with them: I wasn't able to successfully install
> swank-clojure through elpa from within that emacs.  Curiously, I was
> able to install it through elpa in aquamacs, and then I had no problem
> using swank-clojure from within the cocoa (emacsforosx.com) emacs.
>
> I'm at a loss to account for this, and I don't have the emacs-fu to
> debug this.
>
> All that aside, yeah the cocoa (emacsforosx.com) builds are very nice,
> minimalist and very functional.
>
> On Jun 12, 3:31 pm, Phil Hagelberg  wrote:
>> On Sat, Jun 12, 2010 at 5:25 AM, Thomas Kjeldahl Nilsson
>>
>>  wrote:
>> > What are the major differences in the different distributions,
>> > particularly for Clojure development?
>>
>> > I've got everything (Slime, Paredit, Clojure-mode etc) set up in
>> > Carbon emacs and it works great, just curious if there are any
>> > substantials gains to be had in Aquamacs or other alternative
>> > distributions. :)
>>
>> Carbon Emacs is pretty outdated; it's based on Emacs 22. (c. 2007)
>> Aquamacs messes up a lot of the defaults and isn't portable, so most
>> elisp library authors can't test on it or help you debug problems
>> you're having with it. I recommend the Cocoa build of GNU 
>> Emacs:http://emacsformacosx.comhas prebuilt binaries.
>>
>> -Phil
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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


Non-tail recursion (Clojure way to hierarchies)

2010-06-13 Thread Oleg
Hello Guys!

Here is the task:

Assume that we have function called `fetch-from-source`, which used to
fetch vector of maps from the data source. I want to make iteration on
every fetched row (element of vector) and ask `fetch-from-source`
again to add 'children' key to that row. And so on, until given
depth.

So i want to use map function on collection from some function `expand-
groups`, which will call the same function `expand-groups` on every
collection element to assign children on it. Keep in mind, that the
map function is not last in my function, because i have to append one
more row to mapped collection.

Currently i'm just calling function, but there is a danger of
StackOverflow. I can't use recur, because it's not last statement. As
i can understand recur is good to build long sequences, but in my case
i'm building hierarchy.


What do you think guys? Is there are clojure-rish way to solve that
problem?

Cheers, Oleg

-- 
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: ICFP 2009 / ICFP 2010

2010-06-13 Thread Eugen Dück
So, I'm done for this weekend. What I have (and put on the blog)

* a binary parser
* the vm (interpreted, maybe I can turn it into a compiled vm in the
coming week? any ideas? macros? have to think about it)
* a graphical visualizer
* a controller "framework", allows you to solve the actual problems,
starting from the simplest, the Hohmann transfer

What's missing now is only the binary writer, which should be
straightforward to do now, maybe I'll take care of that the next
couple of days, maybe not.

Way more interesting would be to get this thing fast, and I guess
compiling the vm should boost performance significantly, and it sounds
like an interesting problem, too: Here's my chance to really get into
macros (I guess?). But there are certainly other ways to improve
performance. Will see.

Thanks guys for the input on my "getting the fn name" problem, that's
good to know, and great that 1.2 will change it, too.

Cheers
Eugen

-- 
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: ICFP 2009 / ICFP 2010

2010-06-13 Thread Eugen Dück
OK, I'm done for this weekend. Here's what I got:

* the binary reader
* the vm ("interpreted" for now - would like to make a "compiled" vm.
still have to think about it, I guess macros would help?)
* a graphical visualizer
* a controller framework to solve the actual problems

The code is surprisingly modular and readable (if I may say so myself,
I was surprised at least).

All that's missing now is a binary writer to be able to hand in the
solution. But that is pretty straightforward, so I'm not sure if I'll
bother to do it in the next couple of days.

Way more interesting would be to speed this thing up, and the vm is a
crucial part, the instruction processor is iterated over A LOT. So
maybe here's my chance to finally learn macros... Will see, I guess
there are other things that I could do in the vm code to boost
performance, but macros are one thing I haven't really gotten around
to, except for some small and boring ones. Any suggestions on the
issue "compiled vm"?

And thanks guys for the answers to my "get name of fn" problem! Also
good to know is that 1.2 will improve this.

Cheers
Eugen

-- 
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: Non-tail recursion (Clojure way to hierarchies)

2010-06-13 Thread Andrzej
On Sun, Jun 13, 2010 at 7:35 PM, Oleg  wrote:
>
> Currently i'm just calling function, but there is a danger of
> StackOverflow. I can't use recur, because it's not last statement. As
> i can understand recur is good to build long sequences, but in my case
> i'm building hierarchy.

Two potential solutions:
1. Build a lazy hierarchy, i.e. instead of returning a nested
structure, return a function that produces it. It might be better to
use a built-in function tree-seq though (check the implementation of
file-seq and xml-seq).
2. If everything else fails use a trampoline
http://groups.google.com/group/clojure/browse_frm/thread/6257cbc4454bcb85/7d5fd827cd549080#7d5fd827cd549080

Cheers,

Andrzej

-- 
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: Non-tail recursion (Clojure way to hierarchies)

2010-06-13 Thread Oleg
Thank you, but could you provide me a little code snippet which will
iterate through collection and assoc "children" key for each row.

On 13 июн, 16:35, Andrzej  wrote:
> On Sun, Jun 13, 2010 at 7:35 PM, Oleg  wrote:
>
> > Currently i'm just calling function, but there is a danger of
> > StackOverflow. I can't use recur, because it's not last statement. As
> > i can understand recur is good to build long sequences, but in my case
> > i'm building hierarchy.
>
> Two potential solutions:
> 1. Build a lazy hierarchy, i.e. instead of returning a nested
> structure, return a function that produces it. It might be better to
> use a built-in function tree-seq though (check the implementation of
> file-seq and xml-seq).
> 2. If everything else fails use a 
> trampolinehttp://groups.google.com/group/clojure/browse_frm/thread/6257cbc4454b...
>
> Cheers,
>
> Andrzej

-- 
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 Enhancement Proposals or "wish list"

2010-06-13 Thread Franis Sirkovic
Thanks for comments.
In fact, I have some other thing to recommend.
I think that there should be some kind of clojure "standard library". I
don't see how to write any code if I have to have 2 different versions
depending on underlying virtual machine, JVM or CLR. There are 3 python
implementations (CPython, IronPython, Jython) which support python standard
libraries at the moment.
For example, I have looked at "REPL on socket" example. I have naively tried
to start it under ClojureCLR. Of course, it ended with exception because
there are references to java.net and java.io.
.NET is standard in company where I work so I have no way to promote clojure
which runs on JVM.

Also, there is additional benefit of such standard library. It isolates your
code from changes in java libraries. I am not java expert so I don't know
rate of change of java libraries at the moment, but I remember that there
are some deprecated libraries in the past. Deprecated features are still
present in .NET environment.

I would like to help on building of such library (libraries), but I don't
feel confident to propose design. I don't know if functional or OO way is
preferred by clojure users.
Also, I see that there is clojure.java.io library. I think clojure.io would
be more appropriate name.

And one comment for the end. I find syntax for map lookup little bit
uncommon. I find get function easier to understand in code. What you think?


Best wishes, Franis.

On Thu, Jun 10, 2010 at 9:09 AM, Dave Pawson  wrote:

> On 9 June 2010 23:00, David Nolen  wrote:
> > On Wed, Jun 9, 2010 at 4:25 PM, frantz 
> wrote:
> >>
> >> I would like to know if there is "Clojure Enhacements Proposals" list
> >> ("wish list"). I would like to add something.
> >>
> >> Best wishes, Franis.
> >
> > user> (= mailing-list wish-list)
> > true
> > ;)
>
> Fast becoming my top priority enhancement.
> Read the literature on Clojure and I see one line error reports
> extracted from the Java stack trace.
> Real use shows 101 lines of useless info wrapping one or two lines
> of useful information.
> Offputting, to say the least.
>
>
> regards
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
>
> --
> 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 Enhancement Proposals or "wish list"

2010-06-13 Thread frantz
Thanks for comments.
In fact, I have some other thing to recommend.
I think that there should be some kind of clojure "standard library".
I don't see how to write any code if I have to have 2 different
versions depending on underlying virtual machine, JVM or CLR. There
are 3 python implementations (CPython, IronPython, Jython) which
support python standard libraries at the moment.
For example, I have looked at "REPL on socket" example. I have naively
tried to start it under ClojureCLR. Of course, it ended with exception
because there are references to java.net and java.io.
.NET is standard in company where I work so I have no way to promote
clojure which runs on JVM.

Also, there is additional benefit of such standard library. It
isolates your code from changes in java libraries. I am not java
expert so I don't know rate of change of java libraries at the moment,
but I remember that there are some deprecated libraries in the past.
Deprecated features are still present in .NET environment.

I would like to help on building of such library (libraries), but I
don't feel confident to propose design. I don't know if functional or
OO way is preferred by clojure users.
Also, I see that there is clojure.java.io library. I think clojure.io
would be more appropriate name.

And one comment for the end. I find syntax for map lookup little bit
uncommon. I find get function easier to understand in code. What you
think?

Best wishes, Franis.

On Jun 10, 9:09 am, Dave Pawson  wrote:
> On 9 June 2010 23:00, David Nolen  wrote:
>
> > On Wed, Jun 9, 2010 at 4:25 PM, frantz  wrote:
>
> >> I would like to know if there is "Clojure Enhacements Proposals" list
> >> ("wish list"). I would like to add something.
>
> >> Best wishes, Franis.
>
> > user> (= mailing-list wish-list)
> > true
> > ;)
>
> Fast becoming my top priority enhancement.
> Read the literature on Clojure and I see one line error reports
> extracted from the Java stack trace.
> Real use shows 101 lines of useless info wrapping one or two lines
> of useful information.
> Offputting, to say the least.
>
> regards
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.http://www.dpawson.co.uk

-- 
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: New Clojure web application launched: DocuHarvest

2010-06-13 Thread Jim Blomo
On Thu, Jun 10, 2010 at 4:32 AM, Chas Emerick  wrote:
> - Clutch to interface to CouchDB (which we abuse as a message queue, among
> other things)

Can you comment on the choice of Clutch over clojure-couchdb?  I've
found clojure-couchdb to be reliable and straightforward.  the-kenny's
(Moritz Ulrich) branch is being actively maintained and he's been
helpful getting it working for me.

Jim

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


Re: Interface to integrate transactions with Clojure transactions

2010-06-13 Thread Pedro Teixeira

There is an old patch that was contributed to the list:
http://groups.google.com/group/clojure/browse_thread/thread/aa22a709501a64ac

I'm also interested in this, it would be a nice extension point have
without having to patch clojure.core.



On Jun 10, 6:58 pm, James Reeves  wrote:
> On 10 June 2010 22:40, Michael Jaaka  wrote:
>
> > Not good, since if database commit fail it is too late for dosync to
> > rollback.
> > In fact database commit should somehow cooparate with dosync commit
> > which is just a case of distributed transaction.
>
> You're right. In which case, I don't believe there's a way to do this
> without accessing the clojure.lang.LockingTransaction class directly.
>
> - James

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


Why does clojure-http stores cookies in a ref instead of an atom

2010-06-13 Thread Steve Molitor
I'm a clojure newbie trying to understand when to use atoms versus refs.

In clojure-http.resourcefully, if you use the with-cookies macro stores the
cookies in a thread local ref.  Why a ref and not an atom?  My impression is
that refs are for when you need to coordinate changes to more than one
variable, or maybe if you need triggered validations.

Thanks,

Steve

-- 
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: RFC: clj-ds Clojure data structure for Java (et al.)

2010-06-13 Thread Mike Anderson
On Jun 8, 1:34 pm, Krukow  wrote:
> I would like to hear the groups opinion before (and if) I release this
> to the general public.
>
> http://github.com/krukow/clj-ds

I really like this approach.

Not sure if it's any use, but I created a data structure library of my
own in Java which may have some useful code you can borrow (you are
free to use anything you like to include in this project).

http://code.google.com/p/mikeralib/source/browse/#svn/trunk/Mikera/src/mikera/persistent

In particular, there is a persistent String class
(mikera.persistent.Text) which I always thought would be a good fit
with 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


Bug in Clojure. Trouble with App Engine.

2010-06-13 Thread zahardzhan
When i eval code from Google App Engine SDK clojure throws very
strange  class cast exception. I put this code into Java class, then
eval this class from clojure - and there is no problem.

Is this Clojure bug?

Source example:
http://goo.gl/cjjt

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


noob questions - Hello world + learning

2010-06-13 Thread Jared
Hi everyone,

I'm 100% new to LISP, 95% new to Java, and 90% new to programming in
general. Where and how would you recommend learning Clojure? I'm
planning on buying Programming Clojure, but until then what would you
suggest?

I got Netbeans working with Clojure and the default template is this:

(comment
Sample clojure source file
)
(ns com.yourcompany.defpackage
(:gen-class))

(defn -main
([greetee]
  (println (str "Hello " greetee "!")))
  ([] (-main "world")))

It ran and printed "Hello world!". Can anyone explain to me in detail
what each statement means. I'm particularly confused by:

(comment
Sample clojure source file
)

I thought all comments began with ; ? I understand what println does
and that's it.

Thanks in advance everyone.

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


Re: ANN: Conjure 0.6 Released

2010-06-13 Thread Matt
> I was in much the same position as you a few months ago. Refactoring
> Compojure to use the Ring libraries took a lot of work, so I have an
> idea of the amount of effort involved :)

I've added the latest version of Ring to Conjure, but I haven't
updated the cookies or parameters yet. Otherwise, it seems to be
working. I'm busy with other stuff right now (more on that later), but
I'll get to it.

> Another idea is to write a conjure Leiningen plugin. Then developers
> could create a project using Leiningen, and then use "lein conjure" to
> generate all the directory paths, etc. e.g.

Yesterday morning, I took one more look at Leiningen for Conjure.
After a few false starts and build hacking, I had exactly the same
idea for a Conjure plugin for Leiningen. I've started breaking Conjure
into two jars, conjure.jar which will be all the base libraries for
Conjure, and lein-conjure.jar which will be the Conjure Leiningen
plugin.

After setting up the Leiningen builds and moving the source files into
a more appropriate structure, I'm now fixing all of the errors and
test failures.

Right now, pretty much everything that was in the vendor/conjure
directory will be in the conjure.jar. All of the scripts and a new
initial Conjure generator script will be in the plugin. Everything
else will be generated just like before.

> I believe there's a leiningen-war project on GitHub that generates war
> files for a Leiningen project. You may want to take a look at that.

The above changes will obviously make the leiningen-war project very
useful. I'll check it out when I'm done with the plugin. Strangely, I
don't see it in the Leiningen plugin list.

> If there's any problem with dropping it in, let me know. I tried to
> make it as straightforward as possible, but I might not have thought
> of everything :)

I checked out clout, and found I couldn't use it. Maybe I don't know
exactly how it works, but I would like to define routes with something
like Rails old "/:controller/:action/:id", but clout seemed to require
something more like "/book/:id" where book would then be hard coded to
the book controller and the action could be figured out from the
request method. Though this is somewhat closer to how Rails works now,
it isn't very useful for me. Am I missing something, or is that how
you designed it? How would the Rails route: "/book/1/edit" work?

Clout does look like an interesting project, and will probably use it
to some extent if I can figure out how best to do it.

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


Re: Bug in Clojure. Trouble with App Engine.

2010-06-13 Thread Meikel Brandmeyer
Hi,

Am 12.06.2010 um 06:08 schrieb zahardzhan:

> When i eval code from Google App Engine SDK clojure throws very
> strange  class cast exception. I put this code into Java class, then
> eval this class from clojure - and there is no problem.
> 
> Is this Clojure bug?

No. Try (LocalServiceTestHelper. (into-array [ 
(LocalUserServiceTestConfig.)])). The Constructor is variadic, ie. you have to 
pass it an array as is indicated by the [L...; in the error message.

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: Mac Emacs users: which version do you prefer (Aquamacs, Carbon Emacs, other?)

2010-06-13 Thread Rob Lachlan
Probably, but I'm at a loss to figure out exactly what it might be.  I
cleaned emacs off, along with the .emacs.d directory, reinstalled, and
the problem reappeared. I'm not touching it right now since, as I
mentioned, I managed too bootstrap using aquamacs.


On Jun 13, 12:42 am, Thomas Kjeldahl Nilsson
 wrote:
> Weird - I installed the Cocoa build last night, and got everything set
> up via elpa including swank-clojure. Some local problem?
>
> Regards,
> Thomas Kjeldahl Nilsson
>
>
>
> On Sun, Jun 13, 2010 at 2:02 AM, Rob Lachlan  wrote:
> > I agree that the cocoa builds are the nicest.  But there is one
> > problem that I've had with them: I wasn't able to successfully install
> > swank-clojure through elpa from within that emacs.  Curiously, I was
> > able to install it through elpa in aquamacs, and then I had no problem
> > using swank-clojure from within the cocoa (emacsforosx.com) emacs.
>
> > I'm at a loss to account for this, and I don't have the emacs-fu to
> > debug this.
>
> > All that aside, yeah the cocoa (emacsforosx.com) builds are very nice,
> > minimalist and very functional.
>
> > On Jun 12, 3:31 pm, Phil Hagelberg  wrote:
> >> On Sat, Jun 12, 2010 at 5:25 AM, Thomas Kjeldahl Nilsson
>
> >>  wrote:
> >> > What are the major differences in the different distributions,
> >> > particularly for Clojure development?
>
> >> > I've got everything (Slime, Paredit, Clojure-mode etc) set up in
> >> > Carbon emacs and it works great, just curious if there are any
> >> > substantials gains to be had in Aquamacs or other alternative
> >> > distributions. :)
>
> >> Carbon Emacs is pretty outdated; it's based on Emacs 22. (c. 2007)
> >> Aquamacs messes up a lot of the defaults and isn't portable, so most
> >> elisp library authors can't test on it or help you debug problems
> >> you're having with it. I recommend the Cocoa build of GNU 
> >> Emacs:http://emacsformacosx.comhasprebuilt binaries.
>
> >> -Phil
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with 
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To 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: New Clojure web application launched: DocuHarvest

2010-06-13 Thread Moritz Ulrich
Yup, I would like to know why you chose clutch over clojure-couchdb
too. (I don't want to insinuate that clojure-couchdb is the better
lib)

On Thu, Jun 10, 2010 at 9:39 PM, Jim Blomo  wrote:
> On Thu, Jun 10, 2010 at 4:32 AM, Chas Emerick  wrote:
>> - Clutch to interface to CouchDB (which we abuse as a message queue, among
>> other things)
>
> Can you comment on the choice of Clutch over clojure-couchdb?  I've
> found clojure-couchdb to be reliable and straightforward.  the-kenny's
> (Moritz Ulrich) branch is being actively maintained and he's been
> helpful getting it working for me.
>
> Jim
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

-- 
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: noob questions - Hello world + learning

2010-06-13 Thread David Nolen
If your are new to programming I recommend reading at least the first
three chapters of The Structure and Interpretation of Computer
Programs. It's available online.

David

On Friday, June 11, 2010, Jared  wrote:
> Hi everyone,
>
> I'm 100% new to LISP, 95% new to Java, and 90% new to programming in
> general. Where and how would you recommend learning Clojure? I'm
> planning on buying Programming Clojure, but until then what would you
> suggest?
>
> I got Netbeans working with Clojure and the default template is this:
>
> (comment
> Sample clojure source file
> )
> (ns com.yourcompany.defpackage
>     (:gen-class))
>
> (defn -main
>     ([greetee]
>   (println (str "Hello " greetee "!")))
>   ([] (-main "world")))
>
> It ran and printed "Hello world!". Can anyone explain to me in detail
> what each statement means. I'm particularly confused by:
>
> (comment
> Sample clojure source file
> )
>
> I thought all comments began with ; ? I understand what println does
> and that's it.
>
> Thanks in advance everyone.
>
> --
> 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-binding special functions in a Namespace?

2010-06-13 Thread Moritz Ulrich
Hello,

I would like to re-bind some functions from a namespace with a macro.
The list of functions to rebind should be determined at
macro-expansion-time, the functions to rebind are marked with a
special metadata-entry.

I implemented it in the this gist: http://gist.github.com/436786

Can someone with a deeper understanding of the var-internals take a
look at my code and tell me if it's okay to do that like this? It
looks a bit "hacky" for me...

Thanks for your answers.

-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

-- 
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: noob questions - Hello world + learning

2010-06-13 Thread Moritz Ulrich
I don't think that Structure and Interpretion of Computer Programs is
a good first-book if you want to start lisp-programming (Especially
Clojure). It's very detailed and gives much insights, but Clojure is
way more practical than this book. If you want to start programming
Clojure, I'd recommend "Pragmatic Programming Clojure" or "The Joy of
Clojure" (Even when JoC isn't finished yet).

To your original question: That's a hard piece of code to start with.
I'd recommend firing up a repl and trying with this instead of this
template you've mentioned.

On Sun, Jun 13, 2010 at 6:25 PM, David Nolen  wrote:
> If your are new to programming I recommend reading at least the first
> three chapters of The Structure and Interpretation of Computer
> Programs. It's available online.
>
> David
>
> On Friday, June 11, 2010, Jared  wrote:
>> Hi everyone,
>>
>> I'm 100% new to LISP, 95% new to Java, and 90% new to programming in
>> general. Where and how would you recommend learning Clojure? I'm
>> planning on buying Programming Clojure, but until then what would you
>> suggest?
>>
>> I got Netbeans working with Clojure and the default template is this:
>>
>> (comment
>> Sample clojure source file
>> )
>> (ns com.yourcompany.defpackage
>>     (:gen-class))
>>
>> (defn -main
>>     ([greetee]
>>   (println (str "Hello " greetee "!")))
>>   ([] (-main "world")))
>>
>> It ran and printed "Hello world!". Can anyone explain to me in detail
>> what each statement means. I'm particularly confused by:
>>
>> (comment
>> Sample clojure source file
>> )
>>
>> I thought all comments began with ; ? I understand what println does
>> and that's it.
>>
>> Thanks in advance everyone.
>>
>> --
>> 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



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

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


Re: ANN: Conjure 0.6 Released

2010-06-13 Thread James Reeves
On 13 June 2010 14:20, Matt  wrote:
> Yesterday morning, I took one more look at Leiningen for Conjure.
> After a few false starts and build hacking, I had exactly the same
> idea for a Conjure plugin for Leiningen. I've started breaking Conjure
> into two jars, conjure.jar which will be all the base libraries for
> Conjure, and lein-conjure.jar which will be the Conjure Leiningen
> plugin.

That sounds good!

> I checked out clout, and found I couldn't use it. Maybe I don't know
> exactly how it works, but I would like to define routes with something
> like Rails old "/:controller/:action/:id", but clout seemed to require
> something more like "/book/:id" where book would then be hard coded to
> the book controller and the action could be figured out from the
> request method. Though this is somewhat closer to how Rails works now,
> it isn't very useful for me. Am I missing something, or is that how
> you designed it? How would the Rails route: "/book/1/edit" work?

I think you're missing something :)

Clout is a very low level library. It matches routes using a
Rails-like routing syntax, but it doesn't do anything more than that.
You can match routes like "/book/:id", but you can also match routes
like "/:controller/:action/:id".

user=> (use 'clout.core)
nil
user=> (route-matches "/:controller/:action/:id" "/book/edit/1")
{"id" "1", "action" "edit", "controller" "book"}

It uses strings instead of keywords, because that ties into Ring
parameters better. I may change this in future to keywords; I'm not
sure which is best at the moment.

In any case, you could write a Ring handler function something like this:

(defvar- main-route
  (route-compile "/:controller/:action/:id"))

(defn conjure-handler [request]
  (if-let [route-params (route-matches main-route request)]
(let [params (merge (request :params) route-params)
  action (find-action (params "controller") (params "action"))
  request (assoc request :params params)]
  (run-action action request))
(page-not-found request)))

Using this scheme, you get similar behaviour to Rails, and it opens up
the possibility of custom routes.

- James

-- 
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: Re-binding special functions in a Namespace?

2010-06-13 Thread Meikel Brandmeyer
Hi,

Am 13.06.2010 um 18:31 schrieb Moritz Ulrich:

> Thanks for your answers.

Wouldn't it be more appropriate to have a *server* Var, which is allowed to be 
rebound by the user? The function can still use optional arguments to configure 
the server directly in a call.

(declare *server*)

(defn do-query
  [... & {:keys [server] :or {server *server*}]
  ...)

This looks more comfortable and clean than doing Var-Voodoo.

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


Colon (:) in comments?

2010-06-13 Thread j-g-faustus
Hi,

I get an exception whenever I put a colon in a multiline comment:

(comment
  TODO: x y z
  )
=> #

Is this a Clojure bug? Or related to Enclojure on NetBeans? Or some
sort of hidden feature in comments?

Regards
jf

-- 
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: Colon (:) in comments?

2010-06-13 Thread Heinz N. Gies
comment just is a function that says 'don't evaluate the stuff in here, it 
still needs to be correct clojure code you can either use:

; TODO: x  y  z
or
#_(Todo: x y z)

On Jun 13, 2010, at 16:13 , j-g-faustus wrote:

> Hi,
> 
> I get an exception whenever I put a colon in a multiline comment:
> 
> (comment
>  TODO: x y z
>  )
> => #
> 
> Is this a Clojure bug? Or related to Enclojure on NetBeans? Or some
> sort of hidden feature in comments?
> 
> Regards
> jf
> 
> -- 
> 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: Re-binding special functions in a Namespace?

2010-06-13 Thread Moritz Ulrich
This was in the original branch of the clojure-couchdb-project. I
forked it and rewrote all functions to take an argument instead of
using *server*.

This annoyed me, because it was complicated to use multiple servers
with one codebase (binding is annoying in multi-thread-applications).

On Sun, Jun 13, 2010 at 7:40 PM, Meikel Brandmeyer  wrote:
> Hi,
>
> Am 13.06.2010 um 18:31 schrieb Moritz Ulrich:
>
>> Thanks for your answers.
>
> Wouldn't it be more appropriate to have a *server* Var, which is allowed to 
> be rebound by the user? The function can still use optional arguments to 
> configure the server directly in a call.
>
> (declare *server*)
>
> (defn do-query
>  [... & {:keys [server] :or {server *server*}]
>  ...)
>
> This looks more comfortable and clean than doing Var-Voodoo.
>
> 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



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

-- 
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: Colon (:) in comments?

2010-06-13 Thread Meikel Brandmeyer
Hi,

Am 13.06.2010 um 19:50 schrieb Heinz N. Gies:

> comment just is a function that says 'don't evaluate the stuff in here, it 
> still needs to be correct clojure code you can either use:
> 
> ; TODO: x  y  z
> or
> #_(Todo: x y z)

Note that after #_ it must also be valid code.

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: Re-binding special functions in a Namespace?

2010-06-13 Thread Meikel Brandmeyer
Hi,


On 13 Jun., 19:55, Moritz Ulrich  wrote:

> This was in the original branch of the clojure-couchdb-project. I
> forked it and rewrote all functions to take an argument instead of
> using *server*.
>
> This annoyed me, because it was complicated to use multiple servers
> with one codebase (binding is annoying in multi-thread-applications).

But your idea doesn't improve things, no? You hard-wire the server at
macro expansion time. So using multiple servers doesn't work at all.
At least not easily. I still prefer the double approach. Bind *server*
or pass it as an argument. You can add even another level of
indirection. Make *server* an atom and set it once a startup. Then you
don't even need binding. For local required different server you can
use binding for a bunch off functions, you don't control. Or pass in a
server if do control the code.

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: Re-binding special functions in a Namespace?

2010-06-13 Thread Moritz Ulrich
Huh? I don't see why I wire server at macro expansion time. You can
pass a variable and it'll be integrated in the emitted code.

(with-server (concat "http://"; "localhost" ":5984")
  (database-list))

will expand to

(binding [database-list (partial database-list (concat "http://";
"localhost" ":5984"))]
   (database-list))

On Sun, Jun 13, 2010 at 9:36 PM, Meikel Brandmeyer  wrote:
> Hi,
>
>
> On 13 Jun., 19:55, Moritz Ulrich  wrote:
>
>> This was in the original branch of the clojure-couchdb-project. I
>> forked it and rewrote all functions to take an argument instead of
>> using *server*.
>>
>> This annoyed me, because it was complicated to use multiple servers
>> with one codebase (binding is annoying in multi-thread-applications).
>
> But your idea doesn't improve things, no? You hard-wire the server at
> macro expansion time. So using multiple servers doesn't work at all.
> At least not easily. I still prefer the double approach. Bind *server*
> or pass it as an argument. You can add even another level of
> indirection. Make *server* an atom and set it once a startup. Then you
> don't even need binding. For local required different server you can
> use binding for a bunch off functions, you don't control. Or pass in a
> server if do control the code.
>
> 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



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

-- 
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: Re-binding special functions in a Namespace?

2010-06-13 Thread Moritz Ulrich
Sorry for the second mail - I've just improved the macro so server is
only evaluated once (It's side-effect save now)

On Sun, Jun 13, 2010 at 9:50 PM, Moritz Ulrich
 wrote:
> Huh? I don't see why I wire server at macro expansion time. You can
> pass a variable and it'll be integrated in the emitted code.
>
> (with-server (concat "http://"; "localhost" ":5984")
>  (database-list))
>
> will expand to
>
> (binding [database-list (partial database-list (concat "http://";
> "localhost" ":5984"))]
>   (database-list))
>
> On Sun, Jun 13, 2010 at 9:36 PM, Meikel Brandmeyer  wrote:
>> Hi,
>>
>>
>> On 13 Jun., 19:55, Moritz Ulrich  wrote:
>>
>>> This was in the original branch of the clojure-couchdb-project. I
>>> forked it and rewrote all functions to take an argument instead of
>>> using *server*.
>>>
>>> This annoyed me, because it was complicated to use multiple servers
>>> with one codebase (binding is annoying in multi-thread-applications).
>>
>> But your idea doesn't improve things, no? You hard-wire the server at
>> macro expansion time. So using multiple servers doesn't work at all.
>> At least not easily. I still prefer the double approach. Bind *server*
>> or pass it as an argument. You can add even another level of
>> indirection. Make *server* an atom and set it once a startup. Then you
>> don't even need binding. For local required different server you can
>> use binding for a bunch off functions, you don't control. Or pass in a
>> server if do control the code.
>>
>> 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
>
>
>
> --
> Moritz Ulrich
> Programmer, Student, Almost normal Guy
>
> http://www.google.com/profiles/ulrich.moritz
>



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

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


can not install clojure-test-mode using elpa (package.el)

2010-06-13 Thread B Smith-Mannschott
Hi Clojurians,

This weekend, while off the grid, I discovered that mvn clojure:swank
and M-x slime-connect no longer talk to eachother.

When I got back, I looked in M-x package-list-packages to see that
there had been updates to clojure-mode (1.7.2), clojure-test-mode
(1.4), slime (20100404). (swank-clojure is still at 1.1.0 though 1.2.0
is tagged in git; is that bad?)

I'm tearing my hair out trying to get this crap to install, and it's
past my bed time, so I'm hoping that I'm missing something obvious.
Maybe someone has a pointer for me.

Installing clojure-mode seems to run without error.

Installing clojure-test-mode, however errors with the *Message*s:

Reading [text/plain]... 28k of 28k (100%)
Reading... done.
let: File exists: /home/smithma/.emacs.d/elpa/clojure-mode-1.7.1/clojure-mode.el

Well, no $%!7, it's already installed, why are you trying to install
it again!? And even if you are trying to install it redundantly, how
*exactly* is it an error that it's already there.

End result: clojure-test-mode doesn't get installed. Installing
swank-clojure produces the same error. slime installs without apparent
error.

emacs 23.2.50.1 (from source)
package.el: 0.9

the sha1 of archive-contents downloaded by package.el
e1094cd7c51e81040c7f90230643b86a3bf759b2  archive-content

can some kind soul offer me advice?

// 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: Re-binding special functions in a Namespace?

2010-06-13 Thread Meikel Brandmeyer
Hi,

Am 13.06.2010 um 21:50 schrieb Moritz Ulrich:

> Huh? I don't see why I wire server at macro expansion time. You can
> pass a variable and it'll be integrated in the emitted code.
> 
> (with-server (concat "http://"; "localhost" ":5984")
>  (database-list))
> 
> will expand to
> 
> (binding [database-list (partial database-list (concat "http://";
> "localhost" ":5984"))]
>   (database-list))

Woops. Sorry. You are right. But then I don't understand what your problem is 
with *server* if you use binding anyway…

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: can not install clojure-test-mode using elpa (package.el)

2010-06-13 Thread Phil Hagelberg
There are some bugs in package.el that I have fixed in my personal fork but
have not yet made it upstream yet. Try clearing out .emacs.d/elpa and trying
again with the version at http://GitHub.com/technomancy/package.el and it
should work although you will get byte compilation warnings.

Sorry for the hassle. I hope my patches are applied soon so the situation
improves.

-Phil

On Jun 13, 2010 1:28 PM, "B Smith-Mannschott"  wrote:

Hi Clojurians,

This weekend, while off the grid, I discovered that mvn clojure:swank
and M-x slime-connect no longer talk to eachother.

When I got back, I looked in M-x package-list-packages to see that
there had been updates to clojure-mode (1.7.2), clojure-test-mode
(1.4), slime (20100404). (swank-clojure is still at 1.1.0 though 1.2.0
is tagged in git; is that bad?)

I'm tearing my hair out trying to get this crap to install, and it's
past my bed time, so I'm hoping that I'm missing something obvious.
Maybe someone has a pointer for me.

Installing clojure-mode seems to run without error.

Installing clojure-test-mode, however errors with the *Message*s:

Reading [text/plain]... 28k of 28k (100%)
Reading... done.
let: File exists:
/home/smithma/.emacs.d/elpa/clojure-mode-1.7.1/clojure-mode.el

Well, no $%!7, it's already installed, why are you trying to install
it again!? And even if you are trying to install it redundantly, how
*exactly* is it an error that it's already there.

End result: clojure-test-mode doesn't get installed. Installing
swank-clojure produces the same error. slime installs without apparent
error.

emacs 23.2.50.1 (from source)
package.el: 0.9

the sha1 of archive-contents downloaded by package.el
e1094cd7c51e81040c7f90230643b86a3bf759b2  archive-content

can some kind soul offer me advice?

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

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

Re: ANN: Conjure 0.6 Released

2010-06-13 Thread Matt

> I think you're missing something :)
>
> Clout is a very low level library. It matches routes using a
> Rails-like routing syntax, but it doesn't do anything more than that.
> You can match routes like "/book/:id", but you can also match routes
> like "/:controller/:action/:id".
>
> user=> (use 'clout.core)
> nil
> user=> (route-matches "/:controller/:action/:id" "/book/edit/1")
> {"id" "1", "action" "edit", "controller" "book"}

I swear I tried just that and it didn't work. I'll try again when I
have Conjure working again. It's currently all sorts of screwed up as
I switch over to Leiningen.

-Matt Courtney

-- 
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: Can anyone create a simpler version of prime factors in Clojure?

2010-06-13 Thread David Cabana
I looked through some of my Project Euler solutions and found this
version. It is essentially the same as Uncle Bob's, but to my eye it
is a bit easier to read.

(defn least-nontrivial-divisor [n];; integer n > 1
  (loop [k 2]
(cond
  (zero? (rem n k)) k ;; k divides n, return k
  (> (* k k) n ) n ;; k > sqrt n, return n
  :else (recur (inc k)

(defn prime-factors [n];; integer n > 1
  (loop [n n factors []]
 (if (= 1 n)
   factors
   (let [d (least-nontrivial-divisor n)]
 (recur (quot n d)
(conj factors d))

-- 
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: Colon (:) in comments?

2010-06-13 Thread Adrian Cuthbertson
You can also use a multiline string in a comment...

(comment "
  To do: x y z
  More to do: a b c
")

-Rgds, Adrian.

-- 
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: can not install clojure-test-mode using elpa (package.el)

2010-06-13 Thread B Smith-Mannschott
On Sun, Jun 13, 2010 at 23:26, Phil Hagelberg  wrote:
> There are some bugs in package.el that I have fixed in my personal fork but
> have not yet made it upstream yet. Try clearing out .emacs.d/elpa and trying
> again with the version at http://GitHub.com/technomancy/package.el and it
> should work although you will get byte compilation warnings.
>
> Sorry for the hassle. I hope my patches are applied soon so the situation
> improves.

thanks! i am now able to install clojure, clojure-test, slime,
clojure-swank etc. without error. When I try to C-c C-k to load the
currently open clojure file into the slime repl, however, I get this:


Wrong number of args (4) passed to: basic$eval633$compile-file-for-emacs
  [Thrown class java.lang.IllegalArgumentException]

Restarts:
 0: [ABORT] Return to SLIME's top level.

Backtrace:
  0: clojure.lang.AFn.throwArity(AFn.java:439)
  1: clojure.lang.AFn.invoke(AFn.java:51)
  2: clojure.lang.Var.invoke(Var.java:377)
  3: user$eval1304.invoke(NO_SOURCE_FILE)
  4: clojure.lang.Compiler.eval(Compiler.java:5421)
  5: clojure.lang.Compiler.eval(Compiler.java:5388)
  6: clojure.core$eval.invoke(core.clj:2370)
  7: swank.core$eval_in_emacs_package.invoke(core.clj:59)
  8: swank.core$eval_for_emacs.invoke(core.clj:128)
  9: clojure.lang.Var.invoke(Var.java:373)
 10: clojure.lang.AFn.applyToHelper(AFn.java:169)
 11: clojure.lang.Var.applyTo(Var.java:482)
 12: clojure.core$apply.invoke(core.clj:540)
 13: swank.core$eval_from_control.invoke(core.clj:66)
 14: swank.core$spawn_worker_thread$fn__367$fn__368.invoke(core.clj:172)
 15: clojure.lang.AFn.applyToHelper(AFn.java:159)
 16: clojure.lang.AFn.applyTo(AFn.java:151)
 17: clojure.core$apply.invoke(core.clj:540)
 18: swank.core$spawn_worker_thread$fn__367.doInvoke(core.clj:168)
 19: clojure.lang.RestFn.invoke(RestFn.java:398)
 20: clojure.lang.AFn.run(AFn.java:24)

This used to work. Would it help to try to manually install
swank-clojure 1.2.0 do you think? (package.el only provides 1.1.0).
I'm developing against clojure 1.2.0-SNAPSHOT, while swank-clojure
1.1.0 seems to use clojure 1.1.0.

// 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: Colon (:) in comments?

2010-06-13 Thread Thomas
It is also possible to use the clj-todo module for annotating your
code with todo items.

http://github.com/tgk/clj-todo
http://clojars.org/clj-todo

Thomas

On Jun 13, 4:13 pm, j-g-faustus  wrote:
> Hi,
>
> I get an exception whenever I put a colon in a multiline comment:
>
> (comment
>   TODO: x y z
>   )
> => #
>
> Is this a Clojure bug? Or related to Enclojure on NetBeans? Or some
> sort of hidden feature in comments?
>
> Regards
> jf

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


Keyboard Input in Applets

2010-06-13 Thread rob levy
Hi All,

I've been able to figure out many Java things based on Sun's online
documentation, and this is undoubtedly due to my not being a Java
programmer, but for the life of me I can't figure out based on Java examples
how to get my Clojure JApplets to respond to keyboard input.  Does anyone
have any ideas as to how to go about doing this?

(set! *warn-on-reflection* true)

(ns ...
...
(:gen-class
 :extends javax.swing.JApplet
  ???   :implements java.awt.event.KeyListener))
...

(defn -init [#^JApplet applet]
  ??? addKeyListener )

(defn -paint [#^JApplet applet #^Graphics g]
   ...
   (.drawString #^String @message 60 40)
   ...)

(defn -keyPressed [#^JApplet applet #^KeyEvent event]
  (let [key (. event getKeyCode)]
(cond (= key (. KeyEvent VK_LEFT))  (dosync (ref-set message "left"))
  (= key (. KeyEvent VK_RIGHT)) (dosync (ref-set message "right"))
  (= key (. KeyEvent VK_UP))(dosync (ref-set message "up"))
  (= key (. KeyEvent VK_DOWN))  (dosync (ref-set message "down"
  (. applet repaint))



Thanks,
Rob

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