Re: a function to list the namespaces that a namespace refers to ...

2010-10-31 Thread ka
Hi, not sure if this is useful for you - http://github.com/na-ka-na/cdeps.

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

2010-10-31 Thread ka
Few months back I started working on a project which already had 10k
lines of Clojure code.  There were already ~75 namespaces (not
including tests).  I was searching for a tool which would quickly give
me a high level overview of the code - how do the packages depend on
each other, which namespaces are high level and which ones low level
etc. In short I wanted a pretty graph of namespace dependencies for my
project.

Somebody pointed me to http://github.com/hugoduncan/lein-namespace-depends,
but I couldn't get it to work.

So thinking it a good exercise, I wrote a little utility which
generates namespace (and package) dependency graphs at various levels
- complete src, single ns, single package.  Additionally the graph
itself is available in many forms - Clojure map, .xml, .dot, .png

The code itself is a bit ugly & old but it works on both unix and
windows - http://github.com/na-ka-na/cdeps.  Checkout the examples/
directory to see some images.

Hopefully someone finds it useful.

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

2010-10-31 Thread zkim
Enlive (also Christophe Grand's) is definitely a project you'll want
to check out: http://github.com/cgrand/enlive

Pairing enlive with David Nolan's tutorial (http://github.com/
swannodette/enlive-tutorial/) allows you to consume the codebase in
bite-sized pieces (read about a feature in the tutorial, go see how
it's implemented, repeat).

On a personal note, enlive (along with Stu's book and Rich's 'Are We
There Yet' video) are what really got me hooked early on.

-Zack

On Oct 31, 4:57 pm, Daniel Werner 
wrote:
> I'd consider the following projects:
>
> Compojure is written in an almost purely functional style and
> demonstrates well how Clojure values can act almost as their own DSLs
> while keeping the semantics clear and 
> concise.http://github.com/weavejester/compojure
>
> Christophe's Regex lib shows how to use Datatypes and Protocols to
> build an extensible mini-language for readable, composable regexes in
> Clojure.http://github.com/cgrand/regex
>
> Ring contains a lot of Java interop that (upon the short glance I
> took) seems to be clearly factored out into their own modules, while
> the other modules manage to stay functional.http://github.com/mmcgrana/ring
>
> Clojure Contrib is an invaluable repository of well-written code, but
> you may have to dig around a bit to find bits that are comparable to
> the code you're trying to write. (Lots of different use cases there,
> e.g. JMX, monads, etc.)
>
> 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: figuring out sets

2010-10-31 Thread Shantanu Kumar
Or just this:

user=> (set [1 2 3 4 5 8 8 9 6 6 4])
#{1 2 3 4 5 6 8 9}

On Nov 1, 8:11 am, Shantanu Kumar  wrote:
> You can write something like this:
>
> user=> (into #{} [1 2 3 4 5 8 8 9 6 6 4])
> #{1 2 3 4 5 6 8 9}
>
> Cheers,
> Shantanu
>
> On Nov 1, 7:55 am, tonyl  wrote:
>
>
>
>
>
>
>
> > I guess I should've look harder (and ask more in the irc ;) it is a
> > data structure and has a set fn too. #{} is just a reader macro for
> > syntactic sugar. And the difference of usage between sets and vectors
> > are they sets can't have duplicates.
> > This is great, clojure group with irc chat, good learning.
>
> > On Oct 31, 9:35 pm, tonyl  wrote:
>
> > > I've been wondering if sets are actually a defined data structure like
> > > vectors and maps or are they a result of an expansion of the dispatch
> > > macro? I was wondering since it uses the dispatch macro and AFAIK
> > > there is no api fn to create them like hash-maps to create maps,
> > > vector/vec for vectors, or list for lists.
>
> > > Another thing I am trying to figure out is, are they really needed?
> > > vectors seem to fill in anytime sets could be used, unless I am
> > > missing something here.
>
> > > Any information would be appreciated.

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


Re: figuring out sets

2010-10-31 Thread David Sletten
>From a mathematical perspective the essential aspect of a set is its 
>extension, namely what elements are contained in the set. This leads 
>immediately to the property of uniqueness you mentioned. But the fundamental 
>operation is 'contains?'. In other words, does the set contain some object or 
>not? 

In order to search a vector to answer this question we have to perform a linear 
search. Thus, the longer the vector, the longer this search could take. In 
Clojure, sets are ultimately constructed out of hash tables, which allows a 
constant time check to see whether an object is a key and therefore a member of 
the set. The fact that the keys in a hash table are unique is a useful side 
benefit, but I believe that an efficient 'contains?' method is the main reason 
for their choice.

All of the other set operations (union, intersection, etc...) are derived from 
our ability to determine whether or not an element is present in some set.

In case you haven't found it yet, there is a section on Sets on the data 
structures page:
http://clojure.org/data_structures
Note especially that you have a choice between hash-set and sorted-set.

Also check out the documentation for clojure.set:
http://clojure.github.com/clojure/clojure.set-api.html

Have all good days,
David Sletten



On Oct 31, 2010, at 10:55 PM, tonyl wrote:

> I guess I should've look harder (and ask more in the irc ;) it is a
> data structure and has a set fn too. #{} is just a reader macro for
> syntactic sugar. And the difference of usage between sets and vectors
> are they sets can't have duplicates.
> This is great, clojure group with irc chat, good learning.
> 
> On Oct 31, 9:35 pm, tonyl  wrote:
>> I've been wondering if sets are actually a defined data structure like
>> vectors and maps or are they a result of an expansion of the dispatch
>> macro? I was wondering since it uses the dispatch macro and AFAIK
>> there is no api fn to create them like hash-maps to create maps,
>> vector/vec for vectors, or list for lists.
>> 
>> Another thing I am trying to figure out is, are they really needed?
>> vectors seem to fill in anytime sets could be used, unless I am
>> missing something here.
>> 
>> Any information would be appreciated.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


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

2010-10-31 Thread Shantanu Kumar
You can write something like this:

user=> (into #{} [1 2 3 4 5 8 8 9 6 6 4])
#{1 2 3 4 5 6 8 9}

Cheers,
Shantanu

On Nov 1, 7:55 am, tonyl  wrote:
> I guess I should've look harder (and ask more in the irc ;) it is a
> data structure and has a set fn too. #{} is just a reader macro for
> syntactic sugar. And the difference of usage between sets and vectors
> are they sets can't have duplicates.
> This is great, clojure group with irc chat, good learning.
>
> On Oct 31, 9:35 pm, tonyl  wrote:
>
>
>
>
>
>
>
> > I've been wondering if sets are actually a defined data structure like
> > vectors and maps or are they a result of an expansion of the dispatch
> > macro? I was wondering since it uses the dispatch macro and AFAIK
> > there is no api fn to create them like hash-maps to create maps,
> > vector/vec for vectors, or list for lists.
>
> > Another thing I am trying to figure out is, are they really needed?
> > vectors seem to fill in anytime sets could be used, unless I am
> > missing something here.
>
> > Any information would be appreciated.

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


Re: figuring out sets

2010-10-31 Thread tonyl
I guess I should've look harder (and ask more in the irc ;) it is a
data structure and has a set fn too. #{} is just a reader macro for
syntactic sugar. And the difference of usage between sets and vectors
are they sets can't have duplicates.
This is great, clojure group with irc chat, good learning.

On Oct 31, 9:35 pm, tonyl  wrote:
> I've been wondering if sets are actually a defined data structure like
> vectors and maps or are they a result of an expansion of the dispatch
> macro? I was wondering since it uses the dispatch macro and AFAIK
> there is no api fn to create them like hash-maps to create maps,
> vector/vec for vectors, or list for lists.
>
> Another thing I am trying to figure out is, are they really needed?
> vectors seem to fill in anytime sets could be used, unless I am
> missing something here.
>
> Any information would be appreciated.

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


figuring out sets

2010-10-31 Thread tonyl
I've been wondering if sets are actually a defined data structure like
vectors and maps or are they a result of an expansion of the dispatch
macro? I was wondering since it uses the dispatch macro and AFAIK
there is no api fn to create them like hash-maps to create maps,
vector/vec for vectors, or list for lists.

Another thing I am trying to figure out is, are they really needed?
vectors seem to fill in anytime sets could be used, unless I am
missing something here.

Any information would be appreciated.

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


Re: REQUEST for feedback on http://clojure.org

2010-10-31 Thread Alex Miller
Sam
- I've added the Cambridge Clojurians

Phil
- I've added Seajure
- I've added a link from the contributing page to the patches page -
great suggestion!
- On libraries -> noted, I am building a list of stuff to discuss
further with the core team

Sean
- no, there is no rationale for the ordering on the community page. I
have that on my list of things to overhaul.  I have taken a note on
geographic ordering which makes perfect sense.

Shantanu
- added the Bangalore group
- jobs -> noted
- libraries -> noted your link

all
- I updated the cheat sheet to the 1.2 version and I'll link it when I
next have some time to work on it

Alex

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


defmethod hangs

2010-10-31 Thread Jarl Haggerty
I'm not sure what to do here, my program hangs at the following
defmethod.  all my brackets seem to be balanced and I'm not receiving
any errors about undefined symbols.  This sample prints 2 but never
gets to 3, (my poor man's debugging).  This code is for the collision
detection is a physics engine in clojure, I imagine it might be hard
to understand(I'm hoping somebody could simply give some reasons why a
program would just hang like this) , but shape is a concave polygon,
plane is a plane(really just a line in my implementation), and :points
is a counter-clockwise list of points.  The search function basically
searches for the one or two points on the shape which create the
extremes of the projection interval.  The result is a structure that
consists of the edges of the interval and the points on those edges.
I've also redefined the math functions to work with vectors and
matrices.

(defstruct projection-struct :start :stop :start-points :stop-points)
(println 1)
(defmulti projection #(:type (meta %)))
(println 2)
(defmethod projection :polygon [shape plane]
   (let [search (fn [condition]
  (loop [accum 0 step (inc (int  (/ (count
(:points shape)) 2))) from -1]
(condp condition (dot plane (accum
(:points shape)))

  (dot plane ((mod (+ accum step) (count
(:points shape))) (:points shape)))
  (if (= from (+ accum step))
[(dot plane ((mod (+ accum step)
(count (:points shape))) (:points shape)))
 [(from (:points shape)) (accum
(:points shape))]]
(recur (mod (+ accum step) (count
(:points shape))) (inc (int (/ step 2))) accum))

  (dot plane ((mod (- accum step) (count
(:points shape))) (:points shape)))
  (if (= from (- accum step))
[(dot plane ((mod (- accum step)
(count (:points shape))) (:points shape)))
 [(from (:points shape)) (accum
(:points shape))]]
(recur (mod (- accum step) (count
(:points shape))) (inc (int (/ step 2))) accum))

  [(dot plane (accum (:points shape)))
   [(accum (:points shape))]])))
 front (search <=)
 back (search >=)]
 (struct projection-struct (first front) (first back)
(second front) (second back
(println 3)

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

2010-10-31 Thread Daniel Werner
I'd consider the following projects:

Compojure is written in an almost purely functional style and
demonstrates well how Clojure values can act almost as their own DSLs
while keeping the semantics clear and concise.
http://github.com/weavejester/compojure

Christophe's Regex lib shows how to use Datatypes and Protocols to
build an extensible mini-language for readable, composable regexes in
Clojure.
http://github.com/cgrand/regex

Ring contains a lot of Java interop that (upon the short glance I
took) seems to be clearly factored out into their own modules, while
the other modules manage to stay functional.
http://github.com/mmcgrana/ring

Clojure Contrib is an invaluable repository of well-written code, but
you may have to dig around a bit to find bits that are comparable to
the code you're trying to write. (Lots of different use cases there,
e.g. JMX, monads, etc.)

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: REQUEST for feedback on http://clojure.org

2010-10-31 Thread Shantanu Kumar
Thanks, this is neat! My input is inline.

On Oct 31, 7:38 am, Alex Miller  wrote:
> Hi all,
>
> I'm doing a bit of doc cleanup onhttp://clojure.organd I'd welcome
> your feedback on things that are broken or could be improved.  I'm not
> looking (or likely authorized :) to make any drastic changes but if
> there are things that you have run into, please drop a line here or in
> email to alexdmiller at yahoo.com.  Ideally, I'd like people to be
> logging tickets in jira, but I'm not sure it's quite ready for that
> yet.
>
> Some recent changes I've already made:
> - switched all of the old richhickey github references to clojure
> - cleaned up some factually wrong or out of date stuff on getting
> started and download pages
> - added Protocol and Datatypes pages to left nav (the pages have
> existed for 6 months)
> - added a page on starting a user group (still in review, not yet
> linked)
> - currently working on updating the cheat sheet to the 1.2 version
> (and adding links!)
>
> I'm particularly interested in:
> - new user groups or suggestions for the community page

Bangalore Clojure group: http://groups.google.com/group/bangalore-clj

> - stuff that is just wrong or out of date

The jobs page: http://clojure.org/Jobs

The libraries page: http://clojure.org/libraries
IMHO we need something like http://java-source.net/ for Clojure.

Regards,
Shantanu

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


Re: REQUEST for feedback on http://clojure.org

2010-10-31 Thread Sean Corfield
On Sat, Oct 30, 2010 at 7:38 PM, Alex Miller  wrote:
> Some recent changes I've already made:
> - switched all of the old richhickey github references to clojure

Yay!

> I'm particularly interested in:
> - new user groups or suggestions for the community page

I'm curious - is there any rationale for the order of user groups
listed at the moment?

I think it would be nice to have it arranged by region or country
(with online groups listed under a separate heading) and then
alphabetically by state and/or city within each region or country.
It's kinda hard to find if a group is near your location right now
(I'm OK, I have the wonderful Bay Area group to attend - thanx Amit!).
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

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

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


Re: REQUEST for feedback on http://clojure.org

2010-10-31 Thread Phil Hagelberg
On Sat, Oct 30, 2010 at 7:38 PM, Alex Miller  wrote:
> I'm doing a bit of doc cleanup on http://clojure.org and I'd welcome
> your feedback on things that are broken or could be improved.  I'm not
> looking (or likely authorized :) to make any drastic changes but if
> there are things that you have run into, please drop a line here or in
> email to alexdmiller at yahoo.com.  Ideally, I'd like people to be
> logging tickets in jira, but I'm not sure it's quite ready for that
> yet.

Thanks for taking this up.

- It seems like the "contributing" page should link to "patches".
- I've asked a couple times to get Seajure on
http://clojure.org/community; perhaps this could be moved to
Confluence so it can be more readily edited.
- I kind of get the feeling that http://clojure.org/libraries could
afford to be removed in favour of a link to Clojars; having these all
in one place kind of gives the impression of a rather immature
ecosystem.

-Phil

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


Re: REQUEST for feedback on http://clojure.org

2010-10-31 Thread Sam Aaron
Hi Alex,

thanks for doing this - it's much appreciated.

w.r.t. user groups for the community page, you might want to mention the 
Cambridge Clojurians http://www.meetup.com/Cambridge-Clojurians/

Sam

---
http://sam.aaron.name

On 31 Oct 2010, at 2.38 am, Alex Miller wrote:

> Hi all,
> 
> I'm doing a bit of doc cleanup on http://clojure.org and I'd welcome
> your feedback on things that are broken or could be improved.  I'm not
> looking (or likely authorized :) to make any drastic changes but if
> there are things that you have run into, please drop a line here or in
> email to alexdmiller at yahoo.com.  Ideally, I'd like people to be
> logging tickets in jira, but I'm not sure it's quite ready for that
> yet.
> 
> Some recent changes I've already made:
> - switched all of the old richhickey github references to clojure
> - cleaned up some factually wrong or out of date stuff on getting
> started and download pages
> - added Protocol and Datatypes pages to left nav (the pages have
> existed for 6 months)
> - added a page on starting a user group (still in review, not yet
> linked)
> - currently working on updating the cheat sheet to the 1.2 version
> (and adding links!)
> 
> I'm particularly interested in:
> - new user groups or suggestions for the community page
> - stuff that is just wrong or out of date
> 
> This DOES NOT include stuff in the API or Contrib autodoc pages.
> Please raise those issues or file tickets on those but that's not what
> I'm focusing on at the moment.
> 
> Alex
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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

2010-10-31 Thread Quzanti
The Compojure project interacts with templating languages and web
servers (presumably). Don't know about databases. The design is
elegant and idiomatic.

http://github.com/weavejester/compojure/wiki

On Oct 31, 3:49 am, Alex Baranosky 
wrote:
> Hi all,
>
> I've read Programming Clojure, and written a toy app in it to get my
> feet wet.  I also listen in on this Google group from time to time as
> well, to get more of a sense of the language.
>
> I enjoyed "Programming Clojure" by Stuart Halloway, but it didn't
> leave me with a clear idea of how to go out and write a 'real'
> application.  What I'd really like to see is an example of code that
> uses all of Clojure's features so I can see how they all fit together
> in the wild, when you need to interact with templating languages,
> databases, and web servers.
>
> Are there any projects on GitHub you consider a great example of
> this?  One that I could read through and imitate to really glean some
> useful understanding of how all the great pieces of Clojure work
> together on a project?
>
> Thanks for your help,
> Alex

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


[ANN] rinzelight 0.0.3

2010-10-31 Thread Sergio Arbeo Rodríguez
Hi there,

rinzelight 0.0.3 is out! In this release you'll find:

* Lookup Tables
* Affine Transformations
* Composing images
* Color rescale
* Cropping images
* Color histograms
* Contrast stretching
* Edge effect.
* Negate effect.
* Normalize effect
* Support for rendering hints
* Gravities.

And the more important feature of all: documentation! Find it here:

http://github.com/Serabe/rinzelight/wiki

Cheers,

Sergio

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

2010-10-31 Thread Sam Roberton
> (defrecord Foo [properties]
>   Fooable
>   (foo [f]
>     (let [s (java.util.HashSet.)]
>      (doto s
>    (doseq [p properties] (.add s p))
>
> When I load/reload the above code in the repl I get this error
>
>  vector for its binding (config.clj:22)>

The problem is the way you're calling doto, not the defrecord.  If you
macroexpand the doto, you'll get something like:

(clojure.core/let [G__1646 s] (doseq G__1646 [p properties] (.add s p)) G__1646)

doto puts your 's' as the first argument in all the forms.  So the
first argument to doseq is no longer your binding vector, and so doseq
doesn't like it.

> If I change my defrecord to,
>
> (defrecord Foo [properties]
>   Fooable
>   (foo [f]
>     (let [s (java.util.HashSet.)]
>      (doto s (add-props s properties)

This macroexpands to something like:

(clojure.core/let [G__1649 s] (add-props G__1649 s properties) G__1649)

That's not quite what you want either, because the set gets passed to
add-props twice.

You want:

(defrecord Foo [properties]
  Fooable
  (foo [f]
(let [s (java.util.HashSet.)]
 (doto s (add-props properties)

Or, more concisely:

(defrecord Foo [properties]
  Fooable
  (foo [f]
 (doto (java.util.HashSet.) (add-props properties

But there's also a typo in your add-props:  the (.add p) needs to
become (.add s p)

Then again, you may just want (set properties) instead of the whole
doto thing, to save yourself the effort!

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

2010-10-31 Thread Eric Lavigne
This application was created as a teaching example for the Pragmatic
Studio Clojure workshops, taught by Stuart Halloway and Rich Hickey.
It includes examples of all the issues you are talking about.

 http://github.com/relevance/labrepl

As far as real applications go, this is a small application that is
still quite useful.

 http://try-clojure.org/

It creates a Clojure REPL in your web browser, and I often point to it
when someone wants to try Clojure for the first time. They are more
likely to follow through if they get instant gratification and don't
need to download anything at first. The source code is here:

 http://github.com/Raynes/tryclojure

I hope that you find what you're looking for.


On Sat, Oct 30, 2010 at 11:49 PM, Alex Baranosky
 wrote:
> Hi all,
>
> I've read Programming Clojure, and written a toy app in it to get my
> feet wet.  I also listen in on this Google group from time to time as
> well, to get more of a sense of the language.
>
> I enjoyed "Programming Clojure" by Stuart Halloway, but it didn't
> leave me with a clear idea of how to go out and write a 'real'
> application.  What I'd really like to see is an example of code that
> uses all of Clojure's features so I can see how they all fit together
> in the wild, when you need to interact with templating languages,
> databases, and web servers.
>
> Are there any projects on GitHub you consider a great example of
> this?  One that I could read through and imitate to really glean some
> useful understanding of how all the great pieces of Clojure work
> together on a project?
>
> Thanks for your help,
> Alex
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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


error with doseq in defrecord function

2010-10-31 Thread John Sanda
I am getting an error when trying to call doseq from within a defrecord
function, but I do not get the error with the same code outside of the
defrecord. Here is an example:

(defprotocol Fooable
  (foo [this]))

(defn add-props [s properties] (doseq [p properties] (.add p)))

(defrecord Foo [properties]
  Fooable
  (foo [f]
(let [s (java.util.HashSet.)]
 (doto s
   (doseq [p properties] (.add s p))

When I load/reload the above code in the repl I get this error



If I change my defrecord to,

(defrecord Foo [properties]
  Fooable
  (foo [f]
(let [s (java.util.HashSet.)]
 (doto s (add-props s properties)

I no longer get the compiler error. Can someone explain to me why I get this
error?

Thanks

- John

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

Re: Can't locate str_utils in classpath

2010-10-31 Thread Mike Meyer
On Sun, 31 Oct 2010 00:09:31 -0700 (PDT)
Steven Arnold  wrote:

> That was it.  I had to add the entire path up to and including to
> contrib jar in order for "clj" to work.  Merely adding the directory
> to the classpath was not sufficient, and the clj script ignored the
> value of my env variable $CLASSPATH, so I had to edit the clj script
> itself to get this working.

Hi Steve,

You ought to be able to add "path/to/directory/\*" to your CLASSPATH
to pick up all the jars in the directory. The "*" needs to be quoted
to show up in the variable, and not expanded by the shell.  This works
on Unix and Windows, so it ought to work on OSX.

If you're interested in how to work with clojure with minimal Java
infrastructure, I posted my writeup at
http://www.mired.org/home/mwm/papers/simple-clojure.html

 http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

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


Re: Can't locate str_utils in classpath

2010-10-31 Thread Steven Arnold
That was it.  I had to add the entire path up to and including to
contrib jar in order for "clj" to work.  Merely adding the directory
to the classpath was not sufficient, and the clj script ignored the
value of my env variable $CLASSPATH, so I had to edit the clj script
itself to get this working.

steven

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

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