Re: Stepping, debugging in REPL

2010-07-14 Thread Meikel Brandmeyer
Hi,

On Jul 13, 10:24 am, Adam Schmideg  wrote:
> I just made this debugger.  It works but is still a bit rough around
> the edges.  I'd be happy to hear your 
> feedback.http://code.google.com/p/taskberry/wiki/Stepl

While the whole idea sounds nice, I have trouble getting it to work.
It seems it can only "debug" correct code. Code throwing an exception
is not handled.

When getting in the debug prompt, I can't do nothing but printing the
usage message. Choosing eg. back or in as commands throws a NPE.

Sincerely
Meikel

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


Evaluated or not -- unquote in syntax-quote/backquote

2010-07-14 Thread Yang Dong
Hi, all

It seems Lisp macro expander will not evalute the argument prefixed by
unquote. The following code, written in Common Lisp, is an excerpt
from `On Lisp'. This macro implemented `let'.

1. (defmacro our-let (binds &body body)
2.   ‘((lambda ,(mapcar #’(lambda (x)
3.  (if (consp x) (car x) x))
4.  binds)
5. ,@body)
6. ,@(mapcar #’(lambda (x)
7.   (if (consp x) (cadr x) nil))
8.   binds)))

`body' on the 5th line is not evaluted when the macro got expanded,
but the `mapcar' on the 2nd line is evaluated.

I think the problem/characteristic would be the same no matter which
Lisp dialect you use. I've tried to debug into the Clojure Compiler,
but the key code was generated on the fly. So I failed to figure it
out how Clojure did it. And I'm not a Common Lisp geek either, can't
go deep into the interrepter. So, would someone please tell me if the
arguments are really treated specially?

Or, am I just wrong at all these?

Helps will be appreciated.

-- 
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: Evaluated or not -- unquote in syntax-quote/backquote

2010-07-14 Thread Meikel Brandmeyer
Hi,

On Jul 14, 4:30 am, Yang Dong  wrote:

> `body' on the 5th line is not evaluted when the macro got expanded,
> but the `mapcar' on the 2nd line is evaluated.

No. Both are evaluated when the macro is expanded. body evaluates to
whatever is bound to the argument.

(our-let [...] (this) (is the) (body))

In this case body evaluates to "((this) (is the) (body))" which is
inserted into the macro expansion. (Note: since we use unquote-splice
aka. ~@ instead of plain unquote aka. ~ the outer list is spliced away
in the expansion)

Hope this helps.

Sincerely
Meikel

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


Building mixed clojure and java code

2010-07-14 Thread Martin DeMello
What are people using to build mixed clojure/java code? Currently just
using lein {uber,}jar to build and distribute.

martin

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


Re: ANN: Deview - Better test results

2010-07-14 Thread Paul Stadig
On Wed, Jul 14, 2010 at 2:11 AM, Heinz N. Gies  wrote:

>
> On Jul 14, 2010, at 6:40 , Phil Hagelberg wrote:
>
> > This is really cool!
> >
> > Unfortunately since I spend all my time in the terminal, (for remote
> > pairing) I can't really use a web-based interface like this for normal
> > work. Do you have any plans to create a command-line client? How hard
> > would it be?
> >
> > Alternatively, do you know how much work it would be to wire difform
> > directly into clojure.test so you'd get readable results from a
> > standard "lein test" run?
> >
> Hi Phil,
> you could use SSH port forwarding, it works like a charm on both *nix and
> windows (with putty) so you can access a remote http server that runs 'in
> private'
>
> regards,
> Heinz
>

Port forwarding would still require switiching back and forth between a
terminal to a browser, no? It would be cool to have difform used in
clojure.test, so that test runs in a terminal could be grasped more
immediately.


Paul

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

Re: Building mixed clojure and java code

2010-07-14 Thread Martin DeMello
On Wed, Jul 14, 2010 at 6:45 PM, Martin DeMello  wrote:
> What are people using to build mixed clojure/java code? Currently just
> using lein {uber,}jar to build and distribute.

Hit send too soon - I meant to say, currently my project is just
clojure, and lein works very nicely to package it. If I wanted to
include some java sources, what would the easiest way to build the
combined project be?

martin

-- 
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: Building mixed clojure and java code

2010-07-14 Thread Moritz Ulrich
There is lein-javac which integrates javac into the leiningen
build-flow: http://github.com/antoniogarrote/lein-javac

On Wed, Jul 14, 2010 at 3:16 PM, Martin DeMello  wrote:
> On Wed, Jul 14, 2010 at 6:45 PM, Martin DeMello  
> wrote:
>> What are people using to build mixed clojure/java code? Currently just
>> using lein {uber,}jar to build and distribute.
>
> Hit send too soon - I meant to say, currently my project is just
> clojure, and lein works very nicely to package it. If I wanted to
> include some java sources, what would the easiest way to build the
> combined project be?
>
> martin
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

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

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


Re: Building mixed clojure and java code

2010-07-14 Thread Martin DeMello
On Wed, Jul 14, 2010 at 6:49 PM, Moritz Ulrich
 wrote:
> There is lein-javac which integrates javac into the leiningen
> build-flow: http://github.com/antoniogarrote/lein-javac

Excellent, thanks :)

martin

-- 
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: Building mixed clojure and java code

2010-07-14 Thread Peter Schuller
> Hit send too soon - I meant to say, currently my project is just
> clojure, and lein works very nicely to package it. If I wanted to
> include some java sources, what would the easiest way to build the
> combined project be?

Other than leiningen with lein-javac as mention, there is maven. I am
moving to maven, mostly because I have had to learn maven anyway and
it has pretty good infrastructure for plugins and a wealth of
pre-existing plugins.

With maven you'd enable the clojure plugin in pom.xml, and drop your
clojure code in src/main/clojure (with java in src/main/java) and it
would pick it up by default.

An example pom.xml for a simple clojure project may be:

   http://github.com/scode/httpgctest/blob/master/pom.xml

I don't personally care for the XML, but I look forwarding to Maven 3
and polyglot maven, where project definitions seem to become almost
identical to leiningen's.

-- 
/ Peter Schuller

-- 
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: Building mixed clojure and java code

2010-07-14 Thread Meikel Brandmeyer
Hi,

On Jul 14, 3:16 pm, Martin DeMello  wrote:

> Hit send too soon - I meant to say, currently my project is just
> clojure, and lein works very nicely to package it. If I wanted to
> include some java sources, what would the easiest way to build the
> combined project be?

For the case files: the clojuresque plugin for gradle also allows
mixed compilation. You can specify which is needed first by explicitly
providing the dependency "compileClojure.dependsOn compileJava". Or
the other way around. Real mixed compilation (Some Java class,
Clojure, Java, Clojure, ...) is currently not possible.

Sincerely
Meikel

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


ANN: Async Http Client for Clojure aka ahc-clj

2010-07-14 Thread Hubert Iwaniuk
Hi *

Just release first version of Async Http Client for Clojure.
http://clojars.org/ahc-clj

This is async http client that is backed by Async Http Client 
http://bit.ly/aUctdM which by default runs on top of Netty.

General documentation on project is available here: 
http://neotyk.github.com/ahc-clj/
More detailed docs: http://neotyk.github.com/ahc-clj/docs.html
Autodoc: http://neotyk.github.com/ahc-clj/autodoc/
Code: http://github.com/neotyk/ahc-clj

Two basic examples of usage:

(let [resp (GET "" {:query {:param-name "some-value}})
 status (:status @resp)
 headers (:headers @resp)
 body (:body @resp)]
 (println (:code status))
 (println (apply str (map char body

(let [stream (ref #{})
resp (STREAM :get ""
(fn [state bytes]
   (if (not (empty? bytes))
  (let [p (apply str (map char bytes))]
 (dosync (alter stream conj p)))
   (println "Empty body part 
received."]
 ; do something to @stream
 ; @resp will not get delivered until streaming is done
 )

In first example resp is a promise that is delivered once response is received.
Second example is showing how to consume a HTTP Stream, note that it is 
collecting body parts, which is not necessary.
You can provide a callback that will not collect those parts but just acts on 
one that was currently received.

Next releases should expose more configuration body streaming from client to 
server, multipart support.

I hope you'll like it,
Hubert.

-- 
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: Building mixed clojure and java code

2010-07-14 Thread Wilson MacGyver
We use gradle and clojuresque to do this. Our code has java, groovy
And clojure. It works very well for us.

On Wednesday, July 14, 2010, Martin DeMello  wrote:
> What are people using to build mixed clojure/java code? Currently just
> using lein {uber,}jar to build and distribute.
>
> martin
>
> --
> 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

-- 
Omnem crede diem tibi diluxisse supremum.

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


Clojure 1.2 Beta 1

2010-07-14 Thread Stuart Halloway
Clojure 1.2 Beta 1 is now available, along with a corresponding Clojure 
Contrib, at:

http://clojure.org/downloads

It contains significant new features, as well as many bug fixes and small 
enhancements. A larger number of contributors than ever before have pitched in. 
You can see an overview of the changes in the changes file at:

http://github.com/clojure/clojure/blob/1.2.x/changes.txt

For maven/leiningen users, your settings to get the beta from 
build.clojure.org/releases are:

 :dependencies [[org.clojure/clojure "1.2.0-beta1"]
  [org.clojure/clojure-contrib 
"1.2.0-beta1"]

To everyone who has contributed to 1.2, many thanks!

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: Clojure 1.2 Beta 1

2010-07-14 Thread Sean Devlin
Congrats!

On Jul 14, 11:03 am, Stuart Halloway 
wrote:
> Clojure 1.2 Beta 1 is now available, along with a corresponding Clojure 
> Contrib, at:
>
>        http://clojure.org/downloads
>
> It contains significant new features, as well as many bug fixes and small 
> enhancements. A larger number of contributors than ever before have pitched 
> in. You can see an overview of the changes in the changes file at:
>
>        http://github.com/clojure/clojure/blob/1.2.x/changes.txt
>
> For maven/leiningen users, your settings to get the beta from 
> build.clojure.org/releases are:
>
>          :dependencies [[org.clojure/clojure "1.2.0-beta1"]
>                                       [org.clojure/clojure-contrib 
> "1.2.0-beta1"]
>
> To everyone who has contributed to 1.2, many thanks!
>
> 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: Clojure 1.2 Beta 1

2010-07-14 Thread David Nolen
Congrats! It's an incredible update.

On Wed, Jul 14, 2010 at 11:03 AM, Stuart Halloway  wrote:

> Clojure 1.2 Beta 1 is now available, along with a corresponding Clojure
> Contrib, at:
>
>http://clojure.org/downloads
>
> It contains significant new features, as well as many bug fixes and small
> enhancements. A larger number of contributors than ever before have pitched
> in. You can see an overview of the changes in the changes file at:
>
>http://github.com/clojure/clojure/blob/1.2.x/changes.txt
>
> For maven/leiningen users, your settings to get the beta from
> build.clojure.org/releases are:
>
> :dependencies [[org.clojure/clojure "1.2.0-beta1"]
>  [org.clojure/clojure-contrib
> "1.2.0-beta1"]
>
> To everyone who has contributed to 1.2, many thanks!
>
> 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

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

Suggestions for a &file and &line implicit argument in macros

2010-07-14 Thread Nicolas Oury
Dear all,

I am using a lot of macros with a quite complex syntax and I would like to
be able to report error nicely.
I haven't been able to find a way to report the file and (most importantly)
the line of the macro whose evaluation produce an error.

Have I missed some way of doing that?

Would two implicit arguments &file and &line be useful for others, or I am
the only one that needs something like that?


Best regards,
 Nicolas

PS: and congratulations and thanks so much for Clojure 1.2 beta 1.

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

Strange Loop conference (now w/ Clojure!)

2010-07-14 Thread Alex Miller
Hello all,

I'm the organizer for the Strange Loop conference and also a full-time
Clojure programmer.  I have just released the full schedule for the
2010 conference which is Oct 14-15th in St. Louis, $150 early bird
till Aug 6th.  I wanted to drop a special note here as I included many
Clojure talks and thought in lieu of an actual Clojure conference,
maybe some of you would be interested in this.

Clojure talks:
- Chris Houser ("Joy of Clojure") - Clojure's Solutions to the
Expression Problem
- Bradford Cross (Flightcaster) - From Data to Product with a Toolbox
of Goodness
- Jim Duey (Sonian) - Conduit: A Library for Distributed Applications
in Clojure
- Nathan Marz (BackType) - Querying Big Data Rapidly and Robustly with
Cascalog
- Brian Marick - Outside-in TDD in Clojure
- Adrian Cole (Opscode) - Java Provisioning in the Cloud
- Ryan Senior (Revelytix) - Triplestore Testing in the Cloud with
Clojure
- Bryan Weber (Near Infinity) - Clojure for Ninjas

In addition to that there are over 50 other amazing talks, including
language talks on Scala, Ruby, Go, Lua, Perl 6, Groovy, and
Javascript.

Oh, and Guy freaking Steele is doing a keynote.  GUY STEELE!

More info:
Main:  http://strangeloop2010.com
Speakers:  http://strangeloop2010.com/speakers
Schedule:  http://strangeloop2010.com/calendar
Registration:  https://regonline.com/strangeloop2010

Hope you can all make it - it's going to blow your mind into tiny
pieces (baggie provided).

Alex Miller

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


Clojure REPL prompt Java applet

2010-07-14 Thread Paul Richards
Does there exist a Java applet on the web which just presents an
interactive Clojure REPL prompt?

It would be a nice way to tinker with Clojure without downloading or
installing anything.


-- 
Paul Richards
@pauldoo

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


Re: Clojure 1.2 Beta 1

2010-07-14 Thread Frederick Polgardy
Awesome! Looks great.

What branch/tag of clojure-contrib is the clojure-contrib-1.2.0-
beta1.zip download built from? I don't see it under branches, and
master builds clojure-contrib-1.2.0-SNAPSHOT.jar.

Thanks.

On Jul 14, 10:03 am, Stuart Halloway 
wrote:
> Clojure 1.2 Beta 1 is now available, along with a corresponding Clojure 
> Contrib, at:
>
>        http://clojure.org/downloads
>
> It contains significant new features, as well as many bug fixes and small 
> enhancements. A larger number of contributors than ever before have pitched 
> in. You can see an overview of the changes in the changes file at:
>
>        http://github.com/clojure/clojure/blob/1.2.x/changes.txt
>
> For maven/leiningen users, your settings to get the beta from 
> build.clojure.org/releases are:
>
>          :dependencies [[org.clojure/clojure "1.2.0-beta1"]
>                                       [org.clojure/clojure-contrib 
> "1.2.0-beta1"]
>
> To everyone who has contributed to 1.2, many thanks!
>
> 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


clojure.contrib.sql does not protect table names?

2010-07-14 Thread Tim McCormack
It looks like all the clojure.contrib.sql functions that interact with
tables fail to wrap table names in backticks. As a result, any table
names that are reserved words (like "order") or contain non-
alphanumeric characters (like "foo-bar") will cause SQL errors:

(require '[clojure.contrib.sql :as sql])
(def db {:classname "com.mysql.jdbc.Driver" :subprotocol
"mysql" :subname "//localhost/db" :user "user" :password "secret"})
(sql/with-connection db (sql/drop-table "foo-bar")) ; throws error [1]
(sql/with-connection db (sql/do-commands "DROP TABLE `foo-bar`")) ;
succeeds and returns (0)

Here's the source code:
http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/sql.clj
Example: #L124: (format "DROP TABLE %s" (as-str name)) should use
"DROP TABLE `%s`"

Is there some kind of JDBC nonsense that I'm not aware of? Are
backticks a special feature of MySQL that can't be read by all JDBC-
compatible RDBMSs? I'm not a database person, but it seems to me that
either backticks should be placed around all table, database, and
column names, or a warning should be added to the docs about only
using non-reserved alphabetic table names.

The workaround is to build one's own prepared statements.

- TimMc


[1] Here is the error I see:

Update counts:
 Statement 0: EXECUTE_FAILED
BatchUpdateException:
 Message: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '-bar' at line 1
 SQLState: 42000
 Error Code: 1064
java.lang.Exception: transaction rolled back: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '-bar' at line 1
(NO_SOURCE_FILE:0)

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


Re: Clojure 1.2 Beta 1

2010-07-14 Thread Peter Schuller
Hugely appreciated!

-- 
/ Peter Schuller

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


Re: Clojure REPL prompt Java applet

2010-07-14 Thread Wilson MacGyver
there is already http://www.try-clojure.org
though it's not an applet.

On Wed, Jul 14, 2010 at 11:26 AM, Paul Richards  wrote:
> Does there exist a Java applet on the web which just presents an
> interactive Clojure REPL prompt?
>
> It would be a nice way to tinker with Clojure without downloading or
> installing anything.
>
>
> --
> Paul Richards
> @pauldoo
>
> --
> 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



-- 
Omnem crede diem tibi diluxisse supremum.

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


Re: Clojure 1.2 Beta 1

2010-07-14 Thread Stuart Halloway
Just pushed, sorry.

> Awesome! Looks great.
> 
> What branch/tag of clojure-contrib is the clojure-contrib-1.2.0-
> beta1.zip download built from? I don't see it under branches, and
> master builds clojure-contrib-1.2.0-SNAPSHOT.jar.
> 
> Thanks.
> 
> On Jul 14, 10:03 am, Stuart Halloway 
> wrote:
>> Clojure 1.2 Beta 1 is now available, along with a corresponding Clojure 
>> Contrib, at:
>> 
>>http://clojure.org/downloads
>> 
>> It contains significant new features, as well as many bug fixes and small 
>> enhancements. A larger number of contributors than ever before have pitched 
>> in. You can see an overview of the changes in the changes file at:
>> 
>>http://github.com/clojure/clojure/blob/1.2.x/changes.txt
>> 
>> For maven/leiningen users, your settings to get the beta from 
>> build.clojure.org/releases are:
>> 
>>  :dependencies [[org.clojure/clojure "1.2.0-beta1"]
>>   [org.clojure/clojure-contrib 
>> "1.2.0-beta1"]
>> 
>> To everyone who has contributed to 1.2, many thanks!
>> 
>> 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

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


Re: Clojure-based scientific paper!

2010-07-14 Thread Carson
Congrats!

On Jul 13, 11:56 pm, bOR_  wrote:
> Hi all,
>
> My first paper with results based on a clojure-build agent-based model
> is in press! If you have academic access to the journal, you can peek
> at it here:http://dx.doi.org/10.1016/j.epidem.2010.05.003, but
> otherwise it is also available on mendeley:  
> http://www.mendeley.com/profiles/boris-schmid/
>
> A very old and experimental version of the code is still in the files
> directory of the newsgroup (eden.clj), but I'll make some time to
> clean up the current version and drop it in the files directory as
> well.
>
> Several other papers using clojure are in the works as well, and by
> now I'm making heavy use of Incanter for visualization. Thanks for
> making these wonderful tools! The paper quoted above still uses
> xmgrace and inkscape.

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


Re: clojure.contrib.sql does not protect table names?

2010-07-14 Thread Paul Moore
On 14 July 2010 16:21, Tim McCormack  wrote:
> Is there some kind of JDBC nonsense that I'm not aware of? Are
> backticks a special feature of MySQL that can't be read by all JDBC-
> compatible RDBMSs? I'm not a database person, but it seems to me that
> either backticks should be placed around all table, database, and
> column names, or a warning should be added to the docs about only
> using non-reserved alphabetic table names.

Certainly backticks aren't understood by Oracle. Unless JDBC does a
translation, I think it's database specific (Oracle uses double quotes
instead).

Paul

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


Re: Clojure 1.2 Beta 1

2010-07-14 Thread ngocdaothanh
Report:
There is still "call to contains can't be resolved" for defrecord.
After googling for this message, I see that it has been discussed (and
can be easily fixed?).

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


Re: clojure.contrib.sql does not protect table names?

2010-07-14 Thread Michael Wood
On 14 July 2010 17:21, Tim McCormack  wrote:
> It looks like all the clojure.contrib.sql functions that interact with
> tables fail to wrap table names in backticks. As a result, any table
> names that are reserved words (like "order") or contain non-
> alphanumeric characters (like "foo-bar") will cause SQL errors:
>
> (require '[clojure.contrib.sql :as sql])
> (def db {:classname "com.mysql.jdbc.Driver" :subprotocol
> "mysql" :subname "//localhost/db" :user "user" :password "secret"})
> (sql/with-connection db (sql/drop-table "foo-bar")) ; throws error [1]
> (sql/with-connection db (sql/do-commands "DROP TABLE `foo-bar`")) ;
> succeeds and returns (0)

What does the following do?

(sql/with-connection db (sql/drop-table "`foo-bar`"))

I'm not sure that's the proper solution even if it does work, though.

> Here's the source code:
> http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/sql.clj
> Example: #L124: (format "DROP TABLE %s" (as-str name)) should use
> "DROP TABLE `%s`"
>
> Is there some kind of JDBC nonsense that I'm not aware of? Are
> backticks a special feature of MySQL that can't be read by all JDBC-

AFAIK backticks are MySQL-specific.  PostgreSQL uses double quotes.  I
imagine there is a proper JDBC way of handing this, though.

> compatible RDBMSs? I'm not a database person, but it seems to me that
> either backticks should be placed around all table, database, and
> column names, or a warning should be added to the docs about only
> using non-reserved alphabetic table names.

In PostgreSQL (and I think the SQL standard) table and column names
are lowercased by default unless they are quoted, so you can:

create table blah ...
select * from Blah;

and it will work.

So just quoting everything might surprise some people, but I would not
object to it.

-- 
Michael Wood 

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


Re: clojure.contrib.sql does not protect table names?

2010-07-14 Thread Tim McCormack
On Jul 14, 11:56 am, Michael Wood  wrote:
> AFAIK backticks are MySQL-specific.  PostgreSQL uses double quotes.  I
> imagine there is a proper JDBC way of handing this, though.

OK, so there is enough variation between RDBMSs that a simple solution
won't work. Seems like clojure.contrib.sql's job should be to even out
those differences by quoting and escaping as appropriate to the chosen
database. :-/

 - TimMc

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


defmulti - defonce semantics?

2010-07-14 Thread Brian Carper
I just noticed this in the 1.2 beta release notes:

  * defmulti - Enhanced to have defonce semantics

I've been bitten by this for a couple months now and I never knew the
reason.  If (during interactive development) you want to change the
dispatch function for a multimethod, what is now the proper way?

I used to be able to just rerun the defmulti or recompile/reload the
file containing the defmulti.  I'd lose all the methods defined for
that multimethod (which sometimes forced me to hunt down all the files
that defined methods on it and recompile them all too), but I could
live with that.

Clojure 1.1.0
user=> (defmulti foo (fn [x] x))
#'user/foo
user=> (defmulti foo (fn [x y] x))
#'user/foo
user=> (defmethod foo :foo [x y] y)
#
user=> (foo :foo :bar)
:bar

But now:

Clojure 1.2.0-beta1
user=> (defmulti foo (fn [x] x))
#'user/foo
user=> (defmulti foo (fn [x y] x))   ;;does nothing
nil
user=> (defmethod foo :foo [x y] y)
#
user=> (foo :foo :bar)
java.lang.IllegalArgumentException: Wrong number of args (2) passed
to: user$eval1$fn (NO_SOURCE_FILE:0)

I've been putting

(def foo nil)
(defmulti foo ...)

in a bunch of my source files to force recompilation whenever the
files are recompiled.

Thanks
--Brian

-- 
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: Building mixed clojure and java code

2010-07-14 Thread Shantanu Kumar
lein-javac may be the smoothest option. I have tried both Ant (see
here: http://bitbucket.org/kumarshantanu/blogjure/src) and Maven (see
here: http://bitbucket.org/kumarshantanu/jettify/src) -- I would say
go with Lein. :)

Regards,
Shantanu

On Jul 14, 7:51 pm, Wilson MacGyver  wrote:
> We use gradle and clojuresque to do this. Our code has java, groovy
> And clojure. It works very well for us.
>
> On Wednesday, July 14, 2010, Martin DeMello  wrote:
> > What are people using to build mixed clojure/java code? Currently just
> > using lein {uber,}jar to build and distribute.
>
> > martin
>
> > --
> > 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
>
> --
> Omnem crede diem tibi diluxisse supremum.

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


Re: Clojure 1.2 Beta 1

2010-07-14 Thread MarkSwanson
I didn't see mention of the new equals/equiv work.
Is this going into a later beta or is this work tentatively going into
a later release?

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


Re: Clojure 1.2 Beta 1

2010-07-14 Thread Stuart Halloway
Later release.

> I didn't see mention of the new equals/equiv work.
> Is this going into a later beta or is this work tentatively going into
> a later release?
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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


Re: defmulti - defonce semantics?

2010-07-14 Thread Stuart Halloway
There is no easy way to change the dispatch function interactively. Our 
experience has been that doing this (without the magic to hunt down all the 
defmethods elsewhere) was causing more harm than good.

It's a tradeoff, for sure.

Stu

> I just noticed this in the 1.2 beta release notes:
> 
>  * defmulti - Enhanced to have defonce semantics
> 
> I've been bitten by this for a couple months now and I never knew the
> reason.  If (during interactive development) you want to change the
> dispatch function for a multimethod, what is now the proper way?
> 
> I used to be able to just rerun the defmulti or recompile/reload the
> file containing the defmulti.  I'd lose all the methods defined for
> that multimethod (which sometimes forced me to hunt down all the files
> that defined methods on it and recompile them all too), but I could
> live with that.
> 
> Clojure 1.1.0
> user=> (defmulti foo (fn [x] x))
> #'user/foo
> user=> (defmulti foo (fn [x y] x))
> #'user/foo
> user=> (defmethod foo :foo [x y] y)
> #
> user=> (foo :foo :bar)
> :bar
> 
> But now:
> 
> Clojure 1.2.0-beta1
> user=> (defmulti foo (fn [x] x))
> #'user/foo
> user=> (defmulti foo (fn [x y] x))   ;;does nothing
> nil
> user=> (defmethod foo :foo [x y] y)
> #
> user=> (foo :foo :bar)
> java.lang.IllegalArgumentException: Wrong number of args (2) passed
> to: user$eval1$fn (NO_SOURCE_FILE:0)
> 
> I've been putting
> 
> (def foo nil)
> (defmulti foo ...)
> 
> in a bunch of my source files to force recompilation whenever the
> files are recompiled.
> 
> Thanks
> --Brian
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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


Re: Clojure 1.2 Beta 1

2010-07-14 Thread Stuart Halloway
This will be fixed in the next beta. 

https://www.assembla.com/spaces/clojure/tickets/402-degenerate-defrecords-should-act-like-empty-maps

Stu

> Report:
> There is still "call to contains can't be resolved" for defrecord.
> After googling for this message, I see that it has been discussed (and
> can be easily fixed?).
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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


Re: faster flatten?

2010-07-14 Thread miner
I think it's worthwhile to have a faster flatten even if it doesn't
look as elegant as the current implementation.  You could do a bit of
refactoring and save yourself a call to sequential? since the
recursive calls are guaranteed to have seqs (as a result of next).

Also, I'd prefer flatten to return the argument if it isn't
sequential? so for example, (flatten 10) ==> 10.  I think it would be
less likely to give mysterious results, especially with mistaken
arguments.  I understand that the current flatten for 1.2 beta doesn't
do this -- I'm just throwing in another suggestion after playing with
it for a while.

Here's my suggestion:

(defn fl1 "faster flatten" [coll]
  (letfn [(flcoll [coll]
 (lazy-seq
  (when-let [c (seq coll)]
(let [x (first c)
  nxt (flcoll (next c))]
  (if (sequential? x)
(concat (flcoll x) nxt)
(cons x nxt))]
(if (sequential? coll) (flcoll coll) coll)))

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


Re: Clojure 1.2 Beta 1

2010-07-14 Thread Praki Prakash
I think my number crunching code would benefit immensely from
equals/equiv code. When can we hope to see a release containing
equals/equiv effort?

Thanks

On Wed, Jul 14, 2010 at 10:42 AM, Stuart Halloway
 wrote:
> Later release.
>
>> I didn't see mention of the new equals/equiv work.
>> Is this going into a later beta or is this work tentatively going into
>> a later release?
>>

-- 
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: Suggestions for a &file and &line implicit argument in macros

2010-07-14 Thread Praki Prakash
I have the same problem and implicit file/line arguments would be very
useful to me as well.


On Wed, Jul 14, 2010 at 8:21 AM, Nicolas Oury  wrote:
> Dear all,
> I am using a lot of macros with a quite complex syntax and I would like to
> be able to report error nicely.
> I haven't been able to find a way to report the file and (most importantly)
> the line of the macro whose evaluation produce an error.
> Have I missed some way of doing that?
> Would two implicit arguments &file and &line be useful for others, or I am
> the only one that needs something like that?
>
> Best regards,
>  Nicolas
> PS: and congratulations and thanks so much for Clojure 1.2 beta 1.
>

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


Re: Clojure 1.2 Beta 1

2010-07-14 Thread Stuart Halloway
It will probably go on master fairly soon, but the community will need some 
time with it before a release.

> I think my number crunching code would benefit immensely from
> equals/equiv code. When can we hope to see a release containing
> equals/equiv effort?
> 
> Thanks
> 
> On Wed, Jul 14, 2010 at 10:42 AM, Stuart Halloway
>  wrote:
>> Later release.
>> 
>>> I didn't see mention of the new equals/equiv work.
>>> Is this going into a later beta or is this work tentatively going into
>>> a later release?
>>> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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


Re: Suggestions for a &file and &line implicit argument in macros

2010-07-14 Thread Hugo Duncan
On Wed, 14 Jul 2010 11:21:51 -0400, Nicolas Oury   
wrote:


Would two implicit arguments &file and &line be useful for others, or I  
am

the only one that needs something like that?


I would definitely find it useful (e.g. in pallet to tie generated bash  
script back to clojure source).


--
Hugo Duncan

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


Re: ANN: Deview - Better test results

2010-07-14 Thread Heinz N. Gies

On Jul 14, 2010, at 15:15 , Paul Stadig wrote:

> 
> Port forwarding would still require switiching back and forth between a 
> terminal to a browser, no? It would be cool to have difform used in 
> clojure.test, so that test runs in a terminal could be grasped more 
> immediately.
Ah that is what you mean true, well I could be mean and say use elinks or lynx 
:P but I think that fails the point. But yes from that POV a consoel thing 
would be nice.

Regards,
Heinz.

-- 
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: faster flatten?

2010-07-14 Thread Cam
I definitely like this version a little better. If you change the else
of the if to be just (list), it returns the empty list just as core/
flatten does. Mind if I update the ticket with this patch?

On Jul 14, 1:56 pm, miner  wrote:
> I think it's worthwhile to have a faster flatten even if it doesn't
> look as elegant as the current implementation.  You could do a bit of
> refactoring and save yourself a call to sequential? since the
> recursive calls are guaranteed to have seqs (as a result of next).
>
> Also, I'd prefer flatten to return the argument if it isn't
> sequential? so for example, (flatten 10) ==> 10.  I think it would be
> less likely to give mysterious results, especially with mistaken
> arguments.  I understand that the current flatten for 1.2 beta doesn't
> do this -- I'm just throwing in another suggestion after playing with
> it for a while.
>
> Here's my suggestion:
>
> (defn fl1 "faster flatten" [coll]
>   (letfn [(flcoll [coll]
>                  (lazy-seq
>                   (when-let [c (seq coll)]
>                     (let [x (first c)
>                           nxt (flcoll (next c))]
>                       (if (sequential? x)
>                         (concat (flcoll x) nxt)
>                         (cons x nxt))]
>     (if (sequential? coll) (flcoll coll) coll)))

-- 
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: Building mixed clojure and java code

2010-07-14 Thread Mike Anderson
Hi Martin,

Not sure how it fits with the rest of your environment but I've had
good success with just the following:
- Eclipse Helios (3.6)
- CounterClockwise plugin

CounterClockwise integrates well with the Eclipse build system, so
I've been able to do most of the stuff I need (e.g. exporting to a
runnable .jar file) pretty much automatically. I have multiple
projects (some Java, some Clojure, some mixed) on the build path.

Mike

On Jul 14, 2:15 pm, Martin DeMello  wrote:
> What are people using to build mixed clojure/java code? Currently just
> using lein {uber,}jar to build and distribute.
>
> martin

-- 
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: defmulti - defonce semantics?

2010-07-14 Thread Michał Marczyk
If you're ok with discarding all your methods for the given multi, you can do

(ns-unmap the-ns-of-defmulti name-of-the-multimethod)

(I'm not sure if you should also unmap it in namespaces which refer to
that Var just now...)

Then the entire multifunction will be recreated when you recompile.

Sincerely,
Michał

-- 
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: Building mixed clojure and java code

2010-07-14 Thread Mark McGranaghan
Hi Martin,

http://github.com/mmcgrana/clj-json is a simple example of a Clojure
+Java library that you could use as a working example. See in
particular project.clj the Development section of README.md.

Hope this helps,
- Mark

On Jul 14, 6:16 am, Martin DeMello  wrote:
> On Wed, Jul 14, 2010 at 6:45 PM, Martin DeMello  
> wrote:
> > What are people using to build mixed clojure/java code? Currently just
> > using lein {uber,}jar to build and distribute.
>
> Hit send too soon - I meant to say, currently my project is just
> clojure, and lein works very nicely to package it. If I wanted to
> include some java sources, what would the easiest way to build the
> combined project be?
>
> martin

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


Re: clojure.contrib.sql does not protect table names?

2010-07-14 Thread Michael Gardner
On Jul 14, 2010, at 11:41 AM, Tim McCormack wrote:

> On Jul 14, 11:56 am, Michael Wood  wrote:
>> AFAIK backticks are MySQL-specific.  PostgreSQL uses double quotes.  I
>> imagine there is a proper JDBC way of handing this, though.
> 
> OK, so there is enough variation between RDBMSs that a simple solution
> won't work. Seems like clojure.contrib.sql's job should be to even out
> those differences by quoting and escaping as appropriate to the chosen
> database. :-/

Actually, you can also use double quotes with MySQL if you turn on ANSI_QUOTES:

http://dev.mysql.com/doc/refman/5.5/en/server-sql-mode.html#sqlmode_ansi_quotes

-- 
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: faster flatten?

2010-07-14 Thread Steve Miner

On Jul 14, 2010, at 2:40 PM, Cam wrote:

> I definitely like this version a little better. If you change the else
> of the if to be just (list), it returns the empty list just as core/
> flatten does. Mind if I update the ticket with this patch?

It's all yours.  Really, just a slight change from your code anyway.

I wonder about the call to next.  I'm thinking it should be rest instead.  (See 
http://clojure.org/lazy)

I definitely don't like the way (flatten 10)  and (flatten {:a 1 :b 2}) return 
the empty list (in 1.2 beta).  I think these are accidents, and I worry that 
they will obscure higher-level bugs.

My preference is to return the arg if it's not sequential? as I believe it will 
provide a more useful result at no extra cost.  In that case, the argument to 
flatten was probably a mistake, and it's better if the value shows up somewhere 
rather than being mysteriously swallowed.  On the other hand, it might make 
sense to return (list arg) on the theory that flatten should always return a 
seq.  I could live with that.

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


Re: ANN: Deview - Better test results

2010-07-14 Thread Brenton
On Jul 13, 9:40 pm, Phil Hagelberg  wrote:
> Unfortunately since I spend all my time in the terminal, (for remote
> pairing) I can't really use a web-based interface like this for normal
> work. Do you have any plans to create a command-line client? How hard
> would it be?
>
> Alternatively, do you know how much work it would be to wire difform
> directly into clojure.test so you'd get readable results from a
> standard "lein test" run?

I have created a new project named lein-difftest.

http://github.com/brentonashworth/lein-difftest

It is a Leiningen plugin that works with Leiningen 1.2. It works
exactly the same as "lein test" but will use difform to show diffs
when there is a test failure.

It currently doesn't do anything with stacktraces but I will add that
as an option.

Would it be better to create a patch for Leiningen so that this would
be the default behavior of "lein test"?

Brenton

-- 
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: defmulti - defonce semantics?

2010-07-14 Thread Kevin Downey
if the various pieces of data in a MultiFn were public you could just
copy over the bits you wanted...

On Wed, Jul 14, 2010 at 12:09 PM, Michał Marczyk
 wrote:
> If you're ok with discarding all your methods for the given multi, you can do
>
> (ns-unmap the-ns-of-defmulti name-of-the-multimethod)
>
> (I'm not sure if you should also unmap it in namespaces which refer to
> that Var just now...)
>
> Then the entire multifunction will be recreated when you recompile.
>
> Sincerely,
> Michał
>
> --
> 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



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

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


Re: ANN: Deview - Better test results

2010-07-14 Thread Brian Carper
On Jul 14, 1:05 pm, Brenton  wrote:
>
> I have created a new project named lein-difftest.
>
> http://github.com/brentonashworth/lein-difftest
>

This is awesome.  I've been hurting for this kind of tool for a long
time.

For peons like myself who still run tests from a REPL and want to see
plaintext diffed output, apparently you can use this library and do
(difftest.core/run-tests 'some-ns) instead of (clojure.test/run-test
'some-ns) and it seems to work well.

Minor bug, on line 36 in difftest/core.clj [1], (ct/testing-vars-str)
should probably be (ct/testing-vars-str m), I'm getting an exception
otherwise:
java.lang.IllegalArgumentException: Wrong number of args (0) passed
to: test$testing-vars-str

Thanks
--Brian

[1] 
http://github.com/brentonashworth/lein-difftest/blob/master/src/difftest/core.clj#L36

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


Typed Racket

2010-07-14 Thread ntu...@googlemail.com
For Racket (formely PLT Scheme), there exists a dialect called "Typed
Racket" [1], which allows for static type checking. I wonder if it is
feasible to port the typechecker to Clojure? Any ideas?

- nt

-
[1]  http://docs.racket-lang.org/ts-guide/index.html

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


Re: Typed Racket

2010-07-14 Thread Mark Engelberg
The nice thing about Racket is the way you can write different parts
of your program in different Racket languages.  So you can write some
pieces in Typed Racket, and others in Lazy Racket, and others in
standard Racket.

It is my understanding that Typed Racket programs do not run any
faster than their dynamically-typed counterparts, and in fact commonly
run slower because there are a lot of additional runtime checks that
must be inserted to handle various types of unsafe calls that can
cross module boundaries or be executed at the REPL.  Typed Racket is
purely about safety, not about speed.  My guess is that the Clojure
community would have little interest in any version of static typing
that did not provide performance benefits.

-- 
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: Typed Racket

2010-07-14 Thread Raoul Duke
On Wed, Jul 14, 2010 at 3:49 PM, Mark Engelberg
 wrote:
> purely about safety, not about speed.  My guess is that the Clojure
> community would have little interest in any version of static typing
> that did not provide performance benefits.

check out the approach Dialyzer takes for Erlang. would be fun to have
something like that for Clojure, i think.

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


Re: ANN: Deview - Better test results

2010-07-14 Thread Brenton


On Jul 14, 2:59 pm, Brian Carper  wrote:
> For peons like myself who still run tests from a REPL and want to see
> plaintext diffed output, apparently you can use this library and do
> (difftest.core/run-tests 'some-ns) instead of (clojure.test/run-test
> 'some-ns) and it seems to work well.
>
> Minor bug, on line 36 in difftest/core.clj [1], (ct/testing-vars-str)
> should probably be (ct/testing-vars-str m), I'm getting an exception
> otherwise:
> java.lang.IllegalArgumentException: Wrong number of args (0) passed
> to: test$testing-vars-str
>
> Thanks
> --Brian
>
> [1]http://github.com/brentonashworth/lein-difftest/blob/master/src/difft...

Brian,

Great point on using it from the REPL. I have added an example of this
to the usage section of the README.

I'm not sure what's going on with that error. As you can see from [1],
testing-vars-str takes no args. Also, I don't get an error message
when running as a Leiningen plugin or from the REPL.  Let me know if
you think of anything else that might be causing this problem. I
hacked this together today so I am sure there is something I'm
missing.

P.S.

I just pushed version 1.1.0 which uses clj-stacktrace for better
stacktraces on test errors.

[1] 
http://github.com/richhickey/clojure/blob/fbe0183713b92b2f96a68e2a0d0d654bb7ce93ff/src/clj/clojure/test.clj#L286

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


Re: ANN: Deview - Better test results

2010-07-14 Thread Brian Carper
On Jul 14, 5:03 pm, Brenton  wrote:
> I'm not sure what's going on with that error. As you can see from [1],
> testing-vars-str takes no args. Also, I don't get an error message
> when running as a Leiningen plugin or from the REPL.  Let me know if
> you think of anything else that might be causing this problem. I
> hacked this together today so I am sure there is something I'm
> missing.

I'm looking here:  
http://github.com/clojure/clojure/blob/master/src/clj/clojure/test.clj#L288

Looks like that function's signature changed a couple weeks ago:
http://github.com/clojure/clojure/commit/a9d9ddb6ad4f86809d44f8e3370ae284f0a084f2

--Brian

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


Re: ANN: Deview - Better test results

2010-07-14 Thread Brenton
On Jul 14, 5:17 pm, Brian Carper  wrote:
> I'm looking here:  
> http://github.com/clojure/clojure/blob/master/src/clj/clojure/test.cl...
>
> Looks like that function's signature changed a couple weeks 
> ago:http://github.com/clojure/clojure/commit/a9d9ddb6ad4f86809d44f8e3370a...
>
> --Brian

Thank you Brian,

I fixed this problem. The new version, 1.1.1, is now on Clojars and
GitHub.

Please let me know if you have any more problems.

Brenton

-- 
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: defmulti - defonce semantics?

2010-07-14 Thread Michał Marczyk
On 14 July 2010 22:36, Kevin Downey  wrote:
> if the various pieces of data in a MultiFn were public you could just
> copy over the bits you wanted...

Actually they are public, there are even documented Clojure wrappers
around them, see clojure.core/methods and clojure.core/prefers.

Sincerely,
Michał

-- 
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: Building mixed clojure and java code

2010-07-14 Thread Seth
It appears that lein-javac is not compatible with Leiningen 1.2.0-RC2:

% lein compile-java
[...]
Exception in thread "main" java.lang.Exception: Unable to resolve
symbol: make-path in this context (compile_java.clj:10)

On Jul 14, 9:19 am, Moritz Ulrich 
wrote:
> There is lein-javac which integrates javac into the leiningen
> build-flow:http://github.com/antoniogarrote/lein-javac
>
>
>
>
>
> On Wed, Jul 14, 2010 at 3:16 PM, Martin DeMello  
> wrote:
> > On Wed, Jul 14, 2010 at 6:45 PM, Martin DeMello  
> > wrote:
> >> What are people using to build mixed clojure/java code? Currently just
> >> using lein {uber,}jar to build and distribute.
>
> > Hit send too soon - I meant to say, currently my project is just
> > clojure, and lein works very nicely to package it. If I wanted to
> > include some java sources, what would the easiest way to build the
> > combined project be?
>
> > martin
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with 
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en
>
> --
> Moritz Ulrich
> Programmer, Student, Almost normal Guy
>
> http://www.google.com/profiles/ulrich.moritz

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


Re: ANN: Deview - Better test results

2010-07-14 Thread Phil Hagelberg
On Tue, Jul 13, 2010 at 10:57 PM, Brenton  wrote:
> Could you give me a little more detail as to why you can't use it? I
> also work from the command line and this works very well for me. I
> thought that this would work well for remote pairing. Do you work from
> sources on your machine or from a server? Either way you should be
> able to add the server to your project. The client can run from
> anywhere. You can run one centralized client or one for each team
> member. The main advantage of the web interface is that you have so
> many more options for displaying information.

Yeah, a web display is certainly much richer. I'm totally an edge
case, but when you're remote pairing it's pretty important to keep
things in the shared context just so you can be sure you're looking at
the same thing.

The new plugin looks fantastic. I might even go so far as to suggest
making it wrap the built-in test task using hooks; have you considered
that?

I'd rather wait on integrating it directly into Leiningen itself until
it's seen some more widespread use as a plugin, but it is definitely
not off the table for the future.

Thanks for putting this together!

-Phil

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


Re: Typed Racket

2010-07-14 Thread Laurent PETIT
2010/7/15 Mark Engelberg 

> The nice thing about Racket is the way you can write different parts
> of your program in different Racket languages.  So you can write some
> pieces in Typed Racket, and others in Lazy Racket, and others in
> standard Racket.
>
> It is my understanding that Typed Racket programs do not run any
> faster than their dynamically-typed counterparts, and in fact commonly
> run slower because there are a lot of additional runtime checks that
> must be inserted to handle various types of unsafe calls that can
> cross module boundaries or be executed at the REPL.  Typed Racket is
> purely about safety, not about speed.  My guess is that the Clojure
> community would have little interest in any version of static typing
> that did not provide performance benefits.
>

Why so ?

Having the *option* to type the programs could be a big sell in the
enterprise, and could be seen as a very pragmatic addition to the langage. I
suppose here that the type system being pragmatic implies that it remains
optional, allows mixed programs to be "composed" as usual, and is not
"flawed".
My guess is that
a) it's not easy to come up with something "not flawed"
b) it's not easy to design a type system in such a way that "it does not get
in your way" when you don't want to use it (in the REPL, when prototyping,
etc.)
c) Even if points a) and b) are solved, it probably requires a vast amount
of type to implement, and may not have been considered high priority yet
(compared to alll that remains to be added). And also once introduced, it
may be seen a potentially "getting in the way" of potential radical
improvements.

?

-- 
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: Typed Racket

2010-07-14 Thread nickikt
Hallo all,

Haveing the option of something like that would be nice but atm I
think we should not focus on that. Clojure is still a young language
and there is enought to do.

We should not confuse people with diffrent dialects of clojure
allready.


On Jul 15, 7:10 am, Laurent PETIT  wrote:
> 2010/7/15 Mark Engelberg 
>
> > The nice thing about Racket is the way you can write different parts
> > of your program in different Racket languages.  So you can write some
> > pieces in Typed Racket, and others in Lazy Racket, and others in
> > standard Racket.
>
> > It is my understanding that Typed Racket programs do not run any
> > faster than their dynamically-typed counterparts, and in fact commonly
> > run slower because there are a lot of additional runtime checks that
> > must be inserted to handle various types of unsafe calls that can
> > cross module boundaries or be executed at the REPL.  Typed Racket is
> > purely about safety, not about speed.  My guess is that the Clojure
> > community would have little interest in any version of static typing
> > that did not provide performance benefits.
>
> Why so ?
>
> Having the *option* to type the programs could be a big sell in the
> enterprise, and could be seen as a very pragmatic addition to the langage. I
> suppose here that the type system being pragmatic implies that it remains
> optional, allows mixed programs to be "composed" as usual, and is not
> "flawed".
> My guess is that
> a) it's not easy to come up with something "not flawed"
> b) it's not easy to design a type system in such a way that "it does not get
> in your way" when you don't want to use it (in the REPL, when prototyping,
> etc.)
> c) Even if points a) and b) are solved, it probably requires a vast amount
> of type to implement, and may not have been considered high priority yet
> (compared to alll that remains to be added). And also once introduced, it
> may be seen a potentially "getting in the way" of potential radical
> improvements.
>
> ?

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