Re: Foreclojure

2009-06-25 Thread Emeka
 accounting software in Clojure?
Which area of accounting will it cover?

Emeka

On Thu, Jun 25, 2009 at 3:41 AM, fft1976  wrote:

>
> I know some of you are searching for names for your projects. I just
> wanted to say that "Foreclojure" is taken! This will be an open-source
> (but not GPL) accounting software in Clojure. Stay tuned.
> >
>

--~--~-~--~~~---~--~~
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: Adding source file information to compiler exceptions

2009-06-25 Thread vseguip

Ok the SCA agrrement says we can actually print/sign/scan the
agreement ans den it via e-mail.
 Is this a possibility for Clojure or postal mail is the only one and
true way?

Cheers, V.Seguí

On 18 jun, 09:28, vseguip  wrote:
> Thanks for the link, I hadn't seen it. It seems like an overkill for
> what is in an essence a 4 line patch to have to sign the CA send it to
> Rich via postal mail, specially considering I'm from Spain and wait
> for his approval. I can do it if there isn't any other option though.
>
> Cheers,
>   V. Seguí
>
> On 17 jun, 21:12, "J. McConnell"  wrote:
>
> > On Wed, Jun 17, 2009 at 2:55 PM,vseguip wrote:
>
> > > or is there a preferred way to communicate patches?
>
> > This is new:
>
> >http://clojure.org/patches
>
> > - J.
--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread James Reeves

On Jun 25, 5:38 am, Mark Addleman  wrote:
> Searching through this forum, I found many posts relating to improving
> Clojure's error messages.  I stumbled across one where Rich makes a
> plea for concrete suggestions to specific cases.

Here's one that regularly confuses me:

  (prn [10)

  => java.lang.Exception: Unmatched delimiter: )

Ideally the exception should correctly report the type of unmatched
bracket. In this case:

  => java.lang.Exception: Unmatched delimiter: ]

- 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: Roadmap of Clojure 1.1

2009-06-25 Thread Jarkko Oranen



On Jun 25, 9:51 am, michael frericks  wrote:
> Hello,
>
> i am a little bit lost about the roadmap of clojure 1.1. Is there
> anywhere an (evolving) list available of
>
> a) new features planned,
> b) things that break Clojure 1.0
> c) and maybe removed features?

You could take a look at the Clojure Assembla space at
http://www.assembla.com/spaces/dashboard/index/clojure/

It has milestones and wikipages about several upcoming changes

> Thanks
> Michael

--
Jarkko
--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread James Reeves

On Jun 25, 10:02 am, James Reeves  wrote:
> Here's one that regularly confuses me:
>
>   (prn [10)
>
>   => java.lang.Exception: Unmatched delimiter: )
>
> Ideally the exception should correctly report the type of unmatched
> bracket. In this case:
>
>   => java.lang.Exception: Unmatched delimiter: ]

I've just realised I've made a mistake. The error message is not
complaining that there is a parenthesis missing; it is complaining
that an ending parenthesis has no matching start parenthesis.

So this is an technically accurate error message, but perhaps not the
most intuitive, as a user is more likely to miss off an ending bracket
than a starting one. A better error message might be:

  => java.lang.Exception: Missing delimiter: ]

- 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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Mark Addleman

java.lang.UnsupportedOperationException: nth not supported on this
type: Symbol (db.clj:101)

The line number isn't very useful because it is always the first line
of the definition.  To help me locate the error, it would be helpful
to list the specific symbol such as "nth not supported on ':symbol' of
type Symbol "
--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Mark Addleman



On Jun 25, 4:15 am, Mark Addleman  wrote:
> java.lang.UnsupportedOperationException: nth not supported on this
> type: Symbol (db.clj:101)

It turns out this error was due to not specifying my macro's arg list
within brackets:

(defmacro with-table table rows & instructions ...)

of course, it should be

(defmacro with-table [table rows & instructions] ...)


--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Rich Hickey

On Thu, Jun 25, 2009 at 7:03 AM, James Reeves wrote:
>
> On Jun 25, 10:02 am, James Reeves  wrote:
>> Here's one that regularly confuses me:
>>
>>   (prn [10)
>>
>>   => java.lang.Exception: Unmatched delimiter: )
>>
>> Ideally the exception should correctly report the type of unmatched
>> bracket. In this case:
>>
>>   => java.lang.Exception: Unmatched delimiter: ]
>
> I've just realised I've made a mistake. The error message is not
> complaining that there is a parenthesis missing; it is complaining
> that an ending parenthesis has no matching start parenthesis.
>
> So this is an technically accurate error message, but perhaps not the
> most intuitive, as a user is more likely to miss off an ending bracket
> than a starting one. A better error message might be:
>
>  => java.lang.Exception: Missing delimiter: ]
>

But it doesn't know when it sees the ) that ] is missing, it might not be:

(prn [10)]

i.e. the ) has nothing to do with the [, there might not even be a
pending aggregate:

user=> )
java.lang.Exception: Unmatched delimiter: )

Rich

--~--~-~--~~~---~--~~
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: Convincing others about Clojure

2009-06-25 Thread Alan Busby
Make them watch the following video.

http://ocaml.janestreet.com/?q=node/61

Although the video isn't about Clojure, I think most of the points regarding
ML are true of Clojure as well.



On Thu, Jun 25, 2009 at 3:50 PM, Timothy Pratley
wrote:

>
> > 1. How do you get Clojure programmers? Lisp is not for the faint hearted.
>
> Clojure is extremely easy to learn compared to 'Lisp':
> You get collection based functions that apply other functions map/
> reduce/filter
> You get simple powerful data structures hashmaps sets vectors lists
> You get atomic, thread safe mutables
> You can write Java without all the crud.
>
>
> > 2. What about the performance of Clojure? Is it fast?
>
> Its not the fastest. But I've written much slower C code because
> searching an array linearly is easier than 'doing it right' and I have
> a deadline. I'd say with a sensible language you actually have time to
> focus on performance. With the 'fastest' language sometimes I'm just
> fighting to make things work.
>
>
> > 3. People who want to use this are more academically inclined and are
> > not practical. This will make the whole project fail.
>
> Rich is not an academic
> http://en.wikipedia.org/wiki/Rich_Hickey
> He wrote Clojure as a better way of developing, and it 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
-~--~~~~--~~--~--~---



defn memory question

2009-06-25 Thread Rich Claxton

Hello I have just started learning Clojure and functional programming,
quick question, what happens internally when I do a defn, does this
create the byte code, or a ref to the function which is stored, as it
does actually create a function object, I was just wondering about
memory and GC issues.

Cheers Richard.

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



Differences between 'compiled', 'clojure interpreted', 'clojure in a jar in classpath' and 'load'

2009-06-25 Thread BerlinBrown

I have a clojure application where each file has its own namespace (ns
blah)...I generally let the files sit in a classpath directory, so I
am assuming the clojure code is loaded at startup time.

What are the differences between clojure code which is:

1. Compiled
2. Clojure code that is interpreted (that just sits in the classpath)
3. Clojure code that loads from a jar file
4. Clojure code that gets load with the 'load' function.

Just from experience, I can't tell any speed differences between any
of them except for number 4, because I normally don't use the 'load'
function.

Are there any differences are an approach you recommend.  I was a
little wary in earlier releases in uses the 'compiled' clojure code, I
seem to notice more issues with compiled code, but in Clojure 1.0 I
can't reproduce those errors.


--~--~-~--~~~---~--~~
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: defn memory question

2009-06-25 Thread Konrad Hinsen

On Jun 25, 2009, at 12:25, Rich Claxton wrote:

> Hello I have just started learning Clojure and functional programming,
> quick question, what happens internally when I do a defn, does this
> create the byte code, or a ref to the function which is stored, as it
> does actually create a function object, I was just wondering about
> memory and GC issues.

First of all,

(defn f [a b c] ...)

is just a shorthand for

(def f (fn f [a b c] ...))

The "def" part just assigns an object to a variable. The (fn ...)  
part is the more interesting one. It creates bytecode for a Java  
class that has a method "invoke" used for calling the function. It  
also creates an instance of that class, which is the return value  
that is assigned to f.

The distinction becomes of interest if you create a function inside a  
function: the function's code is compiled only once, so there is only  
one class, but there may well be several instances of this class. In  
the case of a closure (a function that captures values from its  
lexical environment), each instance stores its specific captured  
values, but the code exists only once.

Konrad.


--~--~-~--~~~---~--~~
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: defn memory question

2009-06-25 Thread Emeka
>From Steve's post
Symbol objects are subject to garbage collection, but the "namespace" and
"name" strings that identify them are not. Those strings are "interned" via
the "intern" method on java.lang.String. Once a String is interned, there
exists a single canonical String object that represents it throughout the
remaining lifetime the JVM instance. Any two Symbols of the same namespace
and name will reference those canonical namespace and name strings and will
thus have identical namespaces and names.

  Not interning the Symbols themselves turns out to be important in
Clojure because it allows two Symbols with identical namespace and name to
have different metadata.

  Keyword objects are interned by Clojure and are not garbage collected.
When a Keyword is created, it's placed in a ConcurrentHashMap that maps a
Symbol of the same name and namespace to the Keyword object. In a given JVM
instance, there is at most one Keyword object with a given name and
namespace. Whenever the reader reads a Keyword's text representation, it
returns the unique Keyword object associated with it.

  Here's some repl playing to support this:

 user=> (identical? 'a/b 'a/b)
 false
 user=> (identical? (name 'a/b) (name 'a/b))
 true
 user=> (identical? (namespace 'a/b) (namespace 'a/b))
 true
 user=> (= (quote #^{:tagged true} a/b) (quote a/b))
 true
 user=> (= (meta (quote #^{:tagged true} a/b)) (meta (quote
a/b)))
 false
 user=> (identical? :a/b :a/b)
 true




On Thu, Jun 25, 2009 at 10:25 AM, Rich Claxton wrote:

>
> Hello I have just started learning Clojure and functional programming,
> quick question, what happens internally when I do a defn, does this
> create the byte code, or a ref to the function which is stored, as it
> does actually create a function object, I was just wondering about
> memory and GC issues.
>
> Cheers Richard.
>
> >
>

--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Chouser

On Thu, Jun 25, 2009 at 2:20 AM, Timothy
Pratley wrote:
>
> Here are some of my common mistakes:
>
> user=> (def data (ref {}))
> #'user/data
> user=> (dosync alter data assoc :a "a")
> "a"
> user=> (dosync (alter data assoc :a "a"))
> {:a "a"}
> ;; leaving out the parenthesis on a dosync can be silent and fatal,
> like a ninja

Interesting.  Can there ever be a purpose in having
something other than a list before the tail position of
a 'do'?

Hm, I suppose you could make calls that have side-effects
within a map or vector literal, although that would be weird
since the map or vector itself would be thrown away:

(do
  [(println "why??")]
  5)

So even if the compiler ought to let that pass, is there
ever a purpose in having a bare symbol before the tail
position of a 'do'?

(do
  samurai
  10)

It might be nice to get a "useless bare symbol" warning in
cases like this.

I'd be happy to try to write a patch for this if one is
welcome.

> (if-let [a 1]
>  (println a)
>  a
>  (inc c))
> java.lang.IllegalArgumentException: if-let requires a vector for its
> binding (NO_SOURCE_FILE:0)
> ;; rather cryptic errors from if-let when not quite right, like an
> illusionist using misdirection to awe the audience

This message is the result of an earlier attempt at specific
and helpful error messages.  It is based on the assumption
that you're trying to use an old form of if-let:

(if-let [a b] my-pair
  a
  (inc c))
java.lang.IllegalArgumentException: if-let requires a vector for its
binding (NO_SOURCE_FILE:0)

Would you recommend a more general and therefore more
accurate message?  Something like "your if-let syntax is
incorrect"?


> (javax.swing.UIManager/setLookAndFeel
>  javax.swing.UIManager/getSystemLookAndFeelClassName)
> java.lang.Exception: Unable to find static field:
> getSystemLookAndFeelClassName in class javax.swing.UIManager
> (NO_SOURCE_FILE:7)
> ;; this one drives me nuts, I forget to call the method
> ;; if you don't read carefully it looks like maybe I just typoed the
> long method name so I spend about 10minutes checking javadocs, cutting
> and pasting, importing etc
> ;; The error while correct seems a bit odd seeing Class/method looks a
> method (though I understand why it isn't).

So in this case the message is accurate but too general?
These must be hard to get right!  I suppose the compiler
could look for a no-arg method by that name and suggest that
specific cause in the message.

> (java.lang.Math/abs 2/3)
> java.lang.IllegalArgumentException: No matching method found: abs
> (NO_SOURCE_FILE:0)
> ;; abs wont work on ratios, but the error message doesn't give the
> signature being sought.
> ;; abs for java numbers exists, abs for ratios doesn't.
> ;; It is not always obvious that 2/3 is a ratio if it is a passed in
> variable.

I agree that it'd be helpful to list the arg types passed in:
"No 'abs' method found for [clojure.lang.Ratio]"

I wouldn't expect this to be too hard to patch either.

--Chouser

--~--~-~--~~~---~--~~
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: [OT] Convincing others about Clojure

2009-06-25 Thread Nathan Hawkins

On Thu, 25 Jun 2009 11:29:24 +0530
Baishampayan Ghose  wrote:

> 
> Their concerns are thus:
> 
> 1. How do you get Clojure programmers? Lisp is not for the faint
> hearted.

You can always ask on this list. I'd guess that at any given point
in time there are probably several people who'd rather being
working with Clojure in their day job than whatever they're actually
doing now. (Me, for instance...)
 
> 2. What about the performance of Clojure? Is it fast?

It can be faster than a lot of other popular choices, like Ruby or
Python. I wish it compiled to native code instead of Java, but that's
mostly because I don't like Java.

> 3. People who want to use this are more academically inclined and are
> not practical. This will make the whole project fail.

Many innovative ideas in computer science tend to in academia
and only slowly make their way into more mainstream, practical
environments.

Consider garbage collection, or relational databases. Both very
"academic" at one time, and now they're everywhere.

Point being, really practical people use the best ideas they can,
regardless of where they came from.

Nathan

--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Mark Addleman



On Jun 25, 4:26 am, Rich Hickey  wrote:
> On Thu, Jun 25, 2009 at 7:03 AM, James Reeves 
> wrote:
>
> > On Jun 25, 10:02 am, James Reeves  wrote:
> >> Here's one that regularly confuses me:
>
> >>   (prn [10)
>
> >>   => java.lang.Exception: Unmatched delimiter: )
>
> >> Ideally the exception should correctly report the type of unmatched
> >> bracket. In this case:
>
> >>   => java.lang.Exception: Unmatched delimiter: ]
>
> > I've just realised I've made a mistake. The error message is not
> > complaining that there is a parenthesis missing; it is complaining
> > that an ending parenthesis has no matching start parenthesis.
>
> > So this is an technically accurate error message, but perhaps not the
> > most intuitive, as a user is more likely to miss off an ending bracket
> > than a starting one. A better error message might be:
>
> >  => java.lang.Exception: Missing delimiter: ]
>
> But it doesn't know when it sees the ) that ] is missing, it might not be:
>
> (prn [10)]
>
> i.e. the ) has nothing to do with the [, there might not even be a
> pending aggregate:
>
> user=> )
> java.lang.Exception: Unmatched delimiter: )
>
> Rich

In your example, couldn't the parser know that when it sees the ),
something has gone wrong?  Maybe it's due to my IDE's lack of
sophistication, but I find my paren/bracket/brace problems are almost
always around closing them properly (hey, that's punny!) so it would
help me if the error message indicated that it saw ) but expected ].

As an aside, it would be helpful if the parser error messages could
include the column number as well as the line number.  Even without
further IDE support, it would be helpful in determining where the
nesting has gone wrong.  I think it would also be helpful if compiler
error messages included column numbers as well, but I can see how that
might be difficult.  I know this violates my earlier statement about
being specific, but maybe a custom exception for Compiler errors that
included the specific statement list with the error.  It seems like
IDEs could do something interesting with that information such as
opening a REPL populated with the statement so I could do some
exploratory debugging or offer assistance by consulting some database
of common mistakes...
--~--~-~--~~~---~--~~
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: Convincing others about Clojure

2009-06-25 Thread Berlin Brown



On Jun 25, 9:31 am, Nathan Hawkins  wrote:
> On Thu, 25 Jun 2009 11:29:24 +0530
>
> Baishampayan Ghose  wrote:
>
> > Their concerns are thus:
>
> > 1. How do you get Clojure programmers? Lisp is not for the faint
> > hearted.
>
> You can always ask on this list. I'd guess that at any given point
> in time there are probably several people who'd rather being
> working with Clojure in their day job than whatever they're actually
> doing now. (Me, for instance...)
>
> > 2. What about the performance of Clojure? Is it fast?
>
> It can be faster than a lot of other popular choices, like Ruby or
> Python. I wish it compiled to native code instead of Java, but that's
> mostly because I don't like Java.
>
> > 3. People who want to use this are more academically inclined and are
> > not practical. This will make the whole project fail.
>
> Many innovative ideas in computer science tend to in academia
> and only slowly make their way into more mainstream, practical
> environments.
>
> Consider garbage collection, or relational databases. Both very
> "academic" at one time, and now they're everywhere.
>
> Point being, really practical people use the best ideas they can,
> regardless of where they came from.
>
> Nathan

This is how I think of clojure, but first I want you to do some
experiments.  I assuming you come from a Java/J2EE background:

1. Get an image of SQL in your mind.
2. Now build an image of Javascript and what javascript is used for.
3. Now imagine JSPs or ASP, Server Pages.
4. Now imagine XML.
5. Imagine Bash scripting.
6. Imagine what Ruby or Python does for certain people.
7. Envision a J2EE or large application that takes advantage of many
different technologies.

So you have all of these images of different languages and
technologies.  They are all different tools used to build an
application for users.

Clojure is a a language that runs on the JVM.  It is as simple or as
complicated as you make it.  For me, I can treat it as a wrapper over
my existing code or evolve and use complex functional programming
techniques.

This is my main point: One thing that Clojure is NOT.  It is not
limited by the limitations of the Java programming language.

Think about Clojure as another tool that you can use to write better
code.
--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Chouser

On Thu, Jun 25, 2009 at 12:38 AM, Mark
Addleman wrote:
>
> Searching through this forum, I found many posts relating to improving
> Clojure's error messages.  I stumbled across one where Rich makes a
> plea for concrete suggestions to specific cases.  I'm very sympathetic
> to that, so I'd like to start a thread of specific coding errors that
> I've run across where I've felt the error messages could be improved.
>
> (*) Improperly specifying a map, e.g. "{:a 1 :b}" yields an array out
> of bounds exception.

It seems like this could be caught at read time, just by
having the Map classes complain about non-even-length init arrays.

--Chouser

--~--~-~--~~~---~--~~
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: Concatenating Regexes?

2009-06-25 Thread Chouser

On Wed, Jun 24, 2009 at 9:04 PM, Chouser wrote:
> On Wed, Jun 24, 2009 at 6:13 PM, CuppoJava wrote:
>>
>> I need to dynamically create a regex, and would really like to be able
>> to use Clojure's built-in regex syntax. But I don't know how to go
>> about it.
>>
>> My regex is: #"(.*?)(\(image .*)"
>>
>> except instead of "image", I need to dynamically insert an array of
>> possible strings to match.
>>
>> ie. given ["image" "buffer" "spacer"]
>>
>> I need to produce #"(.*?)(\((?:image|buffer|spacer) .*)"
>
> Here the best I've come up with for your example:
>
> (use '[clojure.contrib.str-utils :only [str-join]])
>
> (defn my-regex [words]
>  (re-pattern (str #"(.*?)"   ; stands alone, so #"" works
>                   "(\\((?:"  ; regular string, so \ must be escaped
>                     (str-join "|" words)
>                   ").*)")))

Had another thought:

(defn my-regex [words]
  (re-pattern
(.replace (str #"(.*?)(\((?:WORDS).*)")
  "WORDS"
  (str-join "|" words

user=> (my-regex ["image" "buffer" "spacer"])
#"(.*?)(\((?:image|buffer|spacer).*)"

That lets you use express more of the regex inside a #"",
though whether it's easier to understand in the end I'll
leave to you to decide.

--Chouser

--~--~-~--~~~---~--~~
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: Convincing others about Clojure

2009-06-25 Thread Berlin Brown



On Jun 25, 9:39 am, Berlin Brown  wrote:
> On Jun 25, 9:31 am, Nathan Hawkins  wrote:
>
>
>
> > On Thu, 25 Jun 2009 11:29:24 +0530
>
> > Baishampayan Ghose  wrote:
>
> > > Their concerns are thus:
>
> > > 1. How do you get Clojure programmers? Lisp is not for the faint
> > > hearted.
>
> > You can always ask on this list. I'd guess that at any given point
> > in time there are probably several people who'd rather being
> > working with Clojure in their day job than whatever they're actually
> > doing now. (Me, for instance...)
>
> > > 2. What about the performance of Clojure? Is it fast?
>
> > It can be faster than a lot of other popular choices, like Ruby or
> > Python. I wish it compiled to native code instead of Java, but that's
> > mostly because I don't like Java.
>
> > > 3. People who want to use this are more academically inclined and are
> > > not practical. This will make the whole project fail.
>
> > Many innovative ideas in computer science tend to in academia
> > and only slowly make their way into more mainstream, practical
> > environments.
>
> > Consider garbage collection, or relational databases. Both very
> > "academic" at one time, and now they're everywhere.
>
> > Point being, really practical people use the best ideas they can,
> > regardless of where they came from.
>
> > Nathan
>
> This is how I think of clojure, but first I want you to do some
> experiments.  I assuming you come from a Java/J2EE background:
>
> 1. Get an image of SQL in your mind.
> 2. Now build an image of Javascript and what javascript is used for.
> 3. Now imagine JSPs or ASP, Server Pages.
> 4. Now imagine XML.
> 5. Imagine Bash scripting.
> 6. Imagine what Ruby or Python does for certain people.
> 7. Envision a J2EE or large application that takes advantage of many
> different technologies.
>
> So you have all of these images of different languages and
> technologies.  They are all different tools used to build an
> application for users.
>
> Clojure is a a language that runs on the JVM.  It is as simple or as
> complicated as you make it.  For me, I can treat it as a wrapper over
> my existing code or evolve and use complex functional programming
> techniques.
>
> This is my main point: One thing that Clojure is NOT.  It is not
> limited by the limitations of the Java programming language.
>
> Think about Clojure as another tool that you can use to write better
> code.

I think the hardest part is convincing yourself that you can use one
or more core languages for your project.  I guess we think we only
need C, or Java or C++ and that is it.  But we normally integrate with
other technologies like JSPs anyway.

I have been programming with some JVM language since the early Jython
days and I still find it a little hard to break away completely from
using Java language code.

I want to integrate a Java, Clojure, Scala app but I still haven't
included Scala into the process yet.
--~--~-~--~~~---~--~~
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: [OT] Convincing others about Clojure

2009-06-25 Thread Adrian Cuthbertson
> I need some pointers on this. This is a really crucial thing for me and
> any help will be appreciated.

Here's one - better warn them not to let on what the startup is. Someone
here will get it to market an order of magnitude quicker than they will on
some other platform :-).


On Thu, Jun 25, 2009 at 7:59 AM, Baishampayan Ghose wrote:

> Hello,
>
> So I have been a Common Lisp user for quite sometime and at my earlier
> work we managed to build a state-of-the-art Travel portal in CL with a
> very small team of CL programmers.
>
> This was all fine except one thing. The management never really believed
> in Lisp and they eventually replaced the whole Lisp team with 3x Java
> programmers and are now rewriting the perfectly fine system in Java.
>
> That was my earlier job.
>
> Now I am at the moment doing a startup and I was thinking of using
> Clojure because it has the best of both the worlds. It can use Java
> libs, is a Lisp and is heavily geared towards concurrent programming;
> making it one of the most modern and pragmatic programming languages at
> the moment.
>
> This decision was based purely on the merit of Clojure and not because I
> just wanted to do some Lisp programming. I seriously believe that
> Clojure can really help us in building the kind of concurrent
> application we want to build.
>
> But then, there is another problem. The advisors of the current startup
> (who were techies in their time, but now are highly successful people in
> the Silicon Valley) reacted strongly to the word "Lisp" (it apparently
> brought back old memories of their AI class in college) and are not
> "convinced enough" about Clojure.
>
> I tried explaining that Clojure runs on the JVM and thus won't have any
> problem with libs or integrating with existing Java apps but they are
> not happy.
>
> Their concerns are thus:
>
> 1. How do you get Clojure programmers? Lisp is not for the faint hearted.
>
> 2. What about the performance of Clojure? Is it fast?
>
> 3. People who want to use this are more academically inclined and are
> not practical. This will make the whole project fail.
>
> I need some pointers on this. This is a really crucial thing for me and
> any help will be appreciated.
>
> Regards,
> BG
>
> --
> Baishampayan Ghose 
> oCricket.com
>
>

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



Re: Concatenating Regexes?

2009-06-25 Thread Christophe Grand
On Thu, Jun 25, 2009 at 4:05 PM, Chouser  wrote:

>
> On Wed, Jun 24, 2009 at 9:04 PM, Chouser wrote:
> > On Wed, Jun 24, 2009 at 6:13 PM, CuppoJava
> wrote:
> >>
> >> I need to dynamically create a regex, and would really like to be able
> >> to use Clojure's built-in regex syntax. But I don't know how to go
> >> about it.
> >>
> >> My regex is: #"(.*?)(\(image .*)"
> >>
> >> except instead of "image", I need to dynamically insert an array of
> >> possible strings to match.
> >>
> >> ie. given ["image" "buffer" "spacer"]
> >>
> >> I need to produce #"(.*?)(\((?:image|buffer|spacer) .*)"
> >
> > Here the best I've come up with for your example:
> >
> > (use '[clojure.contrib.str-utils :only [str-join]])
> >
> > (defn my-regex [words]
> >  (re-pattern (str #"(.*?)"   ; stands alone, so #"" works
> >   "(\\((?:"  ; regular string, so \ must be escaped
> > (str-join "|" words)
> >   ").*)")))
>
> Had another thought:
>
> (defn my-regex [words]
>  (re-pattern
> (.replace (str #"(.*?)(\((?:WORDS).*)")
>  "WORDS"
>   (str-join "|" words
>
> user=> (my-regex ["image" "buffer" "spacer"])
> #"(.*?)(\((?:image|buffer|spacer).*)"
>
> That lets you use express more of the regex inside a #"",
> though whether it's easier to understand in the end I'll
> leave to you to decide.
>


applying Pattern/quote on each word can be interesting (unless you expecte
words to be a coll of pattern-strings).

Christophe

-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread James Reeves

On Jun 25, 12:26 pm, Rich Hickey  wrote:
> But it doesn't know when it sees the ) that ] is missing, it might not be:
>
> (prn [10)]
>
> i.e. the ) has nothing to do with the [, there might not even be a
> pending aggregate:
>
> user=> )
> java.lang.Exception: Unmatched delimiter: )

Good point. Then what about:

user=> (prn [10)]
java.lang.Exception: Unmatched delimiter ')', expecting ']'

user=> )
java.lang.Exception: Unmatched delimeter ')', expecting end

Where the expected value is the closing bracket of last opened
bracket, or "end", if there was no previous bracket.

- 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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Rich Hickey



On Jun 25, 9:36 am, Mark Addleman  wrote:
> On Jun 25, 4:26 am, Rich Hickey  wrote:
>
>
>
>
>
> > On Thu, Jun 25, 2009 at 7:03 AM, James Reeves 
> > wrote:
>
> > > On Jun 25, 10:02 am, James Reeves  wrote:
> > >> Here's one that regularly confuses me:
>
> > >>   (prn [10)
>
> > >>   => java.lang.Exception: Unmatched delimiter: )
>
> > >> Ideally the exception should correctly report the type of unmatched
> > >> bracket. In this case:
>
> > >>   => java.lang.Exception: Unmatched delimiter: ]
>
> > > I've just realised I've made a mistake. The error message is not
> > > complaining that there is a parenthesis missing; it is complaining
> > > that an ending parenthesis has no matching start parenthesis.
>
> > > So this is an technically accurate error message, but perhaps not the
> > > most intuitive, as a user is more likely to miss off an ending bracket
> > > than a starting one. A better error message might be:
>
> > >  => java.lang.Exception: Missing delimiter: ]
>
> > But it doesn't know when it sees the ) that ] is missing, it might not be:
>
> > (prn [10)]
>
> > i.e. the ) has nothing to do with the [, there might not even be a
> > pending aggregate:
>
> > user=> )
> > java.lang.Exception: Unmatched delimiter: )
>
> > Rich
>
> In your example, couldn't the parser know that when it sees the ),
> something has gone wrong?  Maybe it's due to my IDE's lack of
> sophistication, but I find my paren/bracket/brace problems are almost
> always around closing them properly (hey, that's punny!) so it would
> help me if the error message indicated that it saw ) but expected ].
>

It does know when it sees the ')',  and reports it then. But what
exactly has gone wrong (beyond the ')' has no partner) is subjective.
Another example:

(let [x map inc nums)] ...)

Clearly the message: "java.lang.Exception: Missing delimiter: ]" would
not be helpful here.

This seems to me an edit-time bug best fixed using an editor with
proper matching support.

Rich

--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread David Nolen
FWIW, this is the kind of problem that paredit mode in Emacs
eliminates almost entirely.

On Thu, Jun 25, 2009 at 11:14 AM, Rich Hickey  wrote:

>
>
>
> On Jun 25, 9:36 am, Mark Addleman  wrote:
> > On Jun 25, 4:26 am, Rich Hickey  wrote:
> >
> >
> >
> >
> >
> > > On Thu, Jun 25, 2009 at 7:03 AM, James Reeves<
> weavejes...@googlemail.com> wrote:
> >
> > > > On Jun 25, 10:02 am, James Reeves 
> wrote:
> > > >> Here's one that regularly confuses me:
> >
> > > >>   (prn [10)
> >
> > > >>   => java.lang.Exception: Unmatched delimiter: )
> >
> > > >> Ideally the exception should correctly report the type of unmatched
> > > >> bracket. In this case:
> >
> > > >>   => java.lang.Exception: Unmatched delimiter: ]
> >
> > > > I've just realised I've made a mistake. The error message is not
> > > > complaining that there is a parenthesis missing; it is complaining
> > > > that an ending parenthesis has no matching start parenthesis.
> >
> > > > So this is an technically accurate error message, but perhaps not the
> > > > most intuitive, as a user is more likely to miss off an ending
> bracket
> > > > than a starting one. A better error message might be:
> >
> > > >  => java.lang.Exception: Missing delimiter: ]
> >
> > > But it doesn't know when it sees the ) that ] is missing, it might not
> be:
> >
> > > (prn [10)]
> >
> > > i.e. the ) has nothing to do with the [, there might not even be a
> > > pending aggregate:
> >
> > > user=> )
> > > java.lang.Exception: Unmatched delimiter: )
> >
> > > Rich
> >
> > In your example, couldn't the parser know that when it sees the ),
> > something has gone wrong?  Maybe it's due to my IDE's lack of
> > sophistication, but I find my paren/bracket/brace problems are almost
> > always around closing them properly (hey, that's punny!) so it would
> > help me if the error message indicated that it saw ) but expected ].
> >
>
> It does know when it sees the ')',  and reports it then. But what
> exactly has gone wrong (beyond the ')' has no partner) is subjective.
> Another example:
>
> (let [x map inc nums)] ...)
>
> Clearly the message: "java.lang.Exception: Missing delimiter: ]" would
> not be helpful here.
>
> This seems to me an edit-time bug best fixed using an editor with
> proper matching support.
>
> Rich
>
> >
>

--~--~-~--~~~---~--~~
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: Concatenating Regexes?

2009-06-25 Thread CuppoJava

I don't know what you mean by Pattern/quote, can you give me an
example?

And I really like Chouser's second method. That's very tidy!

Thanks Chouser
 -Patrick
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



"print" without separating spaces?

2009-06-25 Thread CuppoJava

Hi,
Is there a "print" command that doesn't separate it's arguments using
spaces? I wrote my own function to work-around this but hopefully it's
already been done for me.

(defn write [& strings]
  (print (apply str strings)))

Thanks
  -Patrick
--~--~-~--~~~---~--~~
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: defn memory question

2009-06-25 Thread Four of Seventeen

On Jun 25, 8:36 am, Emeka  wrote:
> From Steve's post
> Symbol objects are subject to garbage collection, but the "namespace" and
> "name" strings that identify them are not. Those strings are "interned" via
> the "intern" method on java.lang.String.

Recent JVMs do collect unused interned strings.
--~--~-~--~~~---~--~~
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: Differences between 'compiled', 'clojure interpreted', 'clojure in a jar in classpath' and 'load'

2009-06-25 Thread Four of Seventeen

On Jun 25, 8:31 am, BerlinBrown  wrote:
> I have a clojure application where each file has its own namespace (ns
> blah)...I generally let the files sit in a classpath directory, so I
> am assuming the clojure code is loaded at startup time.
>
> What are the differences between clojure code which is:
>
> 1. Compiled
> 2. Clojure code that is interpreted (that just sits in the classpath)
> 3. Clojure code that loads from a jar file
> 4. Clojure code that gets load with the 'load' function.
>
> Just from experience, I can't tell any speed differences between any
> of them except for number 4, because I normally don't use the 'load'
> function.
>
> Are there any differences are an approach you recommend.  I was a
> little wary in earlier releases in uses the 'compiled' clojure code, I
> seem to notice more issues with compiled code, but in Clojure 1.0 I
> can't reproduce those errors.

Clojure code is compiled before it is run, always. So there should not
be any difference, except performance (slower to compile on each use
than just once).
--~--~-~--~~~---~--~~
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: Concatenating Regexes?

2009-06-25 Thread Christophe Grand
I was simply proposing a slight modification to Chouser's code:

(defn my-regex [words]
 (re-pattern
   (.replace (str #"(.*?)(\((?:WORDS).*)")
 "WORDS"
 (str-join "|" (map #(Pattern/quote %) words)

It will escape special characters in words.

On Thu, Jun 25, 2009 at 5:41 PM, CuppoJava wrote:

>
> I don't know what you mean by Pattern/quote, can you give me an
> example?
>
> And I really like Chouser's second method. That's very tidy!
>
> Thanks Chouser
>  -Patrick
> >
>


-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (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: [OT] Convincing others about Clojure

2009-06-25 Thread Daniel Lyons

BG,

This kind of thing really burns me up. They trust you to implement the  
thing, but they don't trust you enough to pick the tools to implement  
the thing with. It's like telling your plumber what kind of pipes and  
wrenches to use. You wouldn't dare, unless you were a plumber already.  
The problem with trying to figure out how to convince them is that it  
assumes they're rational, but if they were rational, they would just  
trust you or hire someone else they trust more.

Oftentimes our web clients call us up to complain about the color of  
the website, so we change it. The color is about the only thing about  
their websites that they actually understand, so it's the thing they  
have to gripe about—it gives them the feeling they are really in  
control. I bet that's all these "advisors" want, is to feel like  
they're in control of you. If any of us were particularly good at this  
kind of manipulation game, we would be terrible programmers, wouldn't  
we? Computers are easy to control, you just tell them what to do, but  
with people you have to do all of this irrational stuff. :)

I have two ideas. The first one is to try to change the focus from the  
language to something else about the system which is about as  
important to you as the color. Then give them full control over that  
detail. It'll be annoying and frustrating (they *will* insist on  
changing it randomly during development), but if it works at least  
you'll get to program in Clojure and get it done faster. My second  
idea is to somehow paint selecting Clojure as a form of rebellion,  
that it raises the stakes a little but ultimately the reward will be a  
product which gets to market faster, is easier to change, and requires  
fewer programmers in the first place. In other words, to paint them as  
going off the beaten path, taking a (calculated) risk and that they're  
sexier people if they take it and boring if they don't. After all, if  
everyone went with the flow, there would never be a breakthrough, and  
that's what startups are all about.

There are plenty of excellent technical reasons which others have  
pointed out, but I think it would probably be easier to win them over  
with style or by granting them some other kind of control, or both.

On Jun 24, 2009, at 11:59 PM, Baishampayan Ghose wrote:

> Hello,
>
> So I have been a Common Lisp user for quite sometime and at my earlier
> work we managed to build a state-of-the-art Travel portal in CL with a
> very small team of CL programmers.
>
> This was all fine except one thing. The management never really  
> believed
> in Lisp and they eventually replaced the whole Lisp team with 3x Java
> programmers and are now rewriting the perfectly fine system in Java.
>
> That was my earlier job.
>
> Now I am at the moment doing a startup and I was thinking of using
> Clojure because it has the best of both the worlds. It can use Java
> libs, is a Lisp and is heavily geared towards concurrent programming;
> making it one of the most modern and pragmatic programming languages  
> at
> the moment.
>
> This decision was based purely on the merit of Clojure and not  
> because I
> just wanted to do some Lisp programming. I seriously believe that
> Clojure can really help us in building the kind of concurrent
> application we want to build.
>
> But then, there is another problem. The advisors of the current  
> startup
> (who were techies in their time, but now are highly successful  
> people in
> the Silicon Valley) reacted strongly to the word "Lisp" (it apparently
> brought back old memories of their AI class in college) and are not
> "convinced enough" about Clojure.
>
> I tried explaining that Clojure runs on the JVM and thus won't have  
> any
> problem with libs or integrating with existing Java apps but they are
> not happy.
>
> Their concerns are thus:
>
> 1. How do you get Clojure programmers? Lisp is not for the faint  
> hearted.
>
> 2. What about the performance of Clojure? Is it fast?
>
> 3. People who want to use this are more academically inclined and are
> not practical. This will make the whole project fail.
>
> I need some pointers on this. This is a really crucial thing for me  
> and
> any help will be appreciated.
>
> Regards,
> BG
>
> -- 
> Baishampayan Ghose 
> oCricket.com
>

—
Daniel Lyons


--~--~-~--~~~---~--~~
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: defn memory question

2009-06-25 Thread Stuart Sierra

On Jun 25, 6:25 am, Rich Claxton  wrote:
> Hello I have just started learning Clojure and functional programming,
> quick question, what happens internally when I do a defn, does this
> create the byte code, or a ref to the function which is stored, as it
> does actually create a function object, I was just wondering about
> memory and GC issues.

It gets complicated, because the JVM stores bytecode in a special
memory location that is separate from the heap.  In all but very early
versions of Clojure, however, there's a dynamic classloader so that
defined functions can get garbage collected.

Each (fn ...) or (defn ...) form is a dynamically-created class.  But,
as others have said, there is only one class for each time you *write*
(fn...), not a new class each time you call it.  So if you have one
(fn...) form that gets called a hundred times with different closed-
over values, it's still only going to create one class.

The only time GC of fns might be an issue is if you're constructing
the (fn...) forms in code and eval'ing them.  Even then, adjusting the
JVM memory parameters should be sufficient.

-SS
--~--~-~--~~~---~--~~
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: Differences between 'compiled', 'clojure interpreted', 'clojure in a jar in classpath' and 'load'

2009-06-25 Thread Stuart Sierra

On Jun 25, 8:31 am, BerlinBrown  wrote:
> What are the differences between clojure code which is:
>
> 1. Compiled
> 2. Clojure code that is interpreted (that just sits in the classpath)
> 3. Clojure code that loads from a jar file
> 4. Clojure code that gets load with the 'load' function.

There is no difference at run-time.  Clojure code is always compiled
before it is run.

When people talk about "compiled" Clojure code, they usually mean
ahead-of-time (AOT) compiled.  That just means you run the Clojure
compiler on your .clj source files "ahead-of-time," and save the
resulting .class files.  If you don't AOT-compile your code, it just
gets compiled on-the-fly when you load it.

So AOT-compilation makes the code slightly faster to *load* when your
application starts, because it doesn't have to compile the code on the
fly.  But Clojure compiler is very fast, so the difference is barely
noticeable.

The location the code came from (file, JAR, typed at the REPL) makes
no difference.

-Stuart Sierra
--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread James Reeves

On Jun 25, 4:14 pm, Rich Hickey  wrote:
> (let [x map inc nums)] ...)
>
> Clearly the message: "java.lang.Exception: Missing delimiter: ]" would
> not be helpful here.

But perhaps the message:

  java.lang.Exception: Unmatched delimiter ')', expecting ']'

Would be quite useful? It would tell the user that the unmatched
delimiter was inside the [] block.

Some languages go a step further, and highlight syntax errors directly
with some ASCII art:

  Unmatched delimiter:
(let [x map inc nums)]
^

Though that seems quite tricky to do within the limits of Java's
exception handling. You couldn't really guarentee your output would be
to a terminal with a fixed-width font.

- 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: Roadmap of Clojure 1.1

2009-06-25 Thread Stuart Sierra

On Jun 25, 2:51 am, michael frericks  wrote:
> a) new features planned,
> b) things that break Clojure 1.0
> c) and maybe removed features?

Check out http://clojure.org/todo

-SS
--~--~-~--~~~---~--~~
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: Foreclojure

2009-06-25 Thread Victor Rodriguez

On Thu, Jun 25, 2009 at 3:17 AM, Emeka wrote:
> accounting software in Clojure?
> Which area of accounting will it cover?

Why, forclosures of course!

(Sorry, couldn't resist).

Cheers,

Victor.

> Emeka
>
> On Thu, Jun 25, 2009 at 3:41 AM, fft1976  wrote:
>>
>> I know some of you are searching for names for your projects. I just
>> wanted to say that "Foreclojure" is taken! This will be an open-source
>> (but not GPL) accounting software in Clojure. Stay tuned.
>>
>
>
> >
>

--~--~-~--~~~---~--~~
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: Convincing others about Clojure

2009-06-25 Thread cody



On Jun 25, 8:39 am, Berlin Brown  wrote:
> This is my main point: One thing that Clojure is NOT.  It is not
> limited by the limitations of the Java programming language.
>

It may not be limited by the java _language_, but it is limited by the
java _platform_.

Given the OP's question about academic vs practical: to my mind, a
practical language implies standalone scripts and easy library
management.  Having to launch a JVM + dealing with classpath
nightmares are antithetical to that.  When something as academic as
haskell is more practical on those dimensions than the language you're
considering . . .

--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Ethan Herdrick

I think it's important that Clojure be good at exploring Java
libraries.  Helpful and correct error messages are important for this.
 I often go looking for a function at the REPL, like so:

user=>  substring
java.lang.Exception: Unable to resolve symbol: substring in this
context (NO_SOURCE_FILE:0)
user=> substr
java.lang.Exception: Unable to resolve symbol: substr in this context
(NO_SOURCE_FILE:0)
user=> subs
#

Aha!  It's 'subs'.  This doesn't work with Java methods though.

user=> (.substring (String. "foo"))
java.lang.IllegalArgumentException: No matching field found:
substring for class java.lang.String (NO_SOURCE_FILE:0)

user=> (.substring (String. "foo"))
java.lang.IllegalArgumentException: No matching field found: substring
for class java.lang.String (NO_SOURCE_FILE:0)

You've got to supply the right arguments else you get no hint that you
have found a method:

user=> (.substring (String. "foo") 1)
"oo"


Same thing with static methods:

user=> (String/valueOf)
java.lang.NoSuchFieldException: valueOf (NO_SOURCE_FILE:89)

Not true.  And there's no hint that I'm any closer to a real method
than if I'd tried gibberish:

user=> (String/valueOfXXX)
java.lang.NoSuchFieldException: valueOfXXX (NO_SOURCE_FILE:88)

Here's the correct usage:
user=> (String/valueOf 9)
"9"




On Wed, Jun 24, 2009 at 9:38 PM, Mark Addleman wrote:
>
> Searching through this forum, I found many posts relating to improving
> Clojure's error messages.  I stumbled across one where Rich makes a
> plea for concrete suggestions to specific cases.  I'm very sympathetic
> to that, so I'd like to start a thread of specific coding errors that
> I've run across where I've felt the error messages could be improved.
>
> (*) Improperly specifying a map, e.g. "{:a 1 :b}" yields an array out
> of bounds exception.
>
>
> >
>

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



A website written using Clojure.

2009-06-25 Thread CuppoJava

Hey guys,
I was a little tired of working on what I am supposed to be working
on, and decided to take a break and create a website. I decided to use
Clojure, and to my surprise, it only took a day and less than 3 pages
of code.

members.shaw.ca/patrickli

It only has a single article right now, under Technical, that talks
about how I programmed the website. It's still a rough work (I haven't
written anything substantial for a long time), but it'd be nice to
hear some thoughts.

 -Patrick
--~--~-~--~~~---~--~~
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: Convincing others about Clojure

2009-06-25 Thread Four of Seventeen

On Jun 25, 12:14 pm, cody  wrote:
> On Jun 25, 8:39 am, Berlin Brown  wrote:
>
> > This is my main point: One thing that Clojure is NOT.  It is not
> > limited by the limitations of the Java programming language.
>
> It may not be limited by the java _language_, but it is limited by the
> java _platform_.
>
> Given the OP's question about academic vs practical: to my mind, a
> practical language implies standalone scripts and easy library
> management.  Having to launch a JVM + dealing with classpath
> nightmares are antithetical to that.

So, Java is academic and impractical? Tell that to all the web server
admins deploying it routinely on their servers!
--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Four of Seventeen

On Jun 25, 12:18 pm, James Reeves  wrote:
> Some languages go a step further, and highlight syntax errors directly
> with some ASCII art:
>
>   Unmatched delimiter:
>     (let [x map inc nums)]
>                         ^

The javac compiler, for one.

> Though that seems quite tricky to do within the limits of Java's
> exception handling. You couldn't really guarentee your output would be
> to a terminal with a fixed-width font.

The important case is that it work at the REPL, which does use a fixed-
width font. And I'm pretty sure exception detail messages can contain
newlines.
--~--~-~--~~~---~--~~
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: [OT] Convincing others about Clojure

2009-06-25 Thread Jonah Benton

FWIW, two points- Paul Graham, among others, has talked about issues
like this. See for instance (about Python):

http://www.paulgraham.com/pypar.html

The argument about using new technologies in the startup context is
generally that smarter people want to work with better tools at higher
levels of abstraction. Those people are naturally harder to find, but
a way to attract them is to use tools that can give very skilled
people more leverage.

Relatedly, being concerned about supporting the technology with
commodity skills is something for the future owners of your startup to
care about, not you.

That said, delivery risk with new technologies is *always* a concern.
So the other point is- sometimes you can address concerns about
"risky" choices obliquely by raising *your own* concerns about those
choices, to redirect the conversation to areas that make sense to you.
This indicates that *you're* thinking about what they're thinking
about, and maybe you have a different take on what the risks are- but
that you're thinking about it means you're going to takes steps to
mitigate the risks and keep the channels of communication open.

My main concern about using Clojure wouldn't have to do with people or
performance or academic/business focus, it would just have to do with
maturity, not so much of the language, more at the level of
application patterns. To that end, were I starting a project, I'd look
for skilled Java people with some Lisp, and approach Clojure not as a
Lisp, but as a better Spring, and use the patterns from Spring to
minimize delivery risk. Focus mostly on creating performance sensitive
stateless components + interfaces in Java, using non-bean generic data
structures, and do the configuration wiring/lifecycle/dataflow stuff
in Clojure. More work, but safer ramp-up. Then I'd go deeper into
Lispifying a subsystem.

$0.02.

On Thu, Jun 25, 2009 at 1:59 AM, Baishampayan Ghose wrote:
> Hello,
>
> So I have been a Common Lisp user for quite sometime and at my earlier
> work we managed to build a state-of-the-art Travel portal in CL with a
> very small team of CL programmers.
>
> This was all fine except one thing. The management never really believed
> in Lisp and they eventually replaced the whole Lisp team with 3x Java
> programmers and are now rewriting the perfectly fine system in Java.
>
> That was my earlier job.
>
> Now I am at the moment doing a startup and I was thinking of using
> Clojure because it has the best of both the worlds. It can use Java
> libs, is a Lisp and is heavily geared towards concurrent programming;
> making it one of the most modern and pragmatic programming languages at
> the moment.
>
> This decision was based purely on the merit of Clojure and not because I
> just wanted to do some Lisp programming. I seriously believe that
> Clojure can really help us in building the kind of concurrent
> application we want to build.
>
> But then, there is another problem. The advisors of the current startup
> (who were techies in their time, but now are highly successful people in
> the Silicon Valley) reacted strongly to the word "Lisp" (it apparently
> brought back old memories of their AI class in college) and are not
> "convinced enough" about Clojure.
>
> I tried explaining that Clojure runs on the JVM and thus won't have any
> problem with libs or integrating with existing Java apps but they are
> not happy.
>
> Their concerns are thus:
>
> 1. How do you get Clojure programmers? Lisp is not for the faint hearted.
>
> 2. What about the performance of Clojure? Is it fast?
>
> 3. People who want to use this are more academically inclined and are
> not practical. This will make the whole project fail.
>
> I need some pointers on this. This is a really crucial thing for me and
> any help will be appreciated.
>
> Regards,
> BG
>
> --
> Baishampayan Ghose 
> oCricket.com
>
>

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



Re: A website written using Clojure.

2009-06-25 Thread Emeka
That's cool.

 (doseq [[name tag] [['html "html"]
['head "head"]
['style "style"]
['title "title"]
['body "body"]
['table "table"]
['row "tr"]
['col "td"]
['span "span"]
['h1 "h1"]]]

Why not use map here?

(eval `(defblockfn ~name [block#]
   (html_tag* ~tag nil block#)))
  (eval `(defblockfn ~(symbol (str name "_with")) [attributes# block#]
   (html_tag* ~tag attributes# block#



See if you can simplify the above code.



Regards,
Emeka
On Thu, Jun 25, 2009 at 5:46 PM, CuppoJava wrote:

>
> Hey guys,
> I was a little tired of working on what I am supposed to be working
> on, and decided to take a break and create a website. I decided to use
> Clojure, and to my surprise, it only took a day and less than 3 pages
> of code.
>
> members.shaw.ca/patrickli
>
> It only has a single article right now, under Technical, that talks
> about how I programmed the website. It's still a rough work (I haven't
> written anything substantial for a long time), but it'd be nice to
> hear some thoughts.
>
>  -Patrick
> >
>

--~--~-~--~~~---~--~~
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: Convincing others about Clojure

2009-06-25 Thread CuppoJava

I enjoyed Daniel Lyons post there. I recognize some Ayn Rand ideas
there. Ever read Atlas Shrugged perchance? =)
--~--~-~--~~~---~--~~
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: Differences between 'compiled', 'clojure interpreted', 'clojure in a jar in classpath' and 'load'

2009-06-25 Thread Vagif Verdi

On Jun 25, 8:29 am, Stuart Sierra  wrote:
> So AOT-compilation makes the code slightly faster to *load* when your
> application starts, because it doesn't have to compile the code on the
> fly.  But Clojure compiler is very fast, so the difference is barely
> noticeable.

Actually i tried to load compojure web framework from sources and it
is much slower than from precompiled jar. And compojure is not even
that of a big project.

For web applications maybe it is not a big deal. I mean how many times
a day you start a web application ?
But for big desktop applications i think it is worth to compile at
least for production use.

--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread Daniel Lyons


On Jun 25, 2009, at 11:46 AM, CuppoJava wrote:

>
> Hey guys,
> I was a little tired of working on what I am supposed to be working
> on, and decided to take a break and create a website. I decided to use
> Clojure, and to my surprise, it only took a day and less than 3 pages
> of code.
>
> members.shaw.ca/patrickli
>
> It only has a single article right now, under Technical, that talks
> about how I programmed the website. It's still a rough work (I haven't
> written anything substantial for a long time), but it'd be nice to
> hear some thoughts.


Very impressive and cool! And fast too!

My comments are really things you've already heard on the list. You  
should use -'s instead of _'s, for consistency if not for readability,  
and I'm still leery of defblockfn. But part of the joy of Lisp is  
constructing an environment of your liking and taking flight.

—
Daniel Lyons


--~--~-~--~~~---~--~~
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: Convincing others about Clojure

2009-06-25 Thread Daniel Lyons


On Jun 25, 2009, at 12:39 PM, CuppoJava wrote:

>
> I enjoyed Daniel Lyons post there. I recognize some Ayn Rand ideas
> there. Ever read Atlas Shrugged perchance? =)

Thanks! Fountainhead yes, Atlas Shrugged no, actually. :) But my  
suggestions there come from my (limited) experience. She's a fun  
writer, but I'm no Randroid. I've never tried to get VC.

—
Daniel Lyons


--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread CuppoJava

Thanks for the reply.

I use doseq instead of map because I need it to run immediately, and
I'm not interested in the return values of the functions.

I also would love to be able to simply the (eval ...) part, but I
don't know of any other way to dynamically define a function in
Clojure. If you know of a way it'd help me out a lot.
  -Patrick
--~--~-~--~~~---~--~~
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: Convincing others about Clojure

2009-06-25 Thread cody



On Jun 25, 12:58 pm, Four of Seventeen  wrote:
> So, Java is academic and impractical? Tell that to all the web server
> admins deploying it routinely on their servers!

 The fact that Sun has managed to convince a lot of people that gobs
of xml and multiple competing build systems are a good idea isn't
necessarily relevant to how practical (or perhaps pragmatic is a
better word) the java platform is.

If I went to our CTO and told him that the group I manage was going to
start using Java for our day-to-day practical work, I'd get laughed
out of the room just as surely as I would for suggesting Clojure.

Being able to do the equivalent of

clojure install some.useful.library
clojure -e '(use some.useful.library)(some.useful.library/foo "hello
foo")'

along with a consistent shebang convention would go a long way towards
alleviating pragmatic issues.  Groovy seems to be somewhat better in
that regard for a jvm language (steal whatever they're doing, quick),
but still has classpath hacks like ~/.groovy/lib
--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread Vagif Verdi

What server are you running it on ? Tomcat ?

There's a compojure web framework that already has html combinator
library.
Check it out here: http://preview.compojure.org/docs

--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread CuppoJava

Thanks for your opinions Daniel.
Yes I really need to adapt to using hyphens instead of underscores.
I've irked more than a few people already.

So far, defblockfn is serving me well, but it has bitten me a few
times now. If I come up with another alternative I will switch over.

-Patrick
--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread CuppoJava

I'm not running off any server. All the pages are static html, which
are generated by a Clojure script.

I looked at Compojure, and it seems very promising, but I decided it
was overkill for my website.
  -Patrick
--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread Daniel Lyons


On Jun 25, 2009, at 12:57 PM, CuppoJava wrote:

>
> I'm not running off any server. All the pages are static html, which
> are generated by a Clojure script.

Haha, that explains the speed. :) *slaps forehead*

—
Daniel Lyons


--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread CuppoJava

Yeah. Speed and simplicity were my main reasons to use static HTML
instead of running off a server.
--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread Emeka
CuppoJava,

Did you try prxml? May be it can be of help.

Regards,
Emeka

--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread Emeka
CuppoJava,

I was referring to the map data structure {'html "html"..} and not the
other map.

Regards,
Emeka

--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread Mike Hinchey
Instead of eval in the doseq, you could use a macro with a do block,
something like:
user> (defmacro deftags [tags]
`(do ~@(map (fn [tag]
  `(defn ~(symbol (str tag "-with"))
 [block#] (str ~tag block#)))
tags)))
#'user/deftags

user> (deftags ["html"])
#'user/html-with

user> (html-with [1])
"html[1]"

-Mike

On Thu, Jun 25, 2009 at 11:51 AM, CuppoJava wrote:

>
> Thanks for the reply.
>
> I use doseq instead of map because I need it to run immediately, and
> I'm not interested in the return values of the functions.
>
> I also would love to be able to simply the (eval ...) part, but I
> don't know of any other way to dynamically define a function in
> Clojure. If you know of a way it'd help me out a lot.
>   -Patrick
> >
>

--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread Berlin Brown



On Jun 25, 3:52 pm, Mike Hinchey  wrote:
> Instead of eval in the doseq, you could use a macro with a do block,
> something like:
> user> (defmacro deftags [tags]
>         `(do ~@(map (fn [tag]
>                       `(defn ~(symbol (str tag "-with"))
>                          [block#] (str ~tag block#)))
>                     tags)))
> #'user/deftags
>
> user> (deftags ["html"])
> #'user/html-with
>
> user> (html-with [1])
> "html[1]"
>
> -Mike
>
> On Thu, Jun 25, 2009 at 11:51 AM, CuppoJava wrote:
>
>
>
> > Thanks for the reply.
>
> > I use doseq instead of map because I need it to run immediately, and
> > I'm not interested in the return values of the functions.
>
> > I also would love to be able to simply the (eval ...) part, but I
> > don't know of any other way to dynamically define a function in
> > Clojure. If you know of a way it'd help me out a lot.
> >   -Patrick

I am not looking at the code, I hate when people nitpick every snippet
they see.  I don't think that gets anyone anywhere.

But does anyone have a problem with Lisp/S-Expressions to HTML/XHtml,
especially for the entire document.  What is wrong with using some
form of templating system.  I think that is what Lisp has (see Lisp's
Html-template).

I am not talking about this particular application, but just in
general.  I love the ability to take sections of HTML or snippets of
HTML and use that as the View and then break that off from the
application code.

But that is just me.
--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread CuppoJava

Thanks Mike for that tip.
That seems a bit better, but then I have a left-over macro that I have
no use for.

As to why I didn't use a map. I needed destructuring so Clojure would
have internally turned the map into a seq anyway. Though a map would
save me from a layer of parenthesis. I'll keep that in mind for next
time.

This is the first time I used a s-expression to html approach. Before
this, I used templating engines in PHP and Ruby. Ultimately, they
turned out to be more hassle than they were worth to me. Or maybe I'm
just not very good with them.
--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread Daniel Lyons


On Jun 25, 2009, at 1:59 PM, Berlin Brown wrote:
> But does anyone have a problem with Lisp/S-Expressions to HTML/XHtml,
> especially for the entire document.  What is wrong with using some
> form of templating system.  I think that is what Lisp has (see Lisp's
> Html-template).

http://weitz.de/html-template/

Of course, it's made by the same guy as CL-WHO, which uses the s-expr  
system instead:

http://weitz.de/cl-who/

> I am not talking about this particular application, but just in
> general.  I love the ability to take sections of HTML or snippets of
> HTML and use that as the View and then break that off from the
> application code.
>
> But that is just me.

Mixed bag for me, though I pretty much agree. On the one hand, I  
prefer the terseness of s-exp templating, and that you can't forget to  
close a tag. On the other hand, my business partner isn't going to  
learn Lisp anytime soon and needs to be able to modify the HTML that  
gets output. I know technically Lisp is simpler than XML, but it's  
still intimidating to the muggles. :)

The strength of something like PHP or embedded Ruby is that the text  
editors support it and you get the full power of the language inside  
the template. HTML-Template doesn't give you the full power of Lisp  
inside the template, but the advantage is that templates get compiled  
into something that executes really fast and it's easy enough that  
designers can probably handle it.

I kind of hate seeing HTML being manually printed out deep inside the  
code. I'd rather pass s-exps out, or something. Better not to do any  
formatting deep in the code and have a real separation of concerns.  
It's also nice if you can change the way it renders without  
recompiling. HTML-Template, when you load a file, it keeps track of  
that file and if it changes out from underneath it, it notices and  
recompiles the template (rather like JSP, I guess). CL-WHO, you'd have  
to recompile the function somehow, which means you need to have a REPL  
open somewhere you can get to. Which probably isn't impossible but  
seems to be a little more involved with Clojure than it is with Lisp.  
Another point for external HTML-style templates.

I've seen a couple templating systems (notably ZPT/TAL and Kid) that  
work by putting some XML from a different namespace into your  
document. Pro, your XML is always valid; con, it's a pain to work with  
and sometimes you just want to dump out some crap and don't really  
care if it's valid. Convenience versus correctness. I tend to side  
with convenience on templating.

I dunno. This problem has a lot of solutions and all of them seem to  
involve compromises.

—
Daniel Lyons


--~--~-~--~~~---~--~~
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: [OT] Convincing others about Clojure

2009-06-25 Thread Raoul Duke

> I need some pointers on this. This is a really crucial thing for me and
> any help will be appreciated.

http://weblog.raganwald.com/2007/01/what-ive-learned-from-sales-part-i.html

sincerely.

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



Problem error message

2009-06-25 Thread Four of Seventeen

Got this doing a load-file:

#

Full stack trace:

java.lang.ClassFormatError: Unknown constant tag 116 in class file com/
foo/bar$eval__10559 (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:4543)
at clojure.core$eval__3990.invoke(core.clj:1728)
at clojure.main$repl__5813$read_eval_print__5825.invoke(main.clj:176)
at clojure.main$repl__5813.doInvoke(main.clj:193)
at clojure.lang.RestFn.invoke(RestFn.java:548)
at org.enclojure.repl.main
$create_clojure_repl__53$repl_thread_fn__55.invoke(main.clj:96)
at clojure.lang.AFn.run(AFn.java:37)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassFormatError: Unknown constant tag 116 in
class file com/foo/bar$eval__10559
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
at clojure.lang.DynamicClassLoader.defineClass
(DynamicClassLoader.java:42)
at clojure.lang.Compiler$FnExpr.getCompiledClass(Compiler.java:3417)
at clojure.lang.Compiler$FnExpr.eval(Compiler.java:3428)
at clojure.lang.Compiler.eval(Compiler.java:4531)
... 7 more

None of this points to a specific line in my code, and I'm fairly sure
it's syntactically valid. All I've done is to add a couple of function
and macro definitions since it was working last.

This is an excellent example of an unhelpful compile error -- I have
no frigging clue whatsoever where in a 2000-line source file the error
is, other than that it is presumably in a part I've changed recently.

Besides fixing this one to point to an actual line in the source file,
the message could use changing. "Unknown constant tag 116" is not
meaningful to the average Clojure coder. It does suggest maybe the
problem is with a constant, but the only two new constant definitions
are:

(def *work-queues* (atom {}))
(def *shuffled-workqueue-min* 100)

I don't see any obvious problems with either definition.

(The actual namespace is not com/foo/bar, of course. I don't think the
exact namespace name is relevant and it may subtly leak confidential
information so I took the liberty of changing 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: "print" without separating spaces?

2009-06-25 Thread Stephen C. Gilardi


On Jun 25, 2009, at 11:43 AM, CuppoJava wrote:


Is there a "print" command that doesn't separate it's arguments using
spaces? I wrote my own function to work-around this but hopefully it's
already been done for me.

(defn write [& strings]
 (print (apply str strings)))


Hi Patrick,

Clojure also has a printf wrapper for Java's printf (and format if you  
want the result as a string rather than as a side effect):


  user=> (printf "Tightly%sPacked%dStrings%.4fCan%sBe%sFun\n"
 "one" 2 3.0 'four :five)
  TightlyonePacked2Strings3.CanfourBe:fiveFun
  nil
  user=>

clojure.contrib.pprint provides cl-format (which can do either):

  user=> (cl-format true "There~ayou go!~&" :angels)
  There:angelsyou go!
  nil
  user=>

--Steve



smime.p7s
Description: S/MIME cryptographic signature


Re: Problem error message

2009-06-25 Thread Stephen C. Gilardi


On Jun 25, 2009, at 5:00 PM, Four of Seventeen wrote:


Got this doing a load-file:

#


That error appears to be coming from a Java-level class loader (see  
the ultimate "caused by" in the stack trace). If you search for it  
using Google, you'll see it's appeared in contexts other than Clojure.  
I read it as "I can't completely understand this .class file, failing,  
here's a message an error code about why".


I don't know in detail what the error means, but if I got it I would  
try this: delete any class files and/or jar files I compiled  
previously for this project and see if the problem happens when I'm  
sure I'm loading a clojure source file. Then try compiling again to  
check if the problem is reproducible.


--Steve



smime.p7s
Description: S/MIME cryptographic signature


Re: A website written using Clojure.

2009-06-25 Thread Stuart Sierra

On Jun 25, 3:59 pm, Berlin Brown  wrote:
> But does anyone have a problem with Lisp/S-Expressions to HTML/XHtml,
> especially for the entire document.  What is wrong with using some
> form of templating system.

Yes, I'm partial to StringTemplate, a Java template framework.  Very
simple, like a functional language itself.
http://www.stringtemplate.org/

-SS
--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread James Reeves

On Jun 25, 7:01 pm, Four of Seventeen  wrote:
> On Jun 25, 12:18 pm, James Reeves  wrote:
>
> > Some languages go a step further, and highlight syntax errors directly
> > with some ASCII art:
>
> >   Unmatched delimiter:
> >     (let [x map inc nums)]
> >                         ^
>
> The javac compiler, for one.

Huh. So it does. Okay, maybe it's not an impractical idea after all :)

- 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: HOWTO: Update the docs on clojure.org?

2009-06-25 Thread Mike Hinchey
I don't know about wikispaces, but this is linked from clojure.org:
http://en.wikibooks.org/wiki/Clojure_Programming
-Mike

--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread Nicolas Buduroi

> I'm not running off any server. All the pages are static html, which
> are generated by a Clojure script.

No kidding! I've done the exact same thing for my first website. It
was using Scheme though and leveraged Oleg's SXML library, it bring me
back fond memories. I'm looking at that old code right now and it was
kind of crazy, just using R5RS with srfi 1 and 19, Clojure is so much
better than this.

Your website looks good by the way. One thing is if you could dim the
background lines a little bit, it would make the text more readable,
some line look strikethrough.

> I looked at Compojure, and it seems very promising, but I decided it
> was overkill for my website.

Compojure is really great! ;-)

- budu
--~--~-~--~~~---~--~~
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: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-25 Thread Alex Combas
How about the name: jecl

"jecl" breaks down:

(j)ecl = (j)ava
j(ec)l = (ec)lipse
je(cl) = (cl)ojure

jecl.net is not registered (yet)

"develop clojure on eclipse with jecl" has a ring to it, I think

..and of course there is the story of Jekyll(clojure) and Hyde(java) where
Jekyll is a good doctor and
Hyde is the terrible monster that he turns into when he doesn't take his
medicine. ;)

But just an idea anyway :)

--~--~-~--~~~---~--~~
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: [OT] Convincing others about Clojure

2009-06-25 Thread Alex Combas
I'm no expert but I love to argue, so this is what I would say:

On Wed, Jun 24, 2009 at 10:59 PM, Baishampayan Ghose
wrote:
>
>
> Their concerns are thus:
>
> 1. How do you get Clojure programmers? Lisp is not for the faint hearted.


There has been a lot of re-newed interest in lisp over the past couple
years.


>
>
> 2. What about the performance of Clojure? Is it fast?


>From what I've heard and seen it is as fast as java itself in some cases
because it sits natively on-top of the jvm

3. People who want to use this are more academically inclined and are
> not practical. This will make the whole project fail.


Rich Hicky, is a self described "practitioner" not an academic, and I think
it is because of this
that clojure is at its heart a very pragmatic language (for example: clojure
is functional but doesn't enforce strict purity) and not
just another intelectual exercise.

I'm not trying to knock Simon Peyton Jones (the academic behind Haskel, the
man is undoubtedly a genious), I'm simply saying
clojure comes from a different angle.

The reasons to chose clojure:
1. functional languages are the future, in a few years absolutely everything
(even cellphones) will be multicore
2. sits on the jvm, a robust and open platform with access to thousands of
librarys
3. a lisp

--~--~-~--~~~---~--~~
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: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-25 Thread Antonio Parcero

What about "sequoya"? defined as:

"Cherokee who created a notation for writing the Cherokee language (1770-1843)"

Maybe spelling it as "sequoja" or as the name of the tree, "sequoia"

Also, I think "conjuror" would have been a great name. It reminds me
of the cover of SICP. Too bad there's already a "conjure" which is too
close.

--~--~-~--~~~---~--~~
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: A website written using Clojure.

2009-06-25 Thread CuppoJava

That's a good point. Dimming the lines would be a good idea. I
originally tried to make the text actually line up with the lines, but
that was a nightmare, and it didn't contribute much to the final
effect.

Scheme is a great language. If I needed to work on a project that runs
natively (ie. not on a VM) scheme would be my first choice. I still
envy Scheme's first-class continuations, and wish Clojure had them.

 -Patrick
--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Glen Stampoultzis
2009/6/26 James Reeves 

>
> On Jun 25, 7:01 pm, Four of Seventeen  wrote:
> > On Jun 25, 12:18 pm, James Reeves  wrote:
> >
> > > Some languages go a step further, and highlight syntax errors directly
> > > with some ASCII art:
> >
> > >   Unmatched delimiter:
> > > (let [x map inc nums)]
> > > ^
> >
> > The javac compiler, for one.
>
> Huh. So it does. Okay, maybe it's not an impractical idea after all :)
>
>
I think it is worth looking at what JRuby does when it spits out an error.
They don't show a Java stacktrace at all but rather one that looks a lot
closer to what native Ruby shows.  I'd suggest Java stack traces are a poor
fit for reporting clojure errors since they don't match that closely to the
underlying language structure.

--~--~-~--~~~---~--~~
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: Problem error message

2009-06-25 Thread Four of Seventeen

On Jun 25, 5:23 pm, "Stephen C. Gilardi"  wrote:
> That error appears to be coming from a Java-level class loader (see  
> the ultimate "caused by" in the stack trace). If you search for it  
> using Google, you'll see it's appeared in contexts other than Clojure.  
> I read it as "I can't completely understand this .class file, failing,  
> here's a message an error code about why".
>
> I don't know in detail what the error means, but if I got it I would  
> try this: delete any class files and/or jar files I compiled  
> previously for this project and see if the problem happens when I'm  
> sure I'm loading a clojure source file. Then try compiling again to  
> check if the problem is reproducible.

Didn't work. Thinking it might be environment specific, and using
netbeans, so I'm posting it in the enclojure group too.

Meanwhile I guess I'll fall back on the old, tedious debugging method
for cases like this: break everything up into separate modules and try
to compile each one until I find the one with the error, and then
whittle that one down until I've isolated the particular bit of code
Clojure doesn't like, then try to figure out what, if anything, is
wrong with it and tweak it until it works.
--~--~-~--~~~---~--~~
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: libraries promoted from contrib to clojure

2009-06-25 Thread Stuart Halloway

If you are following the github head of the Clojure and contrib  
projects, you will see that several libraries have moved from contrib  
into Clojure:

* clojure.contrib.test-is becomes clojure.test
* clojure.contrib.stacktrace becomes clojure.stacktrace
* clojure.contrib.template becomes clojure.template
* clojure.contrib.walk becomes clojure.walk

Thanks to Stuart Sierra for writing all these libraries. If you are  
using one of them (and working with head), you will need to rename it  
in your use/require/ns forms. Also, the signature and implementation  
of test/are has changed, and is now more idiomatic. For example:

(deftest test-count
   (are [x y] (= x y)   ; instead of (are (= _1 _2))
   (count nil) 0
   (count ()) 0
   (count '(1)) 1
   (count '(1 2 3)) 3
; etc.

The purpose of this change (other than the general usefulness of the  
libraries!) is to let Clojure host its own test suite. You can now run  
Clojure's tests with "ant test".

Go ye now, sign the CA, and write some great tests for Clojure. You  
know you want to.

Stu

--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Timothy Pratley

Thanks for considering those Chouser,

> It might be nice to get a "useless bare symbol" warning in
> cases like this.

That sounds useful to me!

Another special case similar to 'bare symbol' which would be nice to
have reported is when a lazy sequence is created and thrown away.
Usually this means it was intended for side-effects which will never
occur. Unfortunately I have no idea how to detect such a thing seeing
it would look like a list. I suppose an explicit check could be made
for map which is the common one.
(map println [1 2 3 4])
is usually an error. The tricky thing is that from the REPL its not
such an error in that it gets forced, so might need to be treated
differently (I'd argue even then it should be an error - but don't
have much to base that on).


> Would you recommend a more general and therefore more
> accurate message?  Something like "your if-let syntax is
> incorrect"?

My expectation was that (if-let binding a b c) would complain about
the extraneous c specifically, and only about the binding if it was
not a vector. But I see now as you described there is an & oldform to
catch the old style. For this kind of situation the signature can
greatly clarify:
"Too many args passed to if-let:  (if-let ([bindings then] [bindings
then else]))"
;; assuming & oldform gets fully deprecated at some point
Leaving aside if-let with its oldform perhaps this would be useful in
other scenarios:
user=> (mod 1 2 3)
java.lang.IllegalArgumentException: Wrong number of args passed to:
core$mod (NO_SOURCE_FILE:0)
"Too many args passed to mod: (mod ([num div]))"


> I suppose the compiler
> could look for a no-arg method by that name and suggest that
> specific cause in the message.

This is a special case where the compiler could hint to me, "oh that's
a method call, not a field". The symbol is resolvable and has a
meaning, the fact that it is a method and can't be passed like so is
the real problem from my (stupid user) perspective. From the compiler
perspective not found makes perfect sense because it is specifically
looking for a field. If I see "that's a method not a field", or "can't
pass method" I will realise, oh I forgot to call it! But when I see
"not found" I start looking in all the wrong places.


> I agree that it'd be helpful to list the arg types passed in:
> "No 'abs' method found for [clojure.lang.Ratio]"

Yes, that would make it nice and obvious.
Candidate method hints would also be nice (again, showing the
signatures but this time java signatures which involve types). Ethan
Herdrick gave some good examples where showing candidate signatures
really helps. In this case there are:
static double   abs(double a)
static floatabs(float a)
static int  abs(int a)
static long abs(long a)

Just another one that can be a bit hard to decipher:
user=> (1 2 3)
java.lang.ClassCastException: java.lang.Integer cannot be cast to
clojure.lang.IFn (NO_SOURCE_FILE:0)
;; obviously very correct, but might be easier to understand as
"(1 2 3) is a function call, but 1 is not a function"
However (1 2 3) might be a really long string so this might not be
practical.
Maybe " is not a function." and optionally suggest "Perhaps
you meant to specify a list? '()"
This does seem to turn up a bit hence I think it warrants special
handling.



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



Printing and reading a function

2009-06-25 Thread Jurjen

I've been trying to do some generic work on serializing clojure
objects, and am much impressed with how easy and functional it is, as
well as how easy it is to extend this to other objects (eg Java
classes).

However, I seem to come a little unstuck when it comes to functions /
closures. I realise capturing the state of the environment is going to
be tricky at best, but at the moment I'm trying to extend the basic
defn macro to capture the code used to define the function.
I then tried using print-dup to print the source string from the meta
data, but this is where things stop working.

As far as I can see from the clojure/core-print.clj file, doing a
(binding [*print-dup* true] (pr-str function)) should print out the
meta-data of the function as well, but this does not seem to be
happening. I want this to happen, as I need access to the metadata to
dump the code used instead of the default #=(user
$eval__17$function__19. ) string.

Essentially my new version of defn is a basic wrapper around defn:
(defmacro mkfn [nm args func]
  (list 'defn nm {:source (str "(mkfn " nm " " args " " func ")")}
args func))

so when you do (mkfn test1 [a b] (+ a b)) you get out a function test1
with a metadata :source tag (meta (var test1))
{:ns #, :name test1, :file "NO_SOURCE_PATH", :line
439, :arglists ([a b]), :tag "sometag", :source "(mkfn test1 [a b] (+
a b))"}

I tried to override the print-dup for clojure.lang.Fn to check for
the :source meta-data tag, but I keep getting NullPointerExceptions.
Anyone got any ideas? Am I missing something obvious?

(defmethod print-dup clojure.lang.Fn [o w]
  (if (meta o) (.write w (:source (meta o)))
(print-ctor o (fn [o w]) w)))


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



quick question about "ANN:"

2009-06-25 Thread kkw

Hi folks,

Occasionally, I see "ANN:" in subject headers to posts here. I've
tried to figure out what it means, but have failed. Searches on google
haven't been too good either. What does "ANN:" mean?

Kev
--~--~-~--~~~---~--~~
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: quick question about "ANN:"

2009-06-25 Thread Richard Newman

> What does "ANN:" mean?

"Announcement", I believe.


--~--~-~--~~~---~--~~
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: Problem error message

2009-06-25 Thread Four of Seventeen

On Jun 25, 10:09 pm, Four of Seventeen  wrote:
> Meanwhile I guess I'll fall back on the old, tedious debugging method
> for cases like this: break everything up into separate modules and try
> to compile each one until I find the one with the error, and then
> whittle that one down until I've isolated the particular bit of code
> Clojure doesn't like, then try to figure out what, if anything, is
> wrong with it and tweak it until it works.

OK, now it's hair-pulling-out time.

I started by moving a large number of general-purpose utility
functions and macros to a separate file, namespace, and NetBeans
project and adding it as a library to my original one, upon deciding
that a lot of this stuff is really not application-specific and will
be reusable outside of the one project. I also documented some
functions, made others private, and tweaked a few things, as well as
sorting out the imports in both projects.

The utility project built without a hitch, so I figured the error
hadn't been in that code. (Very little of it was new, so, not
surprising.)

Then I tried to build the main project. I ran into some ordinary
errors (missing imports, classpath fiddliness, and so forth, plus a
handful of compile errors in the new code I'd added since the last
successful load-file of that project's one source file) and fixed
these one by one, expecting to get the "Unknown constant tag 116"
error after a while, whereupon I was going to call it a night, and
tomorrow continue to break up the project into additional separate
source files by function (DAL code here, GUI code there, &c.) but ...

It didn't happen.

I didn't change anything in the main project except to remove
functions and macros moved to the util project, remove some imports,
add a library (the util project), and add a :use of that library. So
the error must have been in code that I removed, most likely, code I
moved to the utility library.

The error must have been in one of the functions I refactored during
the move. I made some tweaks, most notably I caught and fixed a bug in
the floor function (it was giving floor for floats and positive
ratios, but ceil for negative ratios) and changed some macros to use a
more idiomatic [[binds] & body] argument syntax instead of just [binds
& body] now that they were part of a more public, more reuse-oriented
API. I can't recall what else I changed, other than that it wasn't
much.

More and more, I begin to suspect either a bug in clojure or a bug in
enclojure. Rearranging code without changing it much shouldn't
ordinarily have such an effect. Particularly, none of the stuff I both
moved and changed had been new since the last successful load-file of
the original single source file, none of the stuff I moved without
changing triggered the error, none of the stuff I neither moved nor
changed triggered the error, and I didn't change anything I didn't
move except the initial ns block, until I started getting fixable
errors from the new code that had formerly apparently caused only the
"Unknown constant tag 116" error.

In other words, what I've already done seems to mean that that error
existed in no individual piece of my code. It didn't exist in the code
I didn't move, because it stopped occurring before I changed any of
that code; it didn't exist in the code I moved and didn't change,
because it stopped occurring without my changing that code; and it
didn't exist in the code I moved and did change, because all of that
code had been present prior to the changes that caused the "Unknown
constant tag 116" to start occurring, and had NOT changed as part of
the changes that caused the "Unknown constant tag 116" to start
occurring.

If the "Unknown constant tag 116" error was not in a specific piece of
my code, however, whose semantics are unchanged (except for fixing
bugs in the new code and in floor), then it must have been a bug in
clojure and/or enclojure, or else somehow a bug in the arrangement of
my code. The latter would mean something like a missing import or
suchlike, though, and since it had been one monolithic source
file ...

At this point, I'm chalking it up to a bug in the development tools
I'm using, or the language implementation itself. Which is bad. If it
happens again, I have no idea how to fix it other than to randomly
move stuff around and hope it goes away, knowing that that already
worked once by happenstance. And if it stubbornly persists, I'll have
to throw my hands up and stop work until a bug-fix is released. I
dread the possibility of that occurring.

So should you. The mere fact that a developer is now worrying about
such a work stoppage is a sign that clojure is not quite ready for
prime time after all. We should be able to have confidence that if we
write non-buggy code, it will compile and run, without the need for
magic rearranging of code to avoid provoking a showstopping
implementaton bug.

A few recent threads are about evangelizing clojure, getting it
accepted as a development language b

Re: quick question about "ANN:"

2009-06-25 Thread kkw

Great - thankyou!

On Jun 26, 1:59 pm, Richard Newman  wrote:
> > What does "ANN:" mean?
>
> "Announcement", I believe.
--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Four of Seventeen

Got another one.

(if-not (zero? diskqueue-count (if value
 (trait-dir trait)
 (trait-undecided-dir trait)))

#

This should be saying wrong number of args passed to core$zero? rather
than core$fn. I don't know why it isn't.

(For those who missed it, the error is a missing pair of parentheses:

(if-not (zero? (diskqueue-count (if value
  (trait-dir trait)
  (trait-undecided-dir trait

).

--~--~-~--~~~---~--~~
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: HOWTO: Update the docs on clojure.org?

2009-06-25 Thread Chouser

On Wed, Jun 24, 2009 at 9:58 PM, Seth wrote:
>
> Tonight I got worked up enough to gripe to the good folks in IRC about
> the docs on clojure.org. For the most part they are solid, but more
> often than I'd like a link into the api page has a bad anchor.
> (nthrest) became (nthnext) in early Feb 2009.

Fixed, thanks.

--Chouser

--~--~-~--~~~---~--~~
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: Printing and reading a function

2009-06-25 Thread Chouser

On Thu, Jun 25, 2009 at 10:54 PM, Jurjen wrote:
>
> Essentially my new version of defn is a basic wrapper around defn:
> (defmacro mkfn [nm args func]
>  (list 'defn nm {:source (str "(mkfn " nm " " args " " func ")")}
> args func))
>
> so when you do (mkfn test1 [a b] (+ a b)) you get out a function test1
> with a metadata :source tag (meta (var test1))
> {:ns #, :name test1, :file "NO_SOURCE_PATH", :line
> 439, :arglists ([a b]), :tag "sometag", :source "(mkfn test1 [a b] (+
> a b))"}
>
> I tried to override the print-dup for clojure.lang.Fn to check for
> the :source meta-data tag, but I keep getting NullPointerExceptions.
> Anyone got any ideas? Am I missing something obvious?

It may not be obvious, but your mkfn macro is setting the
metadata of the Var that contains the fn, not the fn itself.
This is why to see the meta you had to say
(meta (var test1)) intead of just (meta test1).

This also means that if you do (pr-str test1), pr-str has no
way to get to the metadata.  When this expression is
evaluated, the symbol 'test1' is resolved to the Var, then
the Var is deref'ed to the fn, and finally that fn is passed
to pr-str.  There's no pointer from the fn back to the Var,
which makes sense if you think about anonymous fns, multiple
Vars pointing to the same fn, multiple threads having
different fns for the same Var, etc.

I can only think of two options for you.  By far the easiest
would be to print the Var rather than the fn:

(binding [*print-meta* true] (pr-str (var map)))
or
(binding [*print-meta* true] (pr-str #'map))

The other option would be to attach your metadata to the fn
itself.  This is a bit tricky because fns cannot be
duplicated in the way that would be necessary to immutably
"change" their metadata.  And although you can attach
metadata to a fn instance (a.k.a. closure) when it is
created, there's no syntax for this.  However, it is
possible to do with careful use of 'proxy'.

...but even once you've captured the code used to define
a fn, I'm not sure how much good it's going to do you.  That
metadata won't include anything about the lexical
environment in which the fn was defined, the values of any
closed-over locals, etc.

--Chouser

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