Re: Is nil a compile-time literal?

2010-08-30 Thread Stuart Sierra
case does constant-time dispatch using the hash codes of the test
values.  Since nil is Java null, it doesn't have a hash code, so
case can't handle it.

I wouldn't call it a bug, but there is work to be done on extending
case to edge cases like this.

-S


On Aug 30, 5:07 pm, Paul  Mooser taron...@gmail.com wrote:
 I was surprised today when using nil as the test value for one of
 the clauses of the new 1.2 case statement that it results in an NPE.
 Is this a bug, or intended behavior?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Question about testing (and *load-tests*)

2010-08-29 Thread Stuart Sierra
Hi Sean,

As far as I know, that feature never saw much use. Most people like to
keep their test and main sources separate, and build tools assume
this.

To bind *load-tests* during compilation, you would need to control
your own build process. Basically, you would have to launch Clojure
and execute a script that binds *load-tess* and then calls compile
by hand. I don't think this is possible with Leiningen or Maven, but
you could do it with Ant. I doubt it's worth the trouble.

-S


On Aug 29, 3:46 pm, Sean Corfield seancorfi...@gmail.com wrote:
 I'm sure this is just me being dumb about bindings but I've been
 writing tests and I saw in the docs it says you can cause deftest and
 with-test to not generate tests if you bind *load-tests* to false -
 for production.

 I can't quite get my head around how I would bind that variable in a
 way that actually affects how files containing tests are loaded /
 compiled.

 Can someone point me at a good example of a project / source code that
 includes tests in source files but also has a production binding for
 *load-tests* ?

 Thanx!

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: 1.2 contrib shuffles

2010-08-27 Thread Stuart Sierra
With the 1.2.0 release, there was an effort to get the most useful
parts of contrib -- IO and string handling, in particular -- into
Clojure proper, with the goal of making contrib unnecessary for
everyday programming.

Hopefully, contrib can go back to being what it was meant to be: an
experimental proving ground for new Clojure features.

The contrib namespaces that overlap with Clojure proper are deprecated
as of 1.2.0 and will be removed from future versions.  If there's a
function/macro there you want, I recommend writing it into your own
applications and/or libraries.

-S


On Aug 27, 7:54 am, Daniel Janus nath...@gmail.com wrote:
 Hi,

 so I finally got around to port my app to Clojure 1.2 and got confused
 about the contrib shuffles.

 There's clojure.java.io and clojure.contrib.io. The docs on the latter
 says that most of the functions defined in there are deprecated, and
 one should use clojure.java.io instead. But clojure.java.io lacks some
 of the very useful macros and function I'm using, like with-in-reader,
 with-out-writer, slurp*, to name but a few; clojure.contrib.io does
 have them, but it relies on its own primitives, instead of building on
 clojure.java.io. So in a way I'm committed to using (if indirectly)
 code that is already deprecated. What are the plans for contrib
 development in this case?

 On a side note: shouldn't slurp* and slurp be unified somehow in a
 future release?

 Also, contrib 1.2's str-utils contains the following confusing comment
 at the very top:

 ;; DEPRECATED in 1.2: Promoted to clojure.java.string. Note that
 ;; many function names and semantics have changed

 whereas there's no such thing as clojure.java.string.

 Daniel

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: 1.2 contrib shuffles

2010-08-27 Thread Stuart Sierra
On Aug 27, 3:42 pm, B Smith-Mannschott bsmith.o...@gmail.com wrote:
 This thread got me thinking that when a namespace is partially promoted to
 Clojure proper, it might be good to provide a reduced version of the old
 namespace, providing just the functionality that was not promoted as an
 alternative to complete removal.

Speaking as their author, c.c.io and c.c.str* should be removed
completely.  If a function or macro didn't get promoted to Clojure
proper, it is because it was poorly written or redundant.

-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Default values for fields of a defrecord?

2010-08-27 Thread Stuart Sierra
No, constructor functions are the correct way to accomplish this.
-S

On Aug 27, 5:16 pm, Darren Austin darren.aus...@gmail.com wrote:
 Hi folks,

 Is there a way to specify default values for the fields of a
 defrecord?  Or barring that, is there a way to override or augment the
 constructor for the record?

 That is, if I have:

 (defrecord Foo [a b c d e f g])

 I want to be able to create a new Foo with:

 (Foo.)

 and have default values assigned to each of the fields (a, b, c, etc).

 Right now I am just creating my own new-foo function that calls the
 constructor with the default values, but I would like to have
 something more self contained.

 Thanks,
 --Darren

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: date serialization in clojure-contrib json

2010-08-25 Thread Stuart Sierra
Thanks, I'll give it a try.

On Aug 25, 12:00 pm, Dmitri dmitri.sotni...@gmail.com wrote:
 I posted the complete file on github herehttp://gist.github.com/549771

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


Removed Clojure binaries from contrib 'complete' jar

2010-08-24 Thread Stuart Sierra
I've updated the clojure-contrib build to create the uberjar at
modules/complete/target/complete-1.3.0-SNAPSHOT-bin.jar
WITHOUT the Clojure .class build files included.

This is a binary-only JAR right now.  I will look into building a JAR
that includes the clojure-contrib source files.

-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: date serialization in clojure-contrib json

2010-08-24 Thread Stuart Sierra
On Aug 23, 9:03 pm, Dmitri dmitri.sotni...@gmail.com wrote:
 Would there be an issue with adding something like that to the
 contrib?

I don't want to add anything that impacts performance in the plain
parsing case.

-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 master now in submodules

2010-08-23 Thread Stuart Sierra


On Aug 23, 2:51 pm, Konrad Hinsen konrad.hin...@fastmail.net wrote:
 Or is there any simple way to make a jar containing only the source code 
 files?

Ys, the maven assembly plugin can do this.  Ill work on it when I get
back later this week.
-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: date serialization in clojure-contrib json

2010-08-21 Thread Stuart Sierra
I suppose one could override the (private) read-json-object function
to transform maps after they are read, based on the presence of
certain keys.  But that would seriously complicate the reader.  It's
probably easier to transform the data after it comes back from the
JSON parser.

-S


On Aug 20, 5:06 pm, Dmitri dmitri.sotni...@gmail.com wrote:
 My concern is more to do with the reader, I think extending writer
 works quite well, it would be nice if it was possible to do the same
 thing with the reader, so you could specify how to deserialize
 specific types of data. Right now it seems to be baked into read-json-
 reader and there's no easy way to extend it.

 Maybe it could be possible to specify how to deserialize data based on
 the key names, then if the reader hits a key with the given name it
 would try to deserialize it with the given function or something?

 On Aug 20, 3:32 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:



  Since there is no standard for how to represent dates in JSON, it is
  unlikely to be built in.  But you can extend the writer with
  application-specific date formats.
  -S

  On Aug 20, 2:15 pm, Dmitri dmitri.sotni...@gmail.com wrote:

   I'm currently using Dan Larkin's clojure-json, and it provides a way
   to serialize and deserialize dates, it also provides the option to
   specify custom serializers, eg:

   (defn date-encoder
           [date writer pad current-indent start-token-indent indent-
   size]
           (.append writer (str start-token-indent \ date \)))

   I was looking at switching to using the json implementation in clojure-
   contrib, but noticed that it doesn't handle dates nor does it provide
   a way to register custom serializers, is there a plan to implement
   that in the future, or is the proper approach to simply extend Write-
   JSON whenever a custom serializer/deserializer is needed.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 master now in submodules

2010-08-20 Thread Stuart Sierra
Hello, all,

As planned for some time, clojure-contrib has now been split into many
submodules on the master branch.


*** For users of clojure-contrib 1.2.0: nothing changes.


*** For users of clojure-contrib snapshots:

New builds of the master branch on github will be available as 1.3.0-
SNAPSHOT versions.  Each major contrib library has its own module with
the groupId org.clojure.contrib and an artifactId which is the name
of the library.

For example, to use the clojure.contrib.macro-utils namespace in your
projects, add a dependency on group org.clojure.contrib, artifact
macro-utils, version 1.3.0-SNAPSHOT.

In Leiningen syntax, this looks like:

:dependencies [ ... [org.clojure.contrib/macro-utils 1.3.0-
SNAPSHOT] ...]

In Maven syntax, this looks like:

dependencies
...
   dependency
 groupIdorg.clojure.contrib/groupId
 artifactIdmacro-utils/artifactId
 version1.3.0-SNAPSHOT/version
   /dependency
...
/dependencies

If you want to use ALL contrib libraries, add a dependency on group
org.clojure.contrib, artifact complete, version 1.3.0-SNAPSHOT.
This meta-library depends on all other contrib libraries.


*** For clojure-contrib developers:

Each library has its own directory under the modules directory at
the top level of clojure-contrib.  Each module directory contains a
pom.xml file specifying the name, version number, and dependencies of
that library.

Every module pom.xml declares a parent located in the modules/parent
directory.  The parent pom.xml file defines configuration settings
common to all clojure-contrib libraries.  Currently the parent pom.xml
declares a dependency on Clojure 1.2.0 and sets up clojure-maven-
plugin to compile and test Clojure sources.

Individual libraries may override the parent configuration in their
own pom.xml files.

Building all of clojure-contrib (by running mvn install at the top
level) can take over 10 minutes.  Fortunately, you do not need to
build all the modules most of the time.  To build just one library, cd
to its directory under modules and run mvn install (or mvn test
to test).  You will need to have already installed, at a minimum, the
parent module and any modules your library depends on.


*** For everyone:

There will doubtless be some breakage and difficulties during this
transition period.  Please bear with us.  Post your questions to the
list, and we will try to answer them as soon as possible.

Thanks,
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: date serialization in clojure-contrib json

2010-08-20 Thread Stuart Sierra
Since there is no standard for how to represent dates in JSON, it is
unlikely to be built in.  But you can extend the writer with
application-specific date formats.
-S


On Aug 20, 2:15 pm, Dmitri dmitri.sotni...@gmail.com wrote:
 I'm currently using Dan Larkin's clojure-json, and it provides a way
 to serialize and deserialize dates, it also provides the option to
 specify custom serializers, eg:

 (defn date-encoder
         [date writer pad current-indent start-token-indent indent-
 size]
         (.append writer (str start-token-indent \ date \)))

 I was looking at switching to using the json implementation in clojure-
 contrib, but noticed that it doesn't handle dates nor does it provide
 a way to register custom serializers, is there a plan to implement
 that in the future, or is the proper approach to simply extend Write-
 JSON whenever a custom serializer/deserializer is needed.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 Release

2010-08-19 Thread Stuart Sierra
On Aug 19, 1:12 pm, Jeff Brown j...@jeffandbetsy.net wrote:
 When should 1.2.0 be available 
 athttp://repo2.maven.org/maven2/org/clojure/clojure/?

We don't have a direct sync to Maven central.  They don't seem to be
giving those out anymore.  So someone with the authority will have to
upload it manually. :(

Until then, add http://build.clojure.org/releases to your list of
repositories.

-S

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


First Clojure Conj October 22-23

2010-08-19 Thread Stuart Sierra
In case you haven't heard, here's the official story:

http://first.clojure-conj.org/

Clojure Conj 2010 will be held in Durham, North Carolina on October 22
and 23.

We are currently collecting emails of people interested in attending.
If you plan on attending, please submit your email at the link above
to help us with capacity planning.

Still to be determined:
 - venue (depends on number of attendees)
 - cost (there will be a registration fee, but it will be modest)
 - final list of speakers

Watch this space and @clojure_conj on Twitter for more updates, coming
as soon as we have them.

-S

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


Re: RFC: updated c.c.logging with some breaking changes

2010-08-11 Thread Stuart Sierra
Hi,

Please don't push to contrib master until after the final 1.2.0
release. We are in the process of splitting contrib into sub-modules
(work-in-progress visible on the modules branch) to allow library
authors more control over releases of individual libraries.

-S

On Aug 11, 12:52 am, ataggart alex.tagg...@gmail.com wrote:
 I've pushed the changes to my fork of contrib[1] and would like to get
 feedback before pushing to contrib master.

 Changes to logging.clj[2]:

 New features:
 - Log and LogFactory protocols allow adding new implementations
 - log macros for using println-style args
 - log macros for using format-style args

 Improvements:
 - Fixed reflection in log-stream
 - log-capture! now optionally takes args specifying out and err
 logging levels
 - with-logs now optionally takes args specifying out and err logging
 levels
 - Fixed synchronization issue around calling System.setOut/setErr
 - spy uses pprint to format output

 Breaking changes from 1.0:
 - *allow-direct-logging*: Replaced with improved functionality via
 *force*
 - *impl-name*: Replaced with impl-info fn on LogFactory protocol
 - trace/debug/etc: Now take args like println, throwable position
 changed
 - log: order of args changed to keep consistency with new println and
 format
        style args' placement of throwable

 [1]http://github.com/ataggart/clojure-contrib
 [2]http://github.com/ataggart/clojure-contrib/blob/master/src/main/cloju...

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: maven compilation of a clojure project hangs due to still running thread pools

2010-08-08 Thread Stuart Sierra
Short answer: never execute code at the top-level of your source
files. Only define functions.

If you have a shared constant that only needs to be evaluated once,
consider using delay/force.

-S


On Aug 7, 4:46 am, Christian Schuhegger
christian.schuheg...@gmail.com wrote:
 Hi all,

 I just had a lengthy debugging session behind me to find out why maven
 hangs when trying to execute the clojure:compile target of the
 clojure-maven-plugin.

 I found out that the problem does not lie in maven but in clojure (or
 in my code if you want to see it that way). My code executes some
 expressions that cause the clojure thread pools to be started. These
 thread pools stay alive after the compilation phase is over. My intent
 would be that such objects are only created when running the program
 but not when compiling it.

 The only reference where I found this problem discussed is from
 2009-06-01:http://code.google.com/p/clojure/issues/detail?id=120
 but I did not find any follow up or recommendation on how to deal with
 such issues?

 What is the current recommended way on how to deal with this
 situation?

 Many thanks,
 Christian

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Unexpected conj behavior

2010-06-14 Thread Stuart Sierra
On Jun 14, 11:06 am, Sean Devlin francoisdev...@gmail.com wrote:
 ;Bad
 user= (into {} (partition 2 [:a 1 :b 2 :c 3 :d 4]))

This can, of course, be
(into {} (map vec (partition 2 [:a 1 :b 2 :c 3 :d 4])))


I think the requirement is that the argument to APersistentMap.conj
should implement Associative, which vectors do but seqs do not
(because they don't do random access).

-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: promoting contrib.string to clojure, feedback requested

2010-05-26 Thread Stuart Sierra
On May 26, 12:42 pm, Sean Devlin francoisdev...@gmail.com wrote:
 I'd like to see a specific proposal for replace  replace-first.
 Stuart Sierra put a lot of effort into getting those fns the way they
 are in contrib, and we should be careful to not undo any lessons
 learned in the process.

Yes, originally replace and replace-first were multimethods.  But
that's too slow for string routines, which tend to be called often.
The type-specific replace-* and replace-first-* functions are
carefully optimized.

-Stuart

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Question about namespaces

2010-05-09 Thread Stuart Sierra
 http://www.google.com/url?sa=Dq=http://richhickey.github.com/clojure-contrib/ns-utils-api.html%23clojure.contrib.ns-utils/immigrate

'immigrate' is bad, it creates new Vars instead of new mappings to
existing Vars, leading to very subtle and difficult-to-fix bugs.

-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Pack and unpack

2010-05-07 Thread Stuart Sierra
On May 7, 11:55 am, Michael Jaaka michael.ja...@googlemail.com
wrote:
 I was searching for function which converts to and back all clojure
 structures like maps, vectors and sequences to serializable java
 objects.

In Clojure 1.2 the core Clojure data structures will all be
Serializable.  You can test this in the current development master
branch.

-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Dumbest test Q you ever heard

2010-05-07 Thread Stuart Sierra
On May 6, 12:40 pm, Quzanti quza...@googlemail.com wrote:
 If you do anything outside an assertion you get an error saying you
 were outside an assertion.

No, clojure.test permits any arbitrary code inside deftest.  If you
get an error saying Uncaught exception, not in assertion it means
that some of that code threw an Exception when it was run.

-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Defining a namespace inside a let

2010-05-07 Thread Stuart Sierra
On May 2, 3:09 pm, alux alu...@googlemail.com wrote:
 Hm. Can you point me to some documentation about these special rules
 then?

Some on http://clojure.org/namespaces

But the best rule of thumb is: never use ns or in-ns anywhere
except at the top of a source file.

-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Reading the manifest file

2010-05-03 Thread Stuart Sierra
On May 3, 11:16 am, Ralph grkunt...@gmail.com wrote:
 Yes, but I don't believe that it guarantees that you will get the
 manifest for the enclosing JAR file if you have more than one.

I don't think that's possible in the general sense.  Application
containers like OSGI may provide this functionality.
-S

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: what is wrong with (use `clojure.contrib.string) ?

2010-04-30 Thread Stuart Sierra
On Apr 30, 1:43 am, David Nolen dnolen.li...@gmail.com wrote:
 My rule of thumb is:

 use + :only
 require + :as

Yes.  clojure.contrib.string deliberately has short function names,
which means there is some overlap with clojure.core.

Note: (use '[clojure.contrib.string :as st :only ()]) also works.

-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: Defining a namespace inside a let

2010-04-30 Thread Stuart Sierra
ns and in-ns have special evaluation rules.  In general, they
don't work as you'd expect in block expressions such as do or let.

If you want to create namespaces programatically, use create-ns and
intern.

-SS


On Apr 26, 6:25 pm, David McNeil mcneil.da...@gmail.com wrote:
 I am experimenting with clojure.test and I encountered the following
 situation which I cannot explain.

 This code:

 (println (do
            (ns ns01
              (:use clojure.test))
            (deftest test1 nil)
            (run-tests)))

 Produces the expected result (note: it runs one test):

     Testing ns01

     Ran 1 tests containing 0 assertions.
     0 failures, 0 errors.
     {:type :summary, :test 1, :pass 0, :fail 0, :error 0}

 However, if I do the exact same thing inside of a let:

 (println (let []
            (do
              (ns ns02
                (:use clojure.test))
              (deftest test1 nil)
              (run-tests

 Then I get the unexpected result that no tests are executed:

     Testing ns02

     Ran 0 tests containing 0 assertions.
     0 failures, 0 errors.
     {:type :summary, :test 0, :pass 0, :fail 0, :error 0}

 Seems there is something going on with namespaces that I do not
 understand and I hope that somewhere here can explain it.

 Thank you.
 -David McNeil

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://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: Remapping Class Imports

2010-04-12 Thread Stuart Sierra
On Mar 30, 11:38 am, aria42 ari...@gmail.com wrote:
 Hi,
   Is it possible to remap the name of a class or package import?

No.

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

To unsubscribe, reply using remove me as the subject.


Re: intuitive stack trace

2010-03-30 Thread Stuart Sierra
On Mar 29, 2:23 pm, strattonbrazil strattonbra...@gmail.com wrote:
 I do something wrong, I have to read through the stack which sometimes
 just says there's an error at line 0, which doesn't help me much.

One problem is that the compiler can't keep track of line numbers in
the REPL (or SLIME).  If you load your code from a file you should at
least get line numbers back.

-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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: unmapping all namespaces in repl

2010-03-30 Thread Stuart Sierra
On Mar 30, 4:36 am, Istvan Devai ist...@istvandevai.com wrote:
 How can I easily unmap all namespaces in a repl or swank?

The following will give you a fresh user namespace:

(in-ns 'clojure.core)
(remove-ns 'user)
(ns user)

-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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Getting started with open source Clojure projects

2010-03-30 Thread Stuart Sierra
Take a look at the dependency management tools.  Most open-source
Clojure projects use either Maven and Leiningen.  Both use the same
dependency model and provide similar capabilities for starting a REPL
with the classpath configured automatically.

-SS



On Mar 29, 11:39 pm, Daniel cotter.dan...@gmail.com wrote:
 If this is a dumb question, let me apologize in advance. The thing is,
 I've been trying to learn Clojure in my spare time, and, following the
 advice of several Clojure blogs, started by reading Halloway's book
 and playing around a bit at the REPL, which is all well and good, but
 now I'm ready to tackle something a little bigger. The project that
 interests me most is James Reeve's Compojure, so I cloned the
 repository with the intention of loading the source files into the
 REPL and testing out some of the functions to get an idea of how it
 works internally. The first hurdle was getting all the dependent
 classes on the classpath, which I did by adding them one by one to
 the .clojure file (I'm using a script that concatenates the contents
 of .clojure to the classpath before launching the REPL). So far, so
 good. However, when I try to load core.clj from the REPL, it complains
 about not being able to find compojure/response.clj or its
 equivalent class. And it does this even if I load response.clj first,
 then try to load core.clj.

 So here are my questions:

 Am I going about this the wrong way? Is there an easier way to explore
 existing open-source projects? I
 Is there a less cumbersome way to get a load of files on the classpath
 than manually editing the .clojure file?
 How do I tell the REPL where to find response.clj so that core.clj
 will load?

 Any other advice will be much appreciated as well.

 Thanks,

 Daniel

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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-23 Thread Stuart Sierra
On Mar 23, 9:08 am, Eric Thorsen eric.thor...@gmail.com wrote:
 Having the target=1.5 property set for the clojure-contrib build might
 get me where I need to be.  I just have not had a chance to try it
 yet.

The clojure-contrib build does not call javac, so it shouldn't matter.

-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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-23 Thread Stuart Sierra
On Mar 23, 9:08 am, Eric Thorsen eric.thor...@gmail.com wrote:
 The above returns the running jvm version.  I was looking at the jar
 manifest to see what it was built with which is where I saw the 1.6
 reference for clojure-contrib.

Oh, it's the JAR manifest that's the problem?  Maybe this will help:
http://maven.apache.org/guides/mini/guide-manifest.html

-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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: clojure.contrib.json.write.print-json type coverage

2010-03-23 Thread Stuart Sierra
Current version of clojure.contrib.json on the github master branch
uses protocols, and should have better type coverage.

-SS



On Mar 22, 2:24 pm, Jieren Chen jieren.c...@gmail.com wrote:
 Hey everyone

 I've come across a few situations where the print-json multi-method
 does not cover certain types that may be desirable to have (ex.
 java.math.BigDecimal and java.util.Date)

 It's really easy to hack your way around this, but I was just
 wondering if there's any demand for a change to the actual
 clojure.contrib.json multimethod to account for these types

 If you have any examples of additional types that the multi-method
 doesn't cover, I'd be interested to know those too.

 Thanks!
 Jieren

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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-23 Thread Stuart Sierra
On Mar 23, 9:43 am, Stuart Sierra the.stuart.sie...@gmail.com wrote:
 If the JAR manifest is the problem, the following pom.xml lines will
 change it:

Yet another option is to supply a completely custom manifest file that
omits the Build-Jdk line altogether.

But I still think the correct solution is to install JDK 1.5 on
build.clojure.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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-22 Thread Stuart Sierra
By the way, Ant has the same problem: you can specify a target JDK
version in the javac task, but not the java task.  So the Clojure
compiler runs with the default java executable on the local machine.

-SS


On Mar 22, 11:54 am, Stuart Sierra the.stuart.sie...@gmail.com
wrote:
 Actually, this is more complicated than I thought.  The build
 processes will use whatever default version of Java is installed
 locally.

 Maven has config options for the Java *compiler* version to use, but
 that will only work for .java source files (of which there are non in
 contrib).  The version of Java under which the Clojure compiler runs
 is just the local java executable.

 The solution, I suppose, is to install Java 1.5 on the
 build.clojure.org server and force it to be the default.

 -SS

 On Mar 22, 8:48 am, Rich Hickey richhic...@gmail.com wrote:



  On Mar 21, 2010, at 8:50 PM, Stuart Sierra wrote:

   No, but you can change the configs and recompile.

   Clojure itself uses Ant, so ant on a machine with only Java 1.5
   should do the trick.  To install that custom JAR in your local Maven
   repository, download the Maven Ant Tasks JAR and run:
   ant -lib /path/to/maven-ant-tasks.jar ci-build

   Contrib uses Maven, so add thes lines to its pom.xml in the plugins
   section:

    plugin
      groupIdorg.apache.maven.plugins/groupId
      artifactIdmaven-compiler-plugin/artifactId
      configuration
          source1.5/source
          target1.5/target
      /configuration
    /plugin

   Then mvn install to build the JARs and put them in your local
   repository.

  Why isn't this in the default build? Clojure targets 1.5, and so  
  should contrib.

  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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Maven clojure:repl

2010-03-21 Thread Stuart Sierra
On Mar 20, 7:56 am, alux alu...@googlemail.com wrote:
 mvn clojure:repl

 But that doesnt work.

 [ERROR] BUILD ERROR
 [INFO]
 
 [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does
 not exist

Those instructions appear to be out-of-date for Incanter's current
source repository.  The Clojure Maven plugin is not specified as a
plugin by the top-level pom.xml.  This may be a bug to take up with
the Incanter developers.

-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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Why I have chosen not to employ clojure

2010-03-21 Thread Stuart Sierra
I agree that the Clojure first-run experience is too rough.  Both
Scala and JRuby, for example, are complete packages that you can
download, unzip, install, and run -- on any platform -- without
knowing anything about Java.

Clojure needs to provide the same experience, even if it only matters
for first-time users.

-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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Maven clojure:repl

2010-03-21 Thread Stuart Sierra
Maven has a default search path, but it only works for the standard
plugins distributed by Apache.

To use the Clojure plugin (any of the clojure:* commands) the pom.xml
must contain a section like this:

  build
...
plugins
...
 plugin
groupIdcom.theoryinpractise/groupId
artifactIdclojure-maven-plugin/artifactId
version1.3.2/version
  /plugin
...
/plugins
  /build

Incanter is divided into several different modules, each with its own
pom.xml.  Some of them include the Clojure plugin, some do not
(presumably they don't need it).

Incanter's top-level pom.xml does not include the Clojure plugin, so
clojure:* goals will not work in the top-level project directory.  In
some of the module directories, such as modules/incanter-app, the
clojure:* goals should work.

-SS



On Mar 21, 3:04 pm, alux alu...@googlemail.com wrote:
 Hello Stuart,

 yes, thats not in. I'm not enough into maven to know where the plugins
 have to be specified. I had the hope that maven searches its
 repository, when I call a specific goal of the form xxx:yyy - so this
 hope was in vain?

 Thank you for the comment.

 Regards, alux

 Stuart Sierra schrieb:



  On Mar 20, 7:56 am, alux alu...@googlemail.com wrote:
   mvn clojure:repl

   But that doesnt work.

   [ERROR] BUILD ERROR
   [INFO]
   
   [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does
   not exist

  Those instructions appear to be out-of-date for Incanter's current
  source repository.  The Clojure Maven plugin is not specified as a
  plugin by the top-level pom.xml.  This may be a bug to take up with
  the Incanter developers.

  -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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: clojure.walk

2010-03-21 Thread Stuart Sierra
clojure.walk is a terrible hack that I wrote and abandoned 2 years
ago.  It never should have made it into the Clojure distribution, for
which I apologize.  I will campaign for its deletion just as soon as I
find a suitable replacement.

-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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-21 Thread Stuart Sierra
No, but you can change the configs and recompile.

Clojure itself uses Ant, so ant on a machine with only Java 1.5
should do the trick.  To install that custom JAR in your local Maven
repository, download the Maven Ant Tasks JAR and run:
ant -lib /path/to/maven-ant-tasks.jar ci-build

Contrib uses Maven, so add thes lines to its pom.xml in the plugins
section:

  plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
source1.5/source
target1.5/target
/configuration
  /plugin

Then mvn install to build the JARs and put them in your local
repository.

-SS



On Mar 21, 7:32 pm, Eric Thorsen ethor...@enclojure.org wrote:
 This is more of a maven question probably, but I have an app that
 needs versions of the jars built with jdk 1.5 and I'm using 
 thehttp://build.clojure.org/snapshotsrepo where they appear to be built
 with 1.6.  Are there versions (or plans to support 1.5 versions) in a
 maven repo somewhere?

 Thanks!
 Eric

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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Java method call irritation

2010-03-19 Thread Stuart Sierra
On Mar 18, 11:55 am, Per Vognsen per.vogn...@gmail.com wrote:
 Is there any reason why a .method occurrence in non-operator position
 doesn't just do the closure wrapping automagically?

It's been discussed as a possibility; it may be added to Clojure in
the future.

-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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Name suggestions

2010-03-19 Thread Stuart Sierra
On Mar 17, 3:08 am, mac markus.gustavs...@gmail.com wrote:
 After just a little more test and polish I plan on calling clj-native
 1.0. But clj-native is a *really* boring name so I want to change it
 before 1.0 and I don't have very good imagination when it comes to
 these things.

Personally, I much prefer library names that are descriptive rather
than creative.  Give your kids cute names, not your libraries.

-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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Clojure Implementation issues that may affect performance?

2010-03-09 Thread Stuart Sierra
On Mar 9, 8:59 am, jshore jonathan.sh...@gmail.com wrote:
 I suspect that on recursion a will become an object again and will
 then need to be downcasted again as well.   Would be nice to be able
 to do:

 (defn fib [#^int v]
         (if ( v 2)
                 v
                 (+ (fib (- v 1)) (fib (- v 2)

 and just have it work.

This is planned for the future.  But it's quite complicated to
implement, so it may take a while.

-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: Clojure for financial applications

2010-03-08 Thread Stuart Sierra
On Mar 8, 9:29 am, Stuart Halloway stuart.hallo...@gmail.com wrote:
 (1) You still have namespaces in Clojure, which correspond 1-1 with  
 Java packages.

More or less.  The namespace foo.bar.baz is actually a Class named
baz in the package foo.bar.

-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: Leiningen, Clojure and libraries: what am I missing?

2010-03-05 Thread Stuart Sierra
On Mar 4, 1:59 pm, David Nolen dnolen.li...@gmail.com wrote:
 If Lein evolves to to handle dependencies of dependencies and intelligently
 generates the classpath based on these dependencies (instead of copying
 files around) what advantage does Maven really have?

Maven supports a wide range of development/deployment models already.
Whatever you want to do (including compile/test/run Clojure code)
there's a plugin for that.  Why recreate all this functionality in
Leiningen?

Yes, the Maven configuration model isn't pretty, but if you follow the
conventions it works.  Polyglot Maven will obviate the need to write
XML.  But frankly, I don't mind a little XML if it gets the job done.

Basically, I'm skeptical that any tool developed exclusively by/for
the Clojure community could ever achieve the scope and utility of a
tool used by thousands of people and companies.  We're a small
community, we can't do it all alone.

-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: Leiningen, Clojure and libraries: what am I missing?

2010-03-04 Thread Stuart Sierra
On Mar 4, 8:52 am, Stuart Halloway stuart.hallo...@gmail.com wrote:
 My 2c: Leiningen is an important step, but there is still plenty to do.

Oh yeah.

 Some needs I see:

 (0) More point releases of key libs (or some other solution to the  
 snapshots problem)

Yes!

 (1) Unify around the project structure imposed by lein, and/or

As many of you know, I've always been tepid on lein.  I'd rather go
with Maven whole-hog, because that offers the most robust model for
incorporating Java libraries.

The more we can leverage the Java tool set, the better.  I'd rather
lein were just a thin POM generator for those who can't stand writing
XML.

-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: Using deftype to define mutually recursive data inside agent

2010-03-04 Thread Stuart Sierra
deftype just defines a map-like structure with fixed fields; it isn't
going to change the way you deal with that structure in an Agent.

-SS


On Mar 3, 5:02 am, zahardzhan zahardz...@gmail.com wrote:
 Sorry my english

 I use in my small clojure program one complicated mutually-recursive
 data structure that represents an agent-in-environment. This structure
 is clojure agent which have self-reference inside himself and
 reference to environment, where environment is set of agents:

 (let [a (agent {:some state})]
   (send a assoc
           :self (delay a)  ;; this is self-reference
           :env (ref (delay (set a  ;; this is reference to
 environment in which agent live
     (await a)
     a) ;; my agent

 Is there a better way to declare this agent using deftype?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: recursive call boxing primitives?

2010-03-04 Thread Stuart Sierra
On Mar 1, 5:33 pm, John Lawrence Aspden aspd...@googlemail.com
wrote:
 Is the reason the Clojure version is slow that recursive calls to draw-
 tree are boxing and unboxing primitive types?

Recursive calls, like all Clojure function calls, force boxing.  This
may or may not have anything to do with the performance difference you
are seeing.  True primitive support for function arguments is planned
for a future release.

-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: bug: clojure.contrib.json should not default to use keywords.

2010-02-28 Thread Stuart Sierra
Mark,

Thank you!  I argued for this for months, but everyone kept insisting
on keywords by default.  Now you just have to convince the other 2
people who actually use clojure.contrib.json.

-SS


On Feb 27, 3:55 pm, MarkSwanson mark.swanson...@gmail.com wrote:
 Hello,

 Consider the following valid JSON:

 Clojure= (def mq {\Question one\:\test\})
 #'user/mq
 Clojure= (read-json mq)
 {:Question one test}

 So the default behaviour fails to work correctly for a common case.

 The Clojure failure is not exactly obvious either:

  (read-string (str mq))

 request failed java.lang.RuntimeException:
 java.lang.ArrayIndexOutOfBoundsException: 19
     at clojure.lang.RT.readString(RT.java:1220)
     at clojure.core$read_string__4163.invoke(core.clj:2517)

 I also tried with print-dup and it fails the same way:
 =(def ms (new StringWriter))
 =(print-dup mq ms)
 =(. ms toString)
 #=(clojure.lang.PersistentArrayMap/create {:Question one \test\})
 =(read-string (. ms toString))
 #CompilerException java.lang.RuntimeException:
 java.lang.ArrayIndexOutOfBoundsException: 3 (REPL:65)

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


Re: can the :test metadata be used to constrain the range of a variable?

2010-02-19 Thread Stuart Sierra
On Feb 17, 6:26 am, Timothy Pratley timothyprat...@gmail.com wrote:
 :test can be used to store a unit test (typically for a function) but
 you should use clojure.test for writing unit tests, just ignore :test

clojure.test uses :test metadata, so it is somewhat compatible.

-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: ClojureCLR under slime / emacs?

2010-02-14 Thread Stuart Sierra
On Feb 14, 10:43 am, Shawn Hoover shawn.hoo...@gmail.com wrote:
 The real work would be in the swank-clojure clj sources.

Yes, you would basically have to rewrite swank-clojure, as it depends
heavily on the JDK socket libraries.
-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: deftype comment

2010-02-14 Thread Stuart Sierra
On Feb 14, 1:53 am, Mark Engelberg mark.engelb...@gmail.com wrote:
 I think it would be ideal that if you *don't*
 specify clojure.lang.IPersistentMap as an interface, you still get an
 implementation of assoc that works only with keys already in the type.
...
 Thoughts?

Rich's stated reason against this is that he wants to be able, some
day, to implement maps and map-like things with deftype.

-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: processing two collections

2010-02-14 Thread Stuart Sierra
On Feb 14, 9:57 am, Glen Rubin rubing...@gmail.com wrote:
 How do I take an element from one collection and test for no remainder
 (e.g. (zero? (mod x y)), when dividing by every element of the second
 collection, before processing the next item in the first
 collection?

The 'for' macro does this.

-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: A couple of namespace questions

2010-02-14 Thread Stuart Sierra
On Feb 14, 2:09 am, Mike Meyer mwm-keyword-googlegroups.
620...@mired.org wrote:
 Second, is there a way to refer to a relative namespace?

Not as such, but the 'load' function uses the parent directory of the
current namespace:

(ns foo.bar.baz
  (:load quux))
;; = loads foo/bar/baz.clj and foo/bar/quux.clj

(ns foo.bar.baz
  (:load baz/quux))
;; = loads foo/bar/baz.clj and foo/bar/baz/quux.clj

-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


More contrib renaming: c.c.java is gone

2010-02-11 Thread Stuart Sierra
As part of our clojure-contrib clean-up effort:

* c.c.java is gone
* as-str moved to c.c.string
* as-file and as-url moved to c.c.io
* properties stuff moved to c.c.properties
* wall-hack stuff move to c.c.reflect

These changes have been committed to the master branch on Github.

-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: Problems using clojure.contrib.string

2010-02-10 Thread Stuart Sierra
Hi Matt,
Just pushed a fix, see if that helps.

Note that argument order was reversed in most functions from c.c.str-
utils2 to c.c.string.

-SS


On Feb 10, 10:44 am, Matt Culbreth mattculbr...@gmail.com wrote:
 Hello Group,

 I'm working on a Clojure project and I'm using Leiningen for the
 builds.  I'm trying to use the most recent clojure and clojure-
 contrib, but I'm having a problem getting it to compile due to
 apparent errors in clojure.contrib.string.  This works fine on the
 more stable versions of these libraries, which use clojure.contrib.str-
 utils2.

 Here's my project file:
 (defproject myproj 0.1
     :dependencies [[org.clojure/clojure
                       1.2.0-master-SNAPSHOT]
                    [org.clojure/clojure-contrib
                       1.2.0-SNAPSHOT]]
     :main myproj)

 And I'm later using clojure.contrib.string as such:
 (ns myproj
   (:gen-class)
   (:require [clojure.contrib.string :as str-utils :only (join)])
   (:import (java.io File FileNotFoundException BufferedReader
 InputStreamReader OutputStreamWriter)))

 I'm then using the str-utils/join function in the code, but I can't
 get it to compile.  I get the following Java exceptions when doing
 lein compile:

 java.lang.RuntimeException: java.lang.IllegalArgumentException: Unable
 to resolve classname: Replacement
 snip
 at clojure.main.main(main.java:37)
 Caused by: java.lang.IllegalArgumentException: Unable to resolve
 classname: Replacement
         at clojure.lang.Compiler$HostExpr.tagToClass(Compiler.java:893)

 I also get this a couple of times:
 [null] java.lang.VerifyError: (class: clojure/contrib/string
 $replace_first_re__81, method: invoke signature: (Ljava/lang/
 Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) Unable
 to pop operand off an empty stack
 snip
 at clojure.main.main(main.java:37)
      [null] Caused by: java.lang.VerifyError: (class: clojure/contrib/
 string$replace_first_re__81, method: invoke signature: (Ljava/lang/
 Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) Unable
 to pop operand off an empty stack

 Any ideas here?  Not a big deal as I can just use the older code.

 Thanks,

 Matt

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Problems using clojure.contrib.string

2010-02-10 Thread Stuart Sierra
yes

On Feb 10, 1:25 pm, Matt Culbreth mattculbr...@gmail.com wrote:
 Yes that worked very well, thanks Stuart.  I'm assuming that this fix
 will make its way to the nightly build and will be published 
 tohttp://build.clojure.org/job/clojure-contrib/as usual?

 On Feb 10, 12:32 pm, Stuart Sierra the.stuart.sie...@gmail.com
 wrote:



  Hi Matt,
  Just pushed a fix, see if that helps.

  Note that argument order was reversed in most functions from c.c.str-
  utils2 to c.c.string.

  -SS

  On Feb 10, 10:44 am, Matt Culbreth mattculbr...@gmail.com wrote:

   Hello Group,

   I'm working on a Clojure project and I'm using Leiningen for the
   builds.  I'm trying to use the most recent clojure and clojure-
   contrib, but I'm having a problem getting it to compile due to
   apparent errors in clojure.contrib.string.  This works fine on the
   more stable versions of these libraries, which use clojure.contrib.str-
   utils2.

   Here's my project file:
   (defproject myproj 0.1
       :dependencies [[org.clojure/clojure
                         1.2.0-master-SNAPSHOT]
                      [org.clojure/clojure-contrib
                         1.2.0-SNAPSHOT]]
       :main myproj)

   And I'm later using clojure.contrib.string as such:
   (ns myproj
     (:gen-class)
     (:require [clojure.contrib.string :as str-utils :only (join)])
     (:import (java.io File FileNotFoundException BufferedReader
   InputStreamReader OutputStreamWriter)))

   I'm then using the str-utils/join function in the code, but I can't
   get it to compile.  I get the following Java exceptions when doing
   lein compile:

   java.lang.RuntimeException: java.lang.IllegalArgumentException: Unable
   to resolve classname: Replacement
   snip
   at clojure.main.main(main.java:37)
   Caused by: java.lang.IllegalArgumentException: Unable to resolve
   classname: Replacement
           at clojure.lang.Compiler$HostExpr.tagToClass(Compiler.java:893)

   I also get this a couple of times:
   [null] java.lang.VerifyError: (class: clojure/contrib/string
   $replace_first_re__81, method: invoke signature: (Ljava/lang/
   Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) Unable
   to pop operand off an empty stack
   snip
   at clojure.main.main(main.java:37)
        [null] Caused by: java.lang.VerifyError: (class: clojure/contrib/
   string$replace_first_re__81, method: invoke signature: (Ljava/lang/
   Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) Unable
   to pop operand off an empty stack

   Any ideas here?  Not a big deal as I can just use the older code.

   Thanks,

   Matt

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


Re: how to determine what implements a protocol?

2010-02-10 Thread Stuart Sierra
No need to slap your forehead, but here it is:
-
clojure.core/extends?
([protocol atype])
  Returns true if atype explicitly extends protocol

-SS


On Feb 10, 4:03 pm, Raoul Duke rao...@gmail.com wrote:
 hi,

 is there a query to tell me if a datatype implements a particular
 protocol? i'm guessing there must be some forehead-slapping answer,
 but i haven't gleaned the clue yet :-{

 thanks.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Trait-like behavior with Protocols

2010-02-08 Thread Stuart Sierra
On Feb 8, 6:13 pm, aria42 ari...@gmail.com wrote:
 (defprotocol Span
   (start [self])
   (stop [self])
   (span-length [self]))

 Now I know I can just make span-length a function on Span as opposed
 to part of the protocol. Is that what one should do?

Yes.

-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: clojure pathnames library

2010-02-08 Thread Stuart Sierra
Look at clojure-contrib.  In the 1.1 release, use duck-streams and
java-utils.  In the latest github sources, it's all in
clojure.contrib.io.

-SS

On Feb 8, 5:43 pm, Vadim Shender vadim.shen...@gmail.com wrote:
 Hi.

 Is there any clojure third-party library functionally similar to python's
 os.path? Using java.io.File is not so convenient as os.path.

 Regards
 Vadim Shender

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Prepping clojure for packaging (was: Re: Clojure for system administration)

2010-02-06 Thread Stuart Sierra
On Feb 5, 1:47 pm, Peter Schuller peter.schul...@infidyne.com wrote:
 One problem is that there needs to be a convention for a clojure
 binary that works consistently across platforms.

My extremely biased opinion:  Clojure is not a scripting language.
The binary is java.  System-wide classpaths are a bad idea.

-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: Coljure-contrib maven build fail

2010-02-04 Thread Stuart Sierra
This has been reported before.  It's a bug that shows up on Windows.
Please make an Assembla ticket.

In the mean time, build with -Dmaven.test.skip=true to ignore the
failure.

-SS



On Feb 3, 5:49 pm, Base basselh...@gmail.com wrote:
 Hi

 Pulling off of GIT I got the following 4 errors in the unit tests:

 FAIL in (test-relative-path-string) (run-test5258617284758852043.clj:
 45)
 absolute path strings are forbidden
 expected: (thrown? IllegalArgumentException (relative-path-string /
 baz))
   actual: nil

 FAIL in (test-relative-path-string) (run-test5258617284758852043.clj:
 45)
 absolute File paths are forbidden
 expected: (thrown? IllegalArgumentException (relative-path-string
 (File. /quux)))
   actual: nil

 FAIL in (test-file) (run-test5258617284758852043.clj:45)
 no sneaking in absolute paths!
 expected: (thrown? IllegalArgumentException (file foo bar /boom
 baz quux))
   actual: nil

 FAIL in (test-as-url) (run-test5258617284758852043.clj:45)
 expected: (= (URL. file:/foo) (as-url (File. /foo)))
   actual: (not (= #URL file:/foo #URL file:/C:/foo))

 Any thoughts on this?

 Thanks

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 for system administration

2010-02-04 Thread Stuart Sierra
Clojure can certainly do these things; clojure-contrib contains many
file and io-related utilities.  But remember that Clojure, like any
Java program, takes more time to start up than scripting languages
like Perl/Bash/Ruby/Python, so it may be less suitable for programs
that you intend to run at the command-line.

-SS

On Feb 3, 4:50 pm, ajay gopalakrishnan ajgop...@gmail.com wrote:
 Hi,

 I was wondering if the time is right to replace Perl/Bash/Ruby/Python with
 Clojure for system administration / dev productivity scripts. I would not do
 things in Java (for obvious reasons), but clearly Clojure is more concise
 than Java in most cases.
 I would however want to know in detail if it is suitable for Sysadmin tasks
 like the following:

    1. Count # words in a folder , Count # files of particular extension in a
    folder or search regular expression
    2. Search for a particular regexp in a search path
    3. Copy files from one folder to another
    4. Walk through a directory structure
    5. Fork another program and read it's results

 I've gone through this tutorialhttp://java.ociweb.com/mark/clojure/, but
 please point me to clojure.contribs that will make these kind of tasks
 easier.

 Thanks
 Ajay

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Closures and environments

2010-02-04 Thread Stuart Sierra
Hi,

The functionality of closures in Clojure is more or less the same as
Scheme.  But the implementation may be quite different.  I seem to
recall that some Schemes treat lexical environments as first-class
objects.  Clojure does not (at present).

Here's what happens in Clojure:  When you write (fn [] ... x ...), the
compiler generates a sub-class of clojure.lang.Fn with an instance
field x.  When the expression is evaluated, it creates a new instance
of that class, assigning the value 1 to that object's x field.

-SS


On Feb 4, 8:33 am, Ludovic Kuty ludovic.k...@gmail.com wrote:
 Hello,

 I was wondering if symbol resolution in local scope (in a let or
 function body) works the same way as it is in Scheme. I would like to
 know some internals of Clojure when it comes to that. I thought about
 explaining how closures work to my students using that analogy (is it
 just an analogy ?), which I find to be an particularly clear way to
 proceed but I want to avoid talking specifically about Scheme when I
 want to talk about Clojure. Unless both are the same with respect to
 this matter.

 In Scheme, when a function is defined, a closure is created and is
 composed of code (the body of the function) and an environment which
 captures needed lexical bindings. When the closure is called (applied
 to arguments), a new lexical environment is created to contain the
 bindings of the arguments and that new environment is linked to the
 one used in the definition of the function (points to). So, if we use
 a variable in the body of the function, we look first in the new
 environment and then in the other environment.

 There could be a chaining of lexical environments.

 There is an elegant notation to describe that process called
 Weizenbaum notation but I was not able to find any source on it on
 the Web. I used that when I studied Scheme in school, back in 97. If
 anynone has got information on it, I would be glad. I guess it is
 related to Joseph Weizenbaum.
 We had, a control environment, an access environment, a form to be
 evaluated and bindings in the current environment (terms translated
 from french as the course was given in french). All in a concise
 Weizenbaum frame.

 Does it work the same in Clojure ? Or maybe someone could point me to
 the source file ou source files where I can find that information.

 TIA,

 Ludovic Kuty

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: require macro/function [was clojure.contrib.[duck-streams io]]

2010-02-03 Thread Stuart Sierra
On Feb 2, 8:40 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:
 SS: is require* an acceptable name for the function version?

I don't care what it's called so long as there's a function there.
While we're at it, I want import* back as a function.

-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: building clojure-contrib without downloading clojure.jar from elsewhere

2010-02-03 Thread Stuart Sierra
On Feb 3, 2:03 am, Ramakrishnan Muthukrishnan vu3...@gmail.com
wrote:
 I hope this will be added back into the repo soon.

It's in now.
-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: building clojure-contrib without downloading clojure.jar from elsewhere

2010-02-03 Thread Stuart Sierra
On Feb 3, 1:20 pm, Ramakrishnan Muthukrishnan vu3...@gmail.com
wrote:
 I uploaded clojure-contrib 1.1 debian package into the debian repos.

I hope that's the 1.1 release, not the current github master.

-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: clojure.contrib.[duck-streams io]

2010-02-02 Thread Stuart Sierra
On Feb 2, 2:46 am, ataggart alex.tagg...@gmail.com wrote:
 On a related note, it is my sincere hope that we get a version of
 require and use which no longer require (ha!) the use of quoted
 parens.

Absolutely not!  Having 'require' as an ordinary function (not a
macro) is important for code-generating code.

-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: building clojure-contrib without downloading clojure.jar from elsewhere

2010-02-02 Thread Stuart Sierra
Try adding the -o (for offline) option to the Maven command line.

-SS

On Feb 2, 6:20 am, Ramakrishnan Muthukrishnan vu3...@gmail.com
wrote:
 Hi,

 I am trying to package clojure-contrib for Debian and one of the
 debian java packaging practices is that the build should not download
 any external dependencies. All the dependencies should be debian
 packages themselves.

 I tried building clojure-contrib with mvn -Dclojure.jar=path to
 locally built clojure.jar as detailed in the README.txt, but maven
 seem to ignore this and download the jar from the build server. To
 replicate this, please try removing
 ~/.m2/repository/org/clojure/clojure directory. I also tried passing
 the -o flag to maven, but it fails to take the local clojure.jar file.
 I am very new to java build systems like maven, so it is very likely
 that I am missing something. I will be happy to try out any
 suggestions I can get from here.

 thanks
 --
   Ramakrishnan

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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.[duck-streams io]

2010-02-02 Thread Stuart Sierra
On Feb 1, 9:23 pm, OGINO Masanori masanori.og...@gmail.com wrote:
 Can I write a code on both 1.1 and master using duck-streams/io?

For now, yes, as ataggart showed.  But I expect names in contrib will
be in flux for the next few weeks, so you should probably pick a
release and stick with it.

-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: Alternate Javadocs?

2010-02-02 Thread Stuart Sierra
On Feb 2, 11:42 am, Sean Devlin francoisdev...@gmail.com wrote:
 Does someone know of an alternate place to find Javadocs?

You can (or could) download all the JDK docs as a ZIP.  And lots of
places, like university CS departments, mirror the JDK docs.  There
are several meta-javadoc search engines, but I find them annoyingly
slow.

-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: building clojure-contrib without downloading clojure.jar from elsewhere

2010-02-02 Thread Stuart Sierra
On Feb 2, 2:42 pm, Rob Wolfe r...@smsnet.pl wrote:
 In order to use command like this:

 mvn -Denv=local -Dclojure.jar=/path/to/clojure.jar package

 there are needed two things:

 1. maven profile, which will be activated by -Denv=local
 2. dependency defined with system scope and systemPath

Whoops, that was in the POM but got deleted in one of the commits.  I
will re-add it.

-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: clojure.contrib compile fail

2010-02-01 Thread Stuart Sierra
On Feb 1, 10:53 am, Jeff Schwab j...@schwabcenter.com wrote:
 Thanks.  I see that you made an end-run around Maven.  I didn't know you
 could use gen-class that way.

It's more an end-run around gen-class than around Maven.

gen-class is an ordinary macro; it can be used anywhere, not just in
ns declarations.

Putting all the gen-class directives in a separate file is a technique
I have used before to make sure that the classes get generated in the
right order.

-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


Contrib library renames

2010-02-01 Thread Stuart Sierra
As the first stage in a much-needed code cleanup, the following
changes are now on the master branch of clojure-contrib:

* Rename c.c.str-utils3 = c.c.string
* Rename c.c.duck-streams = c.c.io
* Rename c.c.java-utils = c.c.java
* Rename c.c.seq-utils = c.c.seq
* Rename c.c.shell-out = c.c.shell

* Delete c.c.str-utils and c.c.str-utils2 (both replaced by c.c.string)
* Delete c.c.json.read and c.c.json.write (both replaced by c.c.json)

* Rename all test namespaces like clojure.contrib.test-**

All internal uses of these namespaces should be correct, and all tests
pass.  Please report any problems.

If you need the old names, please use the 1.1.0 release of
clojure-contrib, available via build.clojure.org and Google Code.

-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: clojure.contrib compile fail

2010-01-31 Thread Stuart Sierra
This has been fixed now.
-SS

On Jan 30, 9:07 am, Jeff Schwab j...@schwabcenter.com wrote:
 Hi:

 What is the right place to report a clojure-contrib compile failure, or
 to look for information?

 The clojure-contrib I just pulled from github fails to compile, with an
 error that the ColumnWriter class extended by PrintWriter is not found.
   The relevant source directory does define ColumnWriter.  I tried
 twiddling my CLASSPATH, but it made no difference.  Googling the error
 turns up the following page, which shows exactly the same problem I'm
 seeing, but with no links, bug reports, or further information:

      http://paste.lisp.org/display/94135

 My best SWAG is that ColumnWriter needs to be compiled before
 PrintWriter, and that the dependence on ordering creates a race
 condition, such that the error appears on some platforms but not others.
   I tried passing file and namespace names to maven, trying to adjust
 the build order, but maven just sneered at me.  Any ideas?

 Thanks,
 Jeff

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: help with serializing/deserializing structs

2010-01-26 Thread Stuart Sierra
On Jan 26, 11:40 am, jleehurt jleeh...@gmail.com wrote:
 Thanks Anders. I'm not sure why, but it appears that read does not
 support structmaps.

That is correct, read does not work with structmaps, because it
doesn't know how to resolve the struct definition while reading.

deftype, the replacement for structmaps, solves that problem.

-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


Final releases for clojure-contrib 1.0.0 and 1.1.0

2010-01-25 Thread Stuart Sierra
Hello all,

We are finally ready to release clojure-contrib 1.0.0 and 1.1.0!

Major/minor version numbers of contrib match major/minor version
numbers of Clojure.
So if you're using Clojure 1.0, use contrib 1.0.0;
if you're using Clojure 1.1, use contrib 1.1.0.

Get pre-built ZIP distributions from Google Code:
http://code.google.com/p/clojure-contrib/

Maven/Leiningen users, point to the release repository at:
http://build.clojure.org/releases

-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: Clojure for largish web application?

2010-01-23 Thread Stuart Sierra
I successfully used Clojure, Restlet, StringTemplate, and the Simple
servlet framework to handle all traffic on www.altlaw.org.  My scaling
requirements were a tad unusual -- only ~10,000 visitors per day, but
over a million pages.  This was all on a single EC2 small instance,
also running Solr.

-SS


On Jan 22, 1:09 am, cperkins cperk...@medialab.com wrote:
 I've read that people have been able to use Clojure with some of the
 Java web 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: Dependency management

2010-01-23 Thread Stuart Sierra
On Jan 22, 11:58 pm, Richard Newman holyg...@gmail.com wrote:
 I foresee a future with a lot more time spent modifying other people's  
 project files.

This is the past, the present, and the forever-after of open-source
software development.

If you need lots of libraries, you need your own Maven repository with
your own builds, tweaked to work together.

-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: Dependency management

2010-01-22 Thread Stuart Sierra
On Jan 21, 8:21 pm, Richard Newman holyg...@gmail.com wrote:
 Apparently everyone is jumping on the Leiningen bandwagon and deleting  
 their build.xml files. I guess that means I'm moving, too.

Deleting build.xml files is good.  After that, you've got several
options, including Leiningen and clojure-maven-plugin, both of which
are based on the Maven dependency model.

 Now, I like to keep track of Clojure master. Right now, Clojure  
 reports Clojure 1.2.0-master-SNAPSHOT.

 (I don't see that in Maven Central or in Clojars, so I guess I have to  
 put it in my local repository...?)

Clojure and clojure-contrib have daily snapshots in a Maven repository
at http://build.clojure.org/snapshots

 Unfortunately, not everybody keeps up-to-date like I do; most of the  
 projects I use demand 1.1.0-alpha-SNAPSHOT. I'm sure there are still  
 projects that demand 1.0.

This is the problem of a young language and immature libraries.  You
may need to compile those projects yourself and install them in a
local repository.

-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: Question about Responsiveness of Garbage Collection

2010-01-21 Thread Stuart Sierra
On Jan 21, 3:20 am, Joonas Pulakka joonas.pula...@gmail.com wrote:
 In general, accusing garbage collection of being culprit for sluggish
 GUI performance is plain wrong. Swing GUIs can be quite snappy when
 done right - but surely there are lots of not-so-right done apps out
 there.

From my limited experience with Swing, coding techniques can make a
big difference.  There are a lot of poorly-written Swing apps out
there.  Get a good reference book to make sure you're doing it right.

-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: deftype implementing methods with multiple argument lists

2010-01-19 Thread Stuart Sierra
You can include multiple definitions of the same method, with
different arguments, in a deftype.

(deftype Foo [f]
  (bar [x] ...)
  (bar [x y] ...))

Don't know if that's intended, but it works.
-SS

On Jan 19, 3:50 pm, Konrad Hinsen konrad.hin...@fastmail.net wrote:
 Protocols permit the declaration of functions with multiple argument  
 lists:

 (defprotocol FooP
    (bar [x] [x y] ))

 It is straightforward to implement those using extend or extend-type:

 (deftype Foo
    [f] :as this)

 (extend-type ::Foo
    FooP
      (bar ([x] (:f x))
          ([x y] [(:f x) y])))

 However, I haven't found a way to implement them directly in the  
 deftype form. Is this possible? If so, how?

 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: clojure-contrib 1.1.0 Release Candidate 2

2010-01-11 Thread Stuart Sierra
On Jan 11, 4:33 am, Mark Derricutt m...@talios.com wrote:
 Stuart - are these RC builds available in any maven repository at all?

Tim Dysinger and I are working on setting up a release repository for
Clojure  contrib, sync'd to central.

-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: First meeting of the NYC Clojure Users Group is scheduled

2010-01-08 Thread Stuart Sierra
Also, everyone is welcome to join LispNYC on Tuesday, January 12 and
celebrate release 1.1 of Clojure!
-SS

 Join us Tuesday, January 12th from 7:00 to 9:00 at PG's for the first
 social of the year!

 Directions:

 Near the 1 stop at 79th and B,C stop at 81st.  Head to the northwest
 corner of 78th and Columbus then down the outdoor stairs.

 http://bit.ly/4qnMnK (Google map)
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Recommended JVM flags for Clojure

2010-01-07 Thread Stuart Sierra
I use -XX:+UseConcMarkSweepGC.  And don't forget -Xmx, just having a
bigger heap can solve some problems.  Some people have found it
necessary to increase the PermGen size, but usually only for programs
that generate a lot of functions dynamically.

-SS


On Jan 7, 4:20 am, Gabi bugspy...@gmail.com wrote:
 Hello fellow Clojurians,

 I got lots of java.lang.OutOfMemoryError: GC overhead limit exceeded
  exceptions ,and after a short investigation added the following
 flags (JVM 1.6.0_17):
 -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:
 +CMSIncrementalPacing

 These flags seems to solve the problem, but I am interested in your
 experience and best practices regarding JVM flags in clojure.

 I know it really depends on the type of the application, but it seems
 to me that the gc is working really hard under Clojure (I cannot prove
 it, this is just an impression)

 Gabi
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 1.1.0 Release Candidate 2

2010-01-07 Thread Stuart Sierra
We have a second Release Candidate for clojure-contrib version 1.1.

This avoids ticket #42, AOT compilation of clojure-contrib.jar
pre-sets logging implementation, by not AOT-compiling logging.clj.

-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

Release Candidates for clojure-contrib 1.0 and 1.1

2010-01-05 Thread Stuart Sierra
As announced yesterday on the dev list, I have created two release
candidates for clojure-contrib.

The idea is to get numbered contrib releases that match Clojure
version numbers.  So contrib 1.0 will work with Clojure 1.0 and
contrib 1.1 will work with Clojure 1.1.

This does NOT say anything about the quality/completeness of any
libraries in contrib.  These releases are just a convenience for
people who want to download a pre-compiled contrib without using git.

For 1.0.0:
http://clojure-contrib.googlecode.com/files/clojure-contrib-1.0.0-RC1.zip

For 1.1.0:
http://clojure-contrib.googlecode.com/files/clojure-contrib-1.1.0-RC1.zip

Please test these distributions out and report any errors in the
packaging or build.

-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: Proposal: clojure.io

2010-01-01 Thread Stuart Sierra
On Dec 31 2009, 9:58 pm, Phil Hagelberg p...@hagelb.org wrote:
 I wonder if it would be a good idea to include a clojure.io
 namespace in Clojure itself. I've mentioned the idea a few times on IRC,
 and people seemed to be very much in favour.

I've considered this too, but I know Rich Hickey has plans for a
dedicated I/O library.  It's been on http://clojure.org/todo for a
while.  Details are sketchy, but presumably it would be functional,
stream-based, and thread-safe.

The I/O contrib libs are mostly convenience wrappers around the
java.io classes and do not represent a well-thought-out API.  (I know
because I wrote some of them.)

-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


import as a macro; dynamic imports?

2010-01-01 Thread Stuart Sierra
I should have brought this up before 1.1 was released, but I'm
bothered by the change of clojure.core/import from a function to a
macro.

If I'm creating a namespace dynamically, I can't evaluate the name of
the class I want to pass to import.  The only way is to use
undocumented Java functions, like:

(defn import-name
  Import a class named c (a String) into namespace n.
  [n c]
  (.importClass n (clojure.lang.RT/classForName c)))

Of course, I can write a macro that evaluates the strings, but that's
not really what I want.  I want the equivalent of clojure.core/intern
for classes.  Is there a better way?

-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: Parenthesis Inference

2009-12-19 Thread Stuart Sierra
On Dec 18, 9:28 pm, Sean Devlin francoisdev...@gmail.com wrote:
 It is proudly a Lisp for people that want to get things done.  Any
 Java/.NET/Python/Brainfuck/Ruby/Basic/C/C++ (No Perlmongers :))

I was a Perlmonger back in the day.  :)

-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: 1.1 changes.txt typo

2009-12-19 Thread Stuart Sierra
On Dec 18, 9:03 am, David Thomas Hume dth...@gmail.com wrote:
 From the 1.1 release notes:

 Futures represent asynchronous computations. They are away to get
 code to run in another thread, and obtain the result.

That's been fixed now in the 1.1.x branch; thanks for the report.
-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: mapmap

2009-12-17 Thread Stuart Sierra
On Dec 17, 9:37 am, C. Florian Ebeling florian.ebel...@gmail.com
wrote:
 (defn mapmap
   Map values of map m using function f.
   [f m]
   (reduce (fn [m [k v]]
             (assoc m k (f v))) {} m))

 But there is probably a more straightforward way. What do you use?


I do that exactly, but I never felt the need to define a new function
for it.  The advantage of reduce is that you can change the keys
too, and pick which keys end up in the final map.

-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: How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread Stuart Sierra
In general, straight equality is efficient for Clojure data
structures.  For example, the equals() implementation for sets checks
type, size, and hash code before examining the set elements.
Determining that two sets are equal is still O(n), but determining
that they are NOT equal is usually O(1).

As for accessing the shared structure, that's definitely not trivial,
and would require digging into the Java sources.

-SS


On Dec 16, 8:53 am, Dragan Djuric draga...@gmail.com wrote:
 Hi,

 Here's the example of what I meant in the topic title:

 Let's say we have a set s1 that have 3 elements: #{obj1, obj2, obj3}
 I add a few elements to it and get s2 #{obj1, obj2, obj3, obj4, obj5}
 It is important to notice that, because s2 has been created by
 modifying s1, it reuses its structure, so these sets are related by
 the implementation with the persistent structures.

 Now, I can use difference function to get the difference (obj4, obj5),
 but it seems that this function needs to traverse all elements, which
 can be heavy if the collection stores thousands of elements.

 I have a hunch that, If the collections are somehow related by the
 fact that one collection is used in building the other one, that can
 be used as a hint in retrieving the difference. Is something like this
 possible in the current implementation and how to do it? I don't mind
 accessing persistent collections-related implementation-specific 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: book

2009-12-04 Thread Stuart Sierra
At the least, there will be a document describing the changes from 1.0
to 1.1.
-SS

On Dec 4, 9:27 am, .Bill Smith william.m.sm...@gmail.com wrote:
 I haven't been tracking all the changes in Clojure since the 1.0
 release.  Will there be a 1.1 version of the Clojure book?  It's one
 thing to read the API documentation, and something else to have enough
 context to know why a function or macro exists and when it is
 appropriate to use 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


Clojure User Survey, preparation for 1.1

2009-11-23 Thread the . stuart . sierra
If you have trouble viewing or submitting this form, you can fill it out  
online:
http://spreadsheets.google.com/viewform?formkey=dFJSd1p4YXh0d0VxV0xjdk42MTU5RkE6MA


Clojure User Survey


This user survey will help move Clojure toward an official 1.1 release.


How do you get Clojure? *

Download release
Github
Maven or Ivy


What distribution of Clojure do you use primarily? *

1.0 release
I picked one development snapshot and stuck with it
I use the latest development snapshot
I follow Github master branch
I follow Github new branch


What about chunked sequences? *

I don't know what they are
The help me
They hurt me
I don't notice any difference


Powered by Google Docs Report Abuse - Terms of Service - Additional Terms


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: leiningen - a Clojure build tool

2009-11-18 Thread Stuart Sierra
On Nov 18, 9:00 am, Sean Devlin francoisdev...@gmail.com wrote:
 (binding [*set-hair-on-fire* true]
   ;do-stuff)

I like this just for the Var name.
-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: Clojure Web Libraries

2009-11-17 Thread Stuart Sierra
On Nov 16, 8:03 pm, ngocdaothanh ngocdaoth...@gmail.com wrote:
 Could someone provide an example about using Clojure with Restlet?

 I found:http://github.com/stuartsierra/altlaw-clojure-restlet
 but don't understand how the code works as a web application.

It doesn't.  That's just a few helper functions I wrote to work with
Restlet.

To use Clojure with Restlet, you have to proxy or gen-class your own
implementations of its API classes like Restlet, Resource, Filter,
etc.

-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: Datatypes and Protocols - early experience program

2009-11-17 Thread Stuart Sierra
On Nov 16, 11:57 am, Jonas Enlund jonas.enl...@gmail.com wrote:
 I made count return the number of rows because that way (count
 a-matrix) == (count (seq a-matrix)). I don't know if it's the right
 thing to do, maybe rows*cols would make more sense.

Good point.  I don't know which is better.
-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: Datatypes and Protocols - early experience program

2009-11-16 Thread Stuart Sierra
On Nov 14, 8:28 am, Jonas Enlund jonas.enl...@gmail.com wrote:
 I have built a simple Matrix datatype with defprotocol and deftype.
 You can take a look at it athttp://gist.github.com/234535
 (constructive criticism welcome!).

Small thing: I would expect (count a-matrix) to return rows*columns,
not the number of rows.

-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: Clojure Web Libraries

2009-11-14 Thread Stuart Sierra
The latest restlet versions use annotations.  I stil use 1.1, which uses
ordinary classes.  I'm bothered by restlet's move to annotations, but
hoefully the old API is still available.

sent from my phone

On Nov 14, 2009 10:58 PM, ngocdaothanh ngocdaoth...@gmail.com wrote:

Hi Stuart,

Can you elaborate on Restlet? After some short investigation I think
it uses annotation but Clojure does not support it, so Clojure is not
Restlet-ready.

Thanks


On Jan 23, 1:44 am, Stuart Sierra the.stuart.sie...@gmail.com wrote:
 Hi Frank,
 I'd also recommend looking atRestlethttp://www.restlet.org/ and
 the Java Servlets API.
 -Stuart Sierra

 On Jan 21, 4:39 pm, Frank ffai...@gmail.com wrote:

  Hi,

  I am interested in trying to use Clojure to develop web-based
  applications.  Can someone point me to any Clojure libraries that have
  been written that I can use.  Thanks.

  Frank

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Datatypes and Protocols - early experience program

2009-11-13 Thread Stuart Sierra
On Nov 12, 7:10 am, Rich Hickey richhic...@gmail.com wrote:
 An early version of the code for a few important new language
 features, datatypes[1] and protocols[2]

Very simple example here: http://paste.lisp.org/display/90329

This shows how to do arithmetic with complex numbers using deftype and
defprotocol.  It does not support mixing complex and real numbers; not
sure how that would work.

-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


<    3   4   5   6   7   8   9   10   11   12   >