Solution and question to gen-interface/gen-class

2010-10-30 Thread Tommy
A solution to arity problem when implementing an interface:

Interface:
(ns Agent.IAgent)

(gen-interface
:name "Agent.IAgent"
:methods [[senseEnv [int] int]]
)

Implementation:
(ns Agent.AgentIMP
(:gen-class :name "Agent.AgentIMP" :implements [Agent.IAgent]))

(defn -senseEnv [n]
10
)

Java program for testing:
import Agent.*;

public class testAgentIMP{

public static void main(String[] args){
AgentIMP AIMP = new AgentIMP();
System.out.println("senseEnv = " + 
AIMP.senseEnv(5));
}
}

Result:
javac testAgentIMP.java
java testAgentIMP

>>> Exception in thread "main" java.lang.IllegalArgumentException: Wrong number 
>>> of args passed to: AgentIMP$-senseEnv

Explanation: The method "-senseEnv" expects another first argument,
you can use "this":

(ns Agent.AgentIMP
(:gen-class :name "Agent.AgentIMP" :implements [Agent.IAgent]))

(defn -senseEnv [this n]
10
)

javac testAgentIMP.java
java testAgentIMP

>>> senseEnv = 10

The extra argument may not seem obvious from the interface
specification, therefore I post this solution.

But when using the above with clojure 1.2.0 and clojure-contrib 1.2.0,
I get the following error:

Exception in thread "main" java.lang.VerifyError: class Agent.AgentIMP
$loading__4410__auto__ overrides final method meta.()Lclojure/lang/
IPersistentMap;

I have inspected that class and the corresponding interface-class:

user=> (list-declared-methods "Agent.IAgent$loading__4410__auto__")
("public java.lang.Object Agent.IAgent$loading__4410__auto__.invoke()
throws java.lang.Exception" "public clojure.lang.IObj Agent.IAgent
$loading__4410__auto__.withMeta(clojure.lang.IPersistentMap)" "public
clojure.lang.IPersistentMap Agent.IAgent
$loading__4410__auto__.meta()")

user=> (list-declared-methods "Agent.AgentIMP$loading__4410__auto__")
("public java.lang.Object Agent.AgentIMP
$loading__4410__auto__.invoke() throws java.lang.Exception" "public
clojure.lang.IObj Agent.AgentIMP
$loading__4410__auto__.withMeta(clojure.lang.IPersistentMap)" "public
clojure.lang.IPersistentMap Agent.AgentIMP
$loading__4410__auto__.meta()")

I inspected the corresponding classes created with clojure/-contrib
1.1.0, and meta() was not a declared method there, only invoke() was
declared.

So, in clojure/-contrib 1.2.0, why does the class override method
meta() which is final in clojure.lang.Obj (though I was not able to
trace inheritance back to clojure.lang.Obj)?

Regards,
Tommy

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


Re: Getting this error regarding duck-streams/spit ...

2010-10-30 Thread zkim
Looks like I'm a bit late to the party on this one.

ClojureDocs, as Tom mentioned, dosen't currently track the :deprecated
metadata entry, which will be fixed once clojuredocs is able to
consume autodoc's output.

Apologies for the confusion.

-Zack

On Oct 27, 12:57 am, Btsai  wrote:
> Awesome!  Thanks for the great work, Tom :)  clojuredocs has quickly
> become my go-to reference source.
>
> On Oct 26, 11:46 pm, Tom Faulhaber  wrote:
>
>
>
>
>
>
>
> > You remind me that I need to markhttp://richhickey.github.com/clojure...
> > as obsolete and redirect users to the new place.
>
> > Zack Kim and I are working to have clojuredocs pull data from the
> > autodoc system and, at that point, I assume that he'll add deprecation
> > info over there as well.
>
> > Sorry for any confusion! Clojure's still a fast moving target.
>
> > Tom
>
> > On Oct 26, 12:48 pm, Btsai  wrote:
>
> > > I'm fairly positive duck-streams is deprecated, as it is no longer
> > > present in the clojure-contrib git repository:
>
> > >http://github.com/clojure/clojure-contrib/tree/master/modules/
>
> > >http://richhickey.github.com/clojure-contrib/doesn'thavethe
> > > deprecation info most likely because it is the documentation for the
> > > original (now outdated) clojure-contrib repository, and doesn't have
> > > 1.2 info.
>
> > >http://clojure.github.com/clojure-contrib/isthedocumentation for
> > > the current repository.
>
> > > clojuredocs should probably be updated to include the deprecation
> > > info, and also have its link to clojure-contrib point to the current
> > > repository.
>
> > > On Oct 26, 12:44 pm, Victor Olteanu  wrote:
>
> > > > Thank you Btsai. I checked 
> > > > bothhttp://richhickey.github.com/clojure-contrib/io-api.html#clojure.cont...
> > > > andhttp://clojuredocs.org/clojure_contrib/clojure.contrib.duck-streams/s...
> > > > and couldn't find any reference to deprecation.
> > > > If you can confirm that this deprecation was made "official" then we 
> > > > could
> > > > update those docs so other people won't run into these same issues.
>
> > > > Victor
>
> > > > On Tue, Oct 26, 2010 at 12:46 AM, Btsai  wrote:
> > > > > I don't think it's a mistake or accident that spit exists in
> > > > > clojure.core.  In 1.2, duck-streams became deprecated and functions
> > > > > such as spit were incorporated into clojure.core:
>
> > > > >http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/...
> > > > >http://clojure.github.com/clojure-contrib/duck-streams-api.html
>
> > > > > Are you using anything beyond spit and slurp*?  If not, I think you
> > > > > can switch to clojure.core's slurp and spit and drop duck-streams
> > > > > altogether.
>
> > > > > On Oct 25, 8:59 pm, Victor Olteanu  wrote:
> > > > > > Thank you.
>
> > > > > > The following statement worked for me:
> > > > > > (:require [clojure.contrib.duck-streams :as d])
>
> > > > > > As I was using slurp and slurp*, I then had to do the following:
>
> > > > > > use the form "d/slurp*" instead (prefixed with d/)
> > > > > > use "slurp" without a change
>
> > > > > > This brings up a related point - I can see that there are functions 
> > > > > > with
> > > > > the
> > > > > > same name in different packages, which I believe it's quite 
> > > > > > unfortunate.
> > > > > > There is slurp in clojure.core and there is duck-streams/slurp* , 
> > > > > > along
> > > > > with
> > > > > > other functions such as spit...
>
> > > > > > I hope this kind of things might be addressed in future versions of
> > > > > > Clojure...
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Clojure" group.
> > > > > To post to this group, send email to clojure@googlegroups.com
> > > > > Note that posts from new members are moderated - please be patient 
> > > > > with
> > > > > your first post.
> > > > > To unsubscribe from this group, send email to
> > > > > clojure+unsubscr...@googlegroups.com > > > >  >
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/clojure?hl=en

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


Re: Images in autodoc?

2010-10-30 Thread Ryan Waters
+1 on the side of enhancing clojure's core documentation


On Thu, Oct 28, 2010 at 1:08 PM, Chris Maier
 wrote:
> My interest is general improvement of Clojure documentation.  At the
> conj, I spoke with Zack Kim about helping to improve the state of the
> documentation.  My goal was to contribute additional documentation for
> vars that are lacking, as well as clarifying some of the more
> confusing doc strings (actually as a result of our talk, Zack is
> adding some community features to ClojureDocs where we can all comment
> and discuss doc string and submit possible revisions).  As I started
> looking over the docs, it occurred to me that it would be nice to be
> able to format the strings (code formatting, bold, italics, lists,
> links, etc.), as well as add images where appropriate (I thought it
> might be helpful to have some images for describing how zippers work,
> for example).
>
> I wouldn't mind having these features for my own projects, but I think
> that Clojure as a whole could benefit from these improvements;
> anything to make it easier for newcomers to get up to speed.
>
> Chris
>

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


Re: Clojure on Javascript

2010-10-30 Thread Victor Olteanu
How can people not *love* JavaScript? :) Take for example this excerpt from
'JavaScript: the Good Parts':

"The new function object is given a prototype property whose value is an
object containing a constructor property whose value is the new function
object"

(PS: that is not one of the "good parts")

On Sat, Oct 30, 2010 at 12:32 AM, Michael Gardner wrote:

> On Oct 29, 2010, at 11:09 PM, David Nolen wrote:
>
> > JS brought me to Lisp, I would love to see the Clojure community bring
> Lisp back to JS. However I fail to see what advantage JS gives on the server
> side. From what I've seen the V8 GC and Node.js have a considerable number
> of years to go before they are serious contenders against the JVM for
> non-trivial projects, evented or no.
>
> Agreed. What is the point of Javascript on the server side? Familiarity?
> Consistency with client-side code?
>
> > More interesting would be something along the lines of CoffeeScript (like
> ClojureScript) that takes a reasonable subset Clojure and compiles into
> efficient JS, allowing Clojure programmers to send Clojure code to clients.
>
> Yes! Writing Javascript makes me want to throw things. Client-side Clojure
> would be fantastic.
>
> --
> 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 on Javascript

2010-10-30 Thread Bob Hutchison

On 2010-10-30, at 12:32 AM, Michael Gardner wrote:

> On Oct 29, 2010, at 11:09 PM, David Nolen wrote:
> 
>> JS brought me to Lisp, I would love to see the Clojure community bring Lisp 
>> back to JS. However I fail to see what advantage JS gives on the server 
>> side. From what I've seen the V8 GC and Node.js have a considerable number 
>> of years to go before they are serious contenders against the JVM for 
>> non-trivial projects, evented or no.
> 
> Agreed. What is the point of Javascript on the server side? Familiarity? 
> Consistency with client-side code?

The point isn't entirely Javascript on the server side...

- there are an awful lot of non-non-trivial *web* projects :-)
- it is (very) fast
- websockets/comet based applications absurdly easily set up
- this is the kind of thing the entire node.js community is interested in (it 
isn't a javascript-the-language focused community)

Aleph is extremely interesting. How many in the Clojure community know *of* it, 
let alone *know* it, or have actually *used* it? Know about integrating it with 
Ring? I'm just pointing out a difference in focus the two communities might 
have, this is not a criticism of either.

Aleph isn't the only thing happening out 'there'. What does the Clojure 
community know about Mongrel2 and ZeroMQ?

It is ridiculously easy to set up a quick prototype of a fancy web app using 
node.js, and it seems a lot of people aren't seeing a reason to move away from 
it when they start getting 'serious' about the app.

Like I said, it isn't "Javascript on the server" that's going on with node.js

> 
>> More interesting would be something along the lines of CoffeeScript (like 
>> ClojureScript) that takes a reasonable subset Clojure and compiles into 
>> efficient JS, allowing Clojure programmers to send Clojure code to clients.
> 
> Yes! Writing Javascript makes me want to throw things. Client-side Clojure 
> would be fantastic.

Certainly I'd kinda like this too. But being in wet-blanket-mode... it's gotta 
be more. To me the real problem in programming the browser is the DOM, it's 
*not* a language thing[1]. That has to be dealt with or Clojure on the browser 
will make you want to throw things too :-) You've also got to deal with the 
environment: how is Clojure's immutability of data going to fit into an 
environment where the whole purpose is mucking about with a huge hunk of state 
(the DOM)?

In the short term it seems to me that an "absurdly easy" way to get 
websocket/comet based servers running in Clojure would be good. At least I'd be 
happy. This problem is staring me in the face and I've got to do something next 
week. What do I do? node.js (done in 5 minutes) or somehow get 
Aleph/Ring/Clojure working? or Mongrel2/Ring/Clojure? or ZeroMQ/Ring/Clojure? 
or what? That's the kind of problem *I* am having to deal with.

I should probably bring this up on the Clojure web dev mailing list.

Cheers,
Bob

[1] and mootools and Google's Closure are making real progress with dealing 
with the DOM *and* making Javascript more uniform (so is jQuery for that matter)

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


Bob Hutchison
Recursive Design Inc.
http://www.recursive.ca/
weblog: http://xampl.com/so




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

2010-10-30 Thread David Nolen
On Sat, Oct 30, 2010 at 10:13 AM, Bob Hutchison wrote:

>
> In the short term it seems to me that an "absurdly easy" way to get
> websocket/comet based servers running in Clojure would be good. At least I'd
> be happy. This problem is staring me in the face and I've got to do
> something next week. What do I do? node.js (done in 5 minutes) or somehow
> get Aleph/Ring/Clojure working? or Mongrel2/Ring/Clojure? or
> ZeroMQ/Ring/Clojure? or what? That's the kind of problem *I* am having to
> deal with


Setting up Aleph to to build a WebSocket app takes about 5 minutes. There's
an example that's bundled with the library.

David

-- 
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: How to simplify cond statements

2010-10-30 Thread andrei


On Oct 29, 11:39 pm, Joop Kiefte  wrote:
> (first (flatten ...)) ?

And where reduction of code is?

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


NoSuchMethodError: clojure.lang.Symbol.create error from clojure.contrib.sql?

2010-10-30 Thread Sean Corfield
Just FYI, using clojure 1.3.0-master-SNAPSHOT and contrib/standalone
1.3.0-SNAPSHOT, I get the following error when I (:use
[clojure.contrib.sql]):

Exception in thread "main" java.lang.RuntimeException:
java.lang.NoSuchMethodError:
clojure.lang.Symbol.create(Ljava/lang/String;Ljava/lang/String;)Lclojure/lang/Symbol;
at clojure.lang.Compiler.eval(Compiler.java:6179)
at clojure.lang.Compiler.eval(Compiler.java:6159)
at clojure.lang.Compiler.load(Compiler.java:6601)
at clojure.lang.RT.loadResourceScript(RT.java:340)
at clojure.lang.RT.loadResourceScript(RT.java:331)
at clojure.lang.RT.load(RT.java:409)
at clojure.lang.RT.load(RT.java:381)
at clojure.core$load$fn__4403.invoke(core.clj:5339)
at clojure.core$load.doInvoke(core.clj:5338)
at clojure.lang.RestFn.invoke(RestFn.java:409)
at clojure.core$load_one.invoke(core.clj:5163)
at clojure.core$load_lib.doInvoke(core.clj:5200)
at clojure.lang.RestFn.applyTo(RestFn.java:143)
at clojure.core$apply.invoke(core.clj:599)
at clojure.core$load_libs.doInvoke(core.clj:5234)
at clojure.lang.RestFn.applyTo(RestFn.java:138)
at clojure.core$apply.invoke(core.clj:601)
at clojure.core$use.doInvoke(core.clj:5314)
at clojure.lang.RestFn.invoke(RestFn.java:409)
at 
worldsingles.data.match$eval223$loading__4302__auto224.invoke(match.clj:1)

-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

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

2010-10-30 Thread Chris Perkins
On Oct 30, 2:52 am, Shantanu Kumar  wrote:
> Hi,
>
> 1. I notice there is just the "parse" function mentioned as 
> public:http://clojure.github.com/clojure/clojure.xml-api.html
>
> I used the other functions in clojure.xml (emit, emit-element) and the
> var 'element' -- they appear to work fine for me. Are they just
> undocumented or not guaranteed to be maintained in future versions of
> Clojure?

I'm pretty sure emit is undocumented for a reason - the stuff it emits
is not, in general, valid XML. Use it at your peril.

user=> (clojure.xml/emit {:tag :foo :content ["<&>!!!"]})


<&>!!!


- Chris

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


Re: clojure.xml questions

2010-10-30 Thread Stuart Halloway
Hi Shantanu,

In general, Clojure's public API consists of only those vars that both (1) are 
public and (2) have a docstring. Anything else is undocumented, subject to 
change, and should be avoided.

If you want to get involved with Clojure's XML support, I have just created a 
space in Confluence to discuss design of a new clojure.data.xml library: 
http://dev.clojure.org/display/DXML/Home. 

This is not currently a top priority for the Clojure/core team, but we will 
definitely provide design and implementation review if somebody in the 
community wants to lead the charge.

Cheers,
Stu

Stuart Halloway
Clojure/core team at Relevance
http://clojure.com
http://thinkrelevance.com

> Hi,
> 
> 1. I notice there is just the "parse" function mentioned as public:
> http://clojure.github.com/clojure/clojure.xml-api.html
> 
> I used the other functions in clojure.xml (emit, emit-element) and the
> var 'element' -- they appear to work fine for me. Are they just
> undocumented or not guaranteed to be maintained in future versions of
> Clojure?
> 
> 2. The emitted XML string does not have indentation. Is there a way to
> fix that? I know there is 'prxml' in contrib but the format it expects
> is different (a vector) from what 'emit' expects (a map).
> 
> Regards,
> Shantanu
> 
> -- 
> 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: Hiccup-bridge: A converter between html and hiccup.

2010-10-30 Thread Hozumi
Hi All,

I've released conversion tool for hiccup.
http://github.com/hozumi/hiccup-bridge

Hiccup-bridge is aims for collaboration between programmers and
designers.
You can easily use this through leiningen.

% lein hicv 2html
% lein hicv 2hic

I welcome any comments or suggestions.

Thanks.
--
Takahiro Hozumi

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

2010-10-30 Thread Scott Jaderholm
On Sat, Oct 30, 2010 at 12:09 AM, David Nolen wrote:

> More interesting would be something along the lines of CoffeeScript (like
> ClojureScript) that takes a reasonable subset Clojure and compiles into
> efficient JS, allowing Clojure programmers to send Clojure code to clients.
>

That already exists in Allen Rohner's Scriptjure.
http://github.com/arohner/scriptjure

Scriptjure is very much equivalent to CoffeeScript, though not
Underscore.coffee. Most of my patches to scriptjure originated when I was
porting a CoffeeScript codebase to Scriptjure. The only major features of
CoffeeScript that it doesn't have that I notice are implicit returns and
well indented js output.

Of course Scriptjure is not Clojure on JS. It's just JS with Clojure syntax
and a few nice "compiler" tricks.

Being able to jump out to real Clojure inside your Clojure-looking JS with a
simple (clj (some real clojure code)) comes in really handy when the backend
is also Clojure and you have some data that both the client and server need.

You can also configure Emacs+mozrepl so that if you eval some scriptjure
code in emacs it gets compiled to js and evaled in your web browser.

Cheers,
Scott

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

REQUEST for feedback on http://clojure.org

2010-10-30 Thread Alex Miller
Hi all,

I'm doing a bit of doc cleanup on http://clojure.org and I'd welcome
your feedback on things that are broken or could be improved.  I'm not
looking (or likely authorized :) to make any drastic changes but if
there are things that you have run into, please drop a line here or in
email to alexdmiller at yahoo.com.  Ideally, I'd like people to be
logging tickets in jira, but I'm not sure it's quite ready for that
yet.

Some recent changes I've already made:
- switched all of the old richhickey github references to clojure
- cleaned up some factually wrong or out of date stuff on getting
started and download pages
- added Protocol and Datatypes pages to left nav (the pages have
existed for 6 months)
- added a page on starting a user group (still in review, not yet
linked)
- currently working on updating the cheat sheet to the 1.2 version
(and adding links!)

I'm particularly interested in:
- new user groups or suggestions for the community page
- stuff that is just wrong or out of date

This DOES NOT include stuff in the API or Contrib autodoc pages.
Please raise those issues or file tickets on those but that's not what
I'm focusing on at the moment.

Alex

-- 
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: Pulling threads...

2010-10-30 Thread Brian Ericson
Oh.  The "P" in "REPL" makes it non-lazy and the "let" meant that the
printer need only print the last line.  Ugh.  That is completely obvious in
hindsight!  Thanks!

I surrounded a few expressions with "dorun" and now both of my Clojure
implementations "run" -- or crawl, given the results of timing the first and
the second:
(first)
counter = 256 and took 139949 ms.

real 2m37.599s
user 4m48.874s
sys 2m23.225s

(second)
counter = 256 and took 34895 ms.

real 0m35.868s
user 1m14.625s
sys 0m24.035s

Not that I should be reading *too* much into my micro-benchmark

On Fri, Oct 29, 2010 at 7:07 AM, Meikel Brandmeyer  wrote:

> Hi,
>
> On 29 Okt., 06:58, Brian Ericson  wrote:
>
> > (map #(.start %) threads)
>
> map is not a loop. It creates a lazy sequences which does - nothing.
> At least not until it is realised. Here you throw it away
> immediatelly. Hence, no work is done. Use doseq instead when your main
> objective are side-effects like .start or .join. It works in the repl,
> because the repl prints the seq and thus realises it forcing the work
> to be done.
>
> Hope this helps.
>
> 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
>

-- 
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 application in the wild, to learn beautiful Clojure technique(s) from

2010-10-30 Thread Alex Baranosky
Hi all,

I've read Programming Clojure, and written a toy app in it to get my
feet wet.  I also listen in on this Google group from time to time as
well, to get more of a sense of the language.

I enjoyed "Programming Clojure" by Stuart Halloway, but it didn't
leave me with a clear idea of how to go out and write a 'real'
application.  What I'd really like to see is an example of code that
uses all of Clojure's features so I can see how they all fit together
in the wild, when you need to interact with templating languages,
databases, and web servers.

Are there any projects on GitHub you consider a great example of
this?  One that I could read through and imitate to really glean some
useful understanding of how all the great pieces of Clojure work
together on a project?

Thanks for your help,
Alex

-- 
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't locate str_utils in classpath

2010-10-30 Thread Steven Arnold
Hello, I am trying to use the str-utils library with Clojure (or the
str-utils2, I understand str-utils was deprecated).  Neither of these
work for me.  I am on OS X 10.6.4 and have installed clojure-contrib
via the MacPorts system.  The clojure-contrib is in my classpath; see
below for a transcript of what I did.

I have been struggling with this for hours, searching through Google,
asking on the IRC channelall to load a library from clojure-
contrib.  Any ideas what I'm missing?

[ 10:41 PM (58) aleph:thoth ~/Source/clojure ] > echo $CLASSPATH
/opt/local/share/java/clojure/lib
[ 10:41 PM (59) aleph:thoth ~/Source/clojure ] > ls -al $CLASSPATH
total 8200
drwxr-xr-x  5 root  admin  170 Oct 29 23:00 .
drwxr-xr-x  5 root  admin  170 Oct  3 23:14 ..
-rw-r--r--@ 2 root  admin   477050 Oct 29 23:35 clojure-contrib.jar
-rw-r--r--@ 2 root  admin  3237168 Oct  3 23:14 clojure.jar
[ 10:41 PM (60) aleph:thoth ~/Source/clojure ] > clj
Clojure 1.2.0
user=> (use 'clojure.contrib.str-utils)
java.io.FileNotFoundException: Could not locate clojure/contrib/
str_utils__init.class or clojure/contrib/str_utils.clj on classpath:
(NO_SOURCE_FILE:0)
user=> (use 'clojure.contrib.str-utils2)
java.io.FileNotFoundException: Could not locate clojure/contrib/
str_utils2__init.class or clojure/contrib/str_utils2.clj on
classpath:  (NO_SOURCE_FILE:0)

Thanks,
steven

-- 
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't locate str_utils in classpath

2010-10-30 Thread Santosh Rajan
Is the contrib.jar in your 'clj' script classpath?

On Sun, Oct 31, 2010 at 10:18 AM, Steven Arnold
wrote:

> Hello, I am trying to use the str-utils library with Clojure (or the
> str-utils2, I understand str-utils was deprecated).  Neither of these
> work for me.  I am on OS X 10.6.4 and have installed clojure-contrib
> via the MacPorts system.  The clojure-contrib is in my classpath; see
> below for a transcript of what I did.
>
> I have been struggling with this for hours, searching through Google,
> asking on the IRC channelall to load a library from clojure-
> contrib.  Any ideas what I'm missing?
>
> [ 10:41 PM (58) aleph:thoth ~/Source/clojure ] > echo $CLASSPATH
> /opt/local/share/java/clojure/lib
> [ 10:41 PM (59) aleph:thoth ~/Source/clojure ] > ls -al $CLASSPATH
> total 8200
> drwxr-xr-x  5 root  admin  170 Oct 29 23:00 .
> drwxr-xr-x  5 root  admin  170 Oct  3 23:14 ..
> -rw-r--r--@ 2 root  admin   477050 Oct 29 23:35 clojure-contrib.jar
> -rw-r--r--@ 2 root  admin  3237168 Oct  3 23:14 clojure.jar
> [ 10:41 PM (60) aleph:thoth ~/Source/clojure ] > clj
> Clojure 1.2.0
> user=> (use 'clojure.contrib.str-utils)
> java.io.FileNotFoundException: Could not locate clojure/contrib/
> str_utils__init.class or clojure/contrib/str_utils.clj on classpath:
> (NO_SOURCE_FILE:0)
> user=> (use 'clojure.contrib.str-utils2)
> java.io.FileNotFoundException: Could not locate clojure/contrib/
> str_utils2__init.class or clojure/contrib/str_utils2.clj on
> classpath:  (NO_SOURCE_FILE:0)
>
> Thanks,
> steven
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




-- 
http://hi.im/santosh

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