Docstring state deftype, defrecord etc. are still alpha?

2012-06-16 Thread László Török
Hi,

I was reviewing some of the docstrings of programming constructs in the
clojure.core namespace.
I noticed that deftype and defrecord is still marked as "alpha, subject to
change". These features have been introduced in 1.2, is this correct?

Also, transients, introduced in 1.1, still alpha?

Thanks!

-- 
László Török

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

2012-06-16 Thread Jim - FooBar();
It would be nice to have the option to supply the keys to 
'inspect-table' just in case the first element is nil...this is exactly 
the behaviour of 'clojure.pprint.print-table' where  providing the keys 
is indeed an option. Both will fail when the first element is nil but at 
least 'print-table' allows us to provide the keys in advance...


Jim

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

2012-06-16 Thread Warren Lynn


On Saturday, June 16, 2012 12:47:03 AM UTC-4, Alan Malloy wrote:
>
> (map consume (seque (produce-lazily)))
>
>
Thank you! This is not exactly what I want (my input data is pushed from an 
external Java framework), but I was not aware there is a "seque" function, 
which might be useful for my other use cases.

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

2012-06-16 Thread Zhitong He
try lamina? https://github.com/ztellman/lamina/

On Sat, Jun 16, 2012 at 9:44 AM, Warren Lynn  wrote:
>
> What I want to do is something I probably have done dozens of times in C++:
> two threads, one thread putting items in a queue, another taking it out
> (FIFO). How to do it in Clojure? I am at a loss. I thought about a few
> options:
>
> 1. "watches", but it cannot change the queue itself (can only watch). plus,
> I am not sure watch function will run in another thread
> 2. "agent", but how to notify the consumer thread when there is new item?
> How to block the consumer thread when there is no items in the queue?
> 3.  Ping-pong promises: so the producer delivers a promise to the consumer,
> and the consumer immediately deliver another promise to the producer to
> acknowledge the receipt so the producer can move on. But that will prevent
> the producer to put the next item into the queue before the consumer finish
> its processing, so not exactly concurrent.
>
> I cannot believe I am the first one to encounter this. Can anyone suggest
> some idiomatic solution for the above? Thank you.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
Zhitong He
Sun Yat-sen University

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


How to go about finding a Clojure job

2012-06-16 Thread Timothy Baldridge
I'm about to begin the process of looking for a new job, and would
like to find one that focuses on Clojure. Can anyone suggest some good
ways to go about this? It seems like posting my resume on this mailing
list would be a bit off-topic.

As far as location goes, I'm looking in the Denver, CO area, but am
also open to 100% telecommute.


Thanks,

Timothy Baldridge

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

2012-06-16 Thread Michael Fogus
Great news. Let me know what you find (or don't find).

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

2012-06-16 Thread octopusgrabbus
Thank you. That clears things up quite a bit, when you said another library.

On Friday, June 15, 2012 10:30:04 AM UTC-4, Walter Tetzner wrote:
>
> On Friday, June 15, 2012 10:01:24 AM UTC-4, octopusgrabbus wrote:
>>
>> The reason why I asked this question is this code looks like it's using 
>> another csv library, so I'm confused.
>>
>
> That's because it is using another csv library: 
> https://github.com/clojure/data.csv.
>
> clojure-csv: https://github.com/davidsantiago/clojure-csv
>
>

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

Scheme dotted pair equivalent in Clojure

2012-06-16 Thread octopusgrabbus
I have a need to learn enough scheme to read it and write a few functions. 
I came across dotted pair notation. I am trying to grok it in terms of the 
only Lisp I know, Clojure. Does dotted pair notation in Scheme compare to  
form in Clojure, and if so, how?


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

2012-06-16 Thread David Nolen
Not possible in Clojure and a source of hassle in Scheme and Common Lisp.
If you have dotted pairs you can never know if you have a proper list.

David

On Sat, Jun 16, 2012 at 11:35 AM, octopusgrabbus
wrote:

> I have a need to learn enough scheme to read it and write a few functions.
> I came across dotted pair notation. I am trying to grok it in terms of the
> only Lisp I know, Clojure. Does dotted pair notation in Scheme compare to
> form in Clojure, and if so, how?
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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: A tutorial for how to setup your clojure development environment for: Emacs, Leiningen and Linux.

2012-06-16 Thread fenton

>
> Sorry to be an absolute pain, but could we not have a single page that
> has (almost everything) that a newbie might want to know.  Can't we be
> a bit opinionated, like: 
>
> editor: emacs
> builder: leiningen
> repl: swank
> emacs packages: clojure-mode, paredit, highlight-parens, autocomplete, 
> ac-slime
>
> Newbies don't want choices for options they don't understand.  Can we
> decide on a canonical (or several canonical) solutions.  Like
> packaging.  When they get more advanced and want to swap components
> out, great.  Maybe clojure-mode isn't the place for this.  Can we
> create a repo that is for this type of thing?  By we I mean Phil or
> Sean, since you guys are known to the community.  I picture a single
> page for each of these canonical setups, so the user doesn't have to
> click somewhere else.  A page that brings it all together.  People go
> buy books for this type of thing.  They don't want the book saying:
> "Now go buy this other book for this step in the process".
>
> What I'm really asking for is does the community (anyone) see value in 
> this type of thing, and if so can we create a github repo dedicated to the 
> purpose?
>

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

2012-06-16 Thread octopusgrabbus
Thanks for answering. I am taking from your answer that I can be 
Lisp/Clojure-esque in Scheme and not worry about dotted pairs. That is, I 
can make a grid out of lists, rather than using cons to construct them. 
That's what I'm trying to do.

On Saturday, June 16, 2012 11:35:14 AM UTC-4, octopusgrabbus wrote:
>
> I have a need to learn enough scheme to read it and write a few functions. 
> I came across dotted pair notation. I am trying to grok it in terms of the 
> only Lisp I know, Clojure. Does dotted pair notation in Scheme compare to  
> form in Clojure, and if so, how?
>
>
>

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

2012-06-16 Thread David Nolen
dotted pairs and cons in Scheme and CL both allow you specify an improper
tail. This has some historical utility if you are using cons as a way to
build up non-list data structures. Scheme and CL both provide better
facilities for data structures than using cons.

As far as I know lists are just conses with proper tails.

David

On Sat, Jun 16, 2012 at 12:03 PM, octopusgrabbus
wrote:

> Thanks for answering. I am taking from your answer that I can be
> Lisp/Clojure-esque in Scheme and not worry about dotted pairs. That is, I
> can make a grid out of lists, rather than using cons to construct them.
> That's what I'm trying to do.
>
>
> On Saturday, June 16, 2012 11:35:14 AM UTC-4, octopusgrabbus wrote:
>>
>> I have a need to learn enough scheme to read it and write a few
>> functions. I came across dotted pair notation. I am trying to grok it in
>> terms of the only Lisp I know, Clojure. Does dotted pair notation in Scheme
>> compare to  form in Clojure, and if so, how?
>>
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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: How to go about finding a Clojure job

2012-06-16 Thread Kevin
Send me your resume.  I may have something fulltime involving Clojure, 
javascript and maybe some Ruby on Rails opening up soon.  I am on Seattle, 
WA, but my company is in Michigan, California, and elsewhere and 
telecommute is fine.

Kevin.

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

2012-06-16 Thread Sean Corfield
On Sat, Jun 16, 2012 at 8:49 AM, fenton  wrote:
>> Sorry to be an absolute pain, but could we not have a single page that
>> has (almost everything) that a newbie might want to know.  Can't we be
>> a bit opinionated, like:

This has been discussed at length on several occasions and - whilst
many Clojurians end up with Emacs / Leiningen / Swank - the consensus
seems to be that is unreasonable as a first experience of Clojure.
Hence the Getting Started page suggests Try Clojure (no install at
all), Clooj, Leiningen and only then does it talk about IDEs.

For folks coming from a Java world, Eclipse or IntelliJ is going to be
a better experience than Emacs. For folks coming from Ruby or Python,
Leiningen and TextMate/Sublime Text 2 is probably the best
introductory experience (although there's no longer a page covering
those editors). Or vim.

For all Emacs' power, making it the default choice for newbies is
going to create a huge barrier to entry for people coming to Clojure.

>> Newbies don't want choices for options they don't understand.

The current Getting Started page is a vast simplification from what
was there before - and is the result of several rounds of refinement
by the community, with a lot of input from Clojure newbies.

>> What I'm really asking for is does the community (anyone) see value in
>> this type of thing, and if so can we create a github repo dedicated to the
>> purpose?

It might be useful to go back thru the list archives and read some of
the "getting started" threads that have got us where we are today. We
can definitely improve the documentation around Getting Started but
gaining consensus on how to do that has not proved easy so far :)
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

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

2012-06-16 Thread Kurt Harriger


On Wednesday, June 13, 2012 2:52:15 AM UTC-6, Vinzent wrote:
>
> I do use pre-conditions where the test condition is simple, ie is this a 
>> string? does the map have a :field-type? however I get a lot of my input 
>> data from http requests as json which have similar structures but different 
>> semantics, so I often do not have preconditions where type is not 
>> explicit. For example a string could be an list id or a contact id or an 
>> encoded json document. While it is possible to try to parse a string for 
>> json to verify its type this is seems very computationally expensive and 
>> therefore usually inferred from the context. 
>>
>
> Why do you care about computational expensiveness of pre and post 
> conditions? They'll be turned off in production anyway.
>

How does one turn off pre/post conditions in production?  I agree with Sean 
however and generally think that assertions in production a bad thing.
 

>  
>
>> For example, my first contact model I had {... :fields [{:field-type 
>>  :email :value "" ...}]}  I later realized that the endpoint to get the 
>> contact information provided them grouped and I was filtering a lot based 
>> on field-type anyway so a more effective data structure was {:emails 
>> [{:value "" ...}]}, :field-type was just an implementation detail, the 
>> email object still has a value and associated behavior but the map no 
>> longer contains a :field-type.  However, phone numbers have exactly the 
>> same {:value ""} structure so the only way to determine if it is an email 
>> or a phone number is from context or by parsing the string.
>>
>
> I believe using records or adding :type metadata would be an ideal fit in 
> this case. 
>

I agree, an explicit type field makes dispatching easy.  However this data 
structure returned by (http/get ... :as json) so if I want to add type 
information I need to walk the tree and rewrite it.  Not necessarily a bad 
idea, but in some cases the only thing I need is the eTag and so the 
additional processing may in some cases unnecessary. One could easily make 
data conversions lazy by doing something like (defrecord Contact [contact]) 
(defmethod emails Contact [contact] (map map->Email (:emails contact)) to 
delay the computation until the values are actually requested.  However, 
note that emails is now a multimethod method not a value and the consumer 
needs to use (emails contact) rather than (:emails contact)... Thus as I 
was saying previously is that (def emails :emails) gives you the 
flexibility to delay computation if desired.  


> I also tried using multimethods instead of protocols, but I still found I 
>> needed to restart the JVM frequently.  I think whenever I would re-eval the 
>> namespace with the record type and (defmethod ...) a new class file would 
>> be emitted and the objects in my swank session need to be recreated.   
>>
>
> defmulti has defonce semantic; you can use (def foo nil) (defmulti foo 
> ...) to workaround this. A topic about this problem was recently created in 
> dev mail list, so it'll probably be fixed soon. 
>
> I disagree.  Ironically, if you told a java developer that getters were a 
>> premature optimization and he should use fields instead he would look at 
>> you funny.  Getters are not an optimization and if anything have a minor 
>> performance penalty.  However, using fields makes one very dependent on 
>> implementation details doing so is considered bad practice. I don't see how 
>> this is any different in clojure.  
>>
>
> In clojure, structure of your map is a part of the contract. It's not an 
> implementation detail - it's the same as getters\setters in java.
>

EXACTLY my point!  Clojure does not distinguish between properties and data 
representation and these are NOT the same thing.  There are many different 
ways to represent data. For example the area of a shape can be represented 
in many different ways, square inches, square miles, a rectangle, circles, 
polygons, or perhaps complex geometry requiring calculus all of which could 
be asked what is your area in square feet.  Area is a property of the 
object, the width, radius, number of sides, etc is an implementation 
detail. 

You may then ask so why don't you just pass in {:area } as square feet 
instead of the radius of the circle?  Because the value may not be used by 
the function.  If its not used then why is it part of the contract? 
 Because it may be used conditionally, for example, maybe the function 
needs to find the first shape that will fit within a region once that limit 
is reached it no longer requires the area for any other shapes.  So if the 
shape requires complex calculus which has been written in another 
programming language and thus requires a rpc call to a network service to 
compute the value that is only used sometimes seems wasteful and 
inefficient if the value is only sometimes computed.  This example is 
somewhat contrived, but it is not that different from what I am doing.

For each 

Re: How to go about finding a Clojure job

2012-06-16 Thread Alex Baranosky
Or send me yours.  I work for Runa. http://www.workatruna.com/clojure.html

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

Re: Doseq, map-style

2012-06-16 Thread Sean Corfield
On Sat, Jun 16, 2012 at 10:58 AM, Kurt Harriger  wrote:
> How does one turn off pre/post conditions in production?

(binding [*assert* false] (call-my-code))

> I agree with Sean
> however and generally think that assertions in production a bad thing.

I didn't say that. I said the question was a philosophical one.

I actually think assertions should stay _on_ in production (so I would
care about computationally intensive assertions - and I would prefer
those to be in a test suite).

(and I don't agree with you on using accessor functions vs data-as-API either)
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

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

2012-06-16 Thread Michael Klishin
Welle is an expressive Clojure client for Riak with batteries included.

1.1.0 is a small release: a bug fix and two minor features:

 * core.cache implementation no longer depends on compilation order
 * A new convenience function for deleting objects via 2i queries
 * Cluster client support for both HTTP and PBC transports

Change log:
https://github.com/michaelklishin/welle/blob/master/ChangeLog.md

Documentation: http://clojureriak.info

Releases and important changes are announced on twitter @ClojureWerkz

MK



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Doseq, map-style

2012-06-16 Thread Vinzent

>
> I agree, an explicit type field makes dispatching easy.  However this data 
> structure returned by (http/get ... :as json) so if I want to add type 
> information I need to walk the tree and rewrite it.  Not necessarily a bad 
> idea, but in some cases the only thing I need is the eTag and so the 
> additional processing may in some cases unnecessary. One could easily make 
> data conversions lazy by doing something like (defrecord Contact [contact]) 
> (defmethod emails Contact [contact] (map map->Email (:emails contact)) to 
> delay the computation until the values are actually requested.  However, 
> note that emails is now a multimethod method not a value and the consumer 
> needs to use (emails contact) rather than (:emails contact)... Thus as I 
> was saying previously is that (def emails :emails) gives you the 
> flexibility to delay computation if desired.  
>

You have delays and lazy sequences for delaying computation.

Clojure does not distinguish between properties and data representation and 
> these are NOT the same thing. 
>

Properties is OOP concept; clojure is not an object-orinted language.
 

>  There are many different ways to represent data. For example the area of 
> a shape can be represented in many different ways, square inches, square 
> miles, a rectangle, circles, polygons, or perhaps complex geometry 
> requiring calculus all of which could be asked what is your area in square 
> feet.  Area is a property of the object, the width, radius, number of 
> sides, etc is an implementation detail. 
>

No, area is a function.
 

> You may then ask so why don't you just pass in {:area } as square feet 
> instead of the radius of the circle?  Because the value may not be used by 
> the function.  If its not used then why is it part of the contract? 
>  Because it may be used conditionally, for example, maybe the function 
> needs to find the first shape that will fit within a region once that limit 
> is reached it no longer requires the area for any other shapes.  So if the 
> shape requires complex calculus which has been written in another 
> programming language and thus requires a rpc call to a network service to 
> compute the value that is only used sometimes seems wasteful and 
> inefficient if the value is only sometimes computed.  This example is 
> somewhat contrived, but it is not that different from what I am doing.
>

If getting a 'property' requires such computations, then it's clearly 
should be a function.
 

> My point is that properties with getter functions allow you to defer 
> computation, keywords do not.  Keywords are not like java getters they are 
> like java fields.  
>

Keywords are just one of clojure's data structures (see 
http://clojure.org/data_structures#Data 
Structures-Keywords)
 

> Instead of (:property themap), one should use (def property :property) 
> (property themap). 
>

No, one shouldn't.

Actually this is only somewhat contrived.  It is not uncommon for a user to 
> the same nickname in his email nickn...@domain.com and in twitter handle, 
> and this is a useful similarity feature when this computation is performed 
> for each *pair* of field in each *pair* of contacts this computation may 
> need to be performed millions of times.
>

Well, you can use memoization or choose to structure your data in some 
other way.
 

> Perhaps lisp programmers already did? CLOS and OO was born?
>

Clojure is not Common Lisp. 

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

Re: Doseq, map-style

2012-06-16 Thread Vinzent

>
> I actually think assertions should stay _on_ in production
>

Why? Could you please elaborate more on it? 

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

Re: Doseq, map-style

2012-06-16 Thread Alex Baranosky
To test for violations of those assertions, possibly due to wonky data that
only occurs in certain production-only circumstances.

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

[leiningen2] problem with com.intellie/lazytest, swank-clojure and leiningen2

2012-06-16 Thread eniotna
Problem with swank-clojure and lein2

Hello,

I got a problem recently that i succeed in solving alone (wouhou!). I think
it's kind of interesting to pass along this use case so that other can
avoid the trouble.

Problem: After migrating to lein2, clojure-jack-in and lein-swank ko.

I migrated to lein2 following the migrating guide -
https://github.com/technomancy/leiningen/wiki/Upgrading.

I obtained the ~/.lein/profiles.clj

{:user {:plugins [[lein-swank "1.4.4"]
  [lein-cljs "0.2.2"]
  [lein-difftest "1.3.7"]
  [lein-marginalia "0.7.0"]
  [lein-pprint "1.1.1"]
  [lein-midje "2.0.0-SNAPSHOT"]
  [lein-noir "1.2.1"]
  [com.intelie/lazytest "1.0.0-SNAPSHOT"]
  [org.cloudhoist/pallet-lein "0.4.1"]]
:search-page-size "30"}}

I then started my emacs and got an error. I do not care much about the
jack-in error in emacs as this is often related to a lein problem (due to
env problem). So i try immediately to lein swank.

$ lein swank
The eval-in-project function has moved to the leiningen.core.eval
 namespace; please update your plugin to use that instead.
 Note that `init' is now the third argument instead of the fifth.
 This function will be removed for the final 2.0.0 release.
Exception in thread "main" java.io.FileNotFoundException: Could not
locate swank/swank__init.class or swank/swank.clj on classpath:
at clojure.lang.RT.load(RT.java:432)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval27.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6500)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)

I do not get the error as i have the latest swank-1.4.4 (from the
profile.clj file). After cleaning up the current project (lein clean) I
decide to remove all the swank-clojure*.jar files in my
~/.m2/repository/swank-clojure. This way, the next time, the dependencies
are resolved, i will be able to see them.

So here we go, lein deps

tony@dagobah(1.33,) 21:02:44 (1) ~/repositories/perso/hmdb (hmdb) $ rm
-r /home/tony/.m2/repository/swank-clojure/

tony@dagobah(0.98,) 21:05:57 ~/repositories/perso/hmdb (hmdb) $ lein swank
Could not find artifact swank-clojure:swank-clojure:pom:1.2.1 in
central (http://repo1.maven.org/maven2)
Retrieving swank-clojure/swank-clojure/1.2.1/swank-clojure-1.2.1.pom (1k)
from https://clojars.org/repo/
Could not find artifact swank-clojure:swank-clojure:jar:1.2.1 in
central (http://repo1.maven.org/maven2)
Retrieving swank-clojure/swank-clojure/1.2.1/swank-clojure-1.2.1.jar (41k)
from https://clojars.org/repo/

So, indeed, someone is pulling swank-clojure-1.2.1 but what?

I begin with the more local, my project.clj. So, i tried to exclude the
swank-clojure from the different dev dependencies that i had without success
 :exclude [swank-clojure] in myproject.clj

Then i remembered that the com.intellie/lazytest package that i use (which
is defined in the ~/.lein/profiles.clj) has that.

So i added the :exclusions to it:

[com.intelie/lazytest "1.0.0-SNAPSHOT" :exclusions [swank-clojure]]

And all came back to normal, lein swank in the project and M-x
clojure-jack-in.

Hope this can help someone else.

See ya

@ardumont

Date: 2012-06-16 21:43:16 CEST

Author: Antoine R. Dumont

Org version 7.8.09 with Emacs version 24
Validate XHTML 1.0 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first pos

Re: [leiningen2] problem with com.intellie/lazytest, swank-clojure and leiningen2

2012-06-16 Thread Moritz Ulrich
A very helpful command in this case is `lein deps :tree'

On Sat, Jun 16, 2012 at 9:45 PM, eniotna  wrote:
> Problem with swank-clojure and lein2
>
> Hello,
>
> I got a problem recently that i succeed in solving alone (wouhou!). I think
> it's kind of interesting to pass along this use case so that other can avoid
> the trouble.
>
> Problem: After migrating to lein2, clojure-jack-in and lein-swank ko.
>
> I migrated to lein2 following the migrating guide
> - https://github.com/technomancy/leiningen/wiki/Upgrading.
>
> I obtained the ~/.lein/profiles.clj
>
> {:user {:plugins [[lein-swank "1.4.4"]
>   [lein-cljs "0.2.2"]
>   [lein-difftest "1.3.7"]
>   [lein-marginalia "0.7.0"]
>   [lein-pprint "1.1.1"]
>   [lein-midje "2.0.0-SNAPSHOT"]
>   [lein-noir "1.2.1"]
>   [com.intelie/lazytest "1.0.0-SNAPSHOT"]
>   [org.cloudhoist/pallet-lein "0.4.1"]]
> :search-page-size "30"}}
>
> I then started my emacs and got an error. I do not care much about the
> jack-in error in emacs as this is often related to a lein problem (due to
> env problem). So i try immediately to lein swank.
>
> $ lein swank
> The eval-in-project function has moved to the leiningen.core.eval
>  namespace; please update your plugin to use that instead.
>  Note that `init' is now the third argument instead of the fifth.
>  This function will be removed for the final 2.0.0 release.
> Exception in thread "main" java.io.FileNotFoundException: Could not locate
> swank/swank__init.class or swank/swank.clj on classpath:
> at clojure.lang.RT.load(RT.java:432)
> at clojure.lang.RT.load(RT.java:400)
> at clojure.core$load$fn__4890.invoke(core.clj:5415)
> at clojure.core$load.doInvoke(core.clj:5414)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.core$load_one.invoke(core.clj:5227)
> at clojure.core$load_lib.doInvoke(core.clj:5264)
> at clojure.lang.RestFn.applyTo(RestFn.java:142)
> at clojure.core$apply.invoke(core.clj:603)
> at clojure.core$load_libs.doInvoke(core.clj:5298)
> at clojure.lang.RestFn.applyTo(RestFn.java:137)
> at clojure.core$apply.invoke(core.clj:603)
> at clojure.core$require.doInvoke(core.clj:5381)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at user$eval27.invoke(NO_SOURCE_FILE:1)
> at clojure.lang.Compiler.eval(Compiler.java:6511)
> at clojure.lang.Compiler.eval(Compiler.java:6500)
> at clojure.lang.Compiler.eval(Compiler.java:6501)
> at clojure.lang.Compiler.eval(Compiler.java:6477)
> at clojure.core$eval.invoke(core.clj:2797)
> at clojure.main$eval_opt.invoke(main.clj:297)
> at clojure.main$initialize.invoke(main.clj:316)
> at clojure.main$null_opt.invoke(main.clj:349)
> at clojure.main$main.doInvoke(main.clj:427)
> at clojure.lang.RestFn.invoke(RestFn.java:421)
> at clojure.lang.Var.invoke(Var.java:419)
> at clojure.lang.AFn.applyToHelper(AFn.java:163)
> at clojure.lang.Var.applyTo(Var.java:532)
> at clojure.main.main(main.java:37)
>
> I do not get the error as i have the latest swank-1.4.4 (from
> the profile.clj file). After cleaning up the current project (lein clean) I
> decide to remove all the swank-clojure*.jar files in
> my~/.m2/repository/swank-clojure. This way, the next time, the dependencies
> are resolved, i will be able to see them.
>
> So here we go, lein deps
>
> tony@dagobah(1.33,) 21:02:44 (1) ~/repositories/perso/hmdb (hmdb) $ rm -r
> /home/tony/.m2/repository/swank-clojure/
>
> tony@dagobah(0.98,) 21:05:57 ~/repositories/perso/hmdb (hmdb) $ lein swank
> Could not find artifact swank-clojure:swank-clojure:pom:1.2.1 in central
> (http://repo1.maven.org/maven2)
> Retrieving swank-clojure/swank-clojure/1.2.1/swank-clojure-1.2.1.pom (1k)
> from https://clojars.org/repo/
> Could not find artifact swank-clojure:swank-clojure:jar:1.2.1 in central
> (http://repo1.maven.org/maven2)
> Retrieving swank-clojure/swank-clojure/1.2.1/swank-clojure-1.2.1.jar (41k)
> from https://clojars.org/repo/
>
> So, indeed, someone is pulling swank-clojure-1.2.1 but what?
>
> I begin with the more local, my project.clj. So, i tried to exclude the
> swank-clojure from the different dev dependencies that i had without
> success :exclude [swank-clojure] in myproject.clj
>
> Then i remembered that the com.intellie/lazytest package that i use (which
> is defined in the ~/.lein/profiles.clj) has that.
>
> So i added the :exclusions to it:
>
> [com.intelie/lazytest "1.0.0-SNAPSHOT" :exclusions [swank-clojure]]
>
> And all came back to normal, lein swank in the project and M-x
> clojure-jack-in.
>
> Hope this can help someone else.
>
> See ya
>
> @ardumont
>
> Date: 2012-06-16 21:43:16 CEST
>
> Author: Antoine R. Dumont
>
> Org version 7.8.09 with Emacs version 

Re: A tutorial for how to setup your clojure development environment for: Emacs, Leiningen and Linux.

2012-06-16 Thread fenton

>
> So if someone wants to setup the best environment for developing
> clojure, like serious Java developers who want to make clojure their
> new home, the community doesn't think having a single page for those
> people to use to setup their environment, as a good idea?
>
> There should be several one stop shops.  A single page where someone
> can go to, to setup their whole system.  I'm already maintaining this
> for emacs/clojure-mode/leiningen, etc...
>
> I don't think having this all over the zoo is a great idea, it's a
> good idea, but should be supplemented by the above.
>
> Phil, objects, because he see's the duplication...totally fair
> comment, but there are different needs, that aren't met by just having
> lein/clojure-more/marmelade, etc... all in their respective homes.
>
> Initially, I asked if posting links to the docs I was writing was
> socially acceptable, and now I think it is, and will continue to do
> what I am doing, I think it has a lot of value.  Sure it has problems,
> duplicate data, etc..., but it also has a lot of value too I think.
>
> Shall I clone clojure-mode, and update that doc you referenced to have
> stuff about Leiningen? ...and all the other things...I'm happy to do
> that.  However, I suspect, this argument around: single source of
> truth, and having fragmented getting started scenario, is a little
> intractable.  I think you have to live with the fact that you'll have
> somewhere that pulls together single sources of truth to package them
> in a way that is targetted at certain users.
>
> This is a typical problem that constantly crops up all over the
> place.  The best way would be for each section to be function that you
> referenced and it got included inline, then people could mix and match
> each section they needed to create documents that were nothing but
> references back to the single source of truth.
>
> However, until we get to a place like that, people are going to opt
> for copying information (that will go stale).  Heck often the single
> source of truth is out of date!
>
> What I'd suggest is that a git repo gets openned for this purpose.
> Make contributing easy.  
>
> Until someone in the community does that, I'll tool away at creating
> docs that I need and I think can benefit others.  Should I not post
> them into the clojure group, because maybe they can confuse people
> from the official docs?  No, I don't think so, but I should reference
> back to the official docs in my docs.  I think that is a reasonable
> alternative.
>
> I know someone suggested I try to keep up the docs that are already in
> place, but I'm not super comfortable with that.  1 - they are just
> fragments that I try to understand, and I'm not really the best person
> to understand and document those things I think.  I do better by just
> putting what little I have succeeded (relatively speaking) down and
> then having pros like Phil or whoever tell me where I'm doing things
> wrong/stupidly, like he already did.  Thats about all the value I can
> add at this point.
>

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

Classpath problem compiling or executing in emacs

2012-06-16 Thread Dave Kincaid
I'm still having a hard time understanding how namespaces work apparently. 
I have a project that has two Clojure source files called core.clj and 
generator.clj. Both files are in the same directory, src/main/clj. 

In core.clj I have this:

(ns core
  (:use [cascalog.playground]
[generator])
  (:import [org.joda.time.format DateTimeFormat DateTimeFormatter]))

and trying to execute it or compile (using C-x C-e or C-c C-k) I get the 
error

Could not locate generator__init.class or generator.clj on classpath: 
  [Thrown class java.io.FileNotFoundException]

Could someone help me understand what I'm doing wrong?

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

2012-06-16 Thread eniotna
2012/6/16 Moritz Ulrich 

> A very helpful command in this case is `lein deps :tree'
>

Thanks.

This should have occured to me that something similar as the 'mvn
dependency:tree' command existed for lein.


>
> On Sat, Jun 16, 2012 at 9:45 PM, eniotna  wrote:
> > Problem with swank-clojure and lein2
> >
> > Hello,
> >
> > I got a problem recently that i succeed in solving alone (wouhou!). I
> think
> > it's kind of interesting to pass along this use case so that other can
> avoid
> > the trouble.
> >
> > Problem: After migrating to lein2, clojure-jack-in and lein-swank ko.
> >
> > I migrated to lein2 following the migrating guide
> > - https://github.com/technomancy/leiningen/wiki/Upgrading.
> >
> > I obtained the ~/.lein/profiles.clj
> >
> > {:user {:plugins [[lein-swank "1.4.4"]
> >   [lein-cljs "0.2.2"]
> >   [lein-difftest "1.3.7"]
> >   [lein-marginalia "0.7.0"]
> >   [lein-pprint "1.1.1"]
> >   [lein-midje "2.0.0-SNAPSHOT"]
> >   [lein-noir "1.2.1"]
> >   [com.intelie/lazytest "1.0.0-SNAPSHOT"]
> >   [org.cloudhoist/pallet-lein "0.4.1"]]
> > :search-page-size "30"}}
> >
> > I then started my emacs and got an error. I do not care much about the
> > jack-in error in emacs as this is often related to a lein problem (due to
> > env problem). So i try immediately to lein swank.
> >
> > $ lein swank
> > The eval-in-project function has moved to the leiningen.core.eval
> >  namespace; please update your plugin to use that instead.
> >  Note that `init' is now the third argument instead of the fifth.
> >  This function will be removed for the final 2.0.0 release.
> > Exception in thread "main" java.io.FileNotFoundException: Could not
> locate
> > swank/swank__init.class or swank/swank.clj on classpath:
> > at clojure.lang.RT.load(RT.java:432)
> > at clojure.lang.RT.load(RT.java:400)
> > at clojure.core$load$fn__4890.invoke(core.clj:5415)
> > at clojure.core$load.doInvoke(core.clj:5414)
> > at clojure.lang.RestFn.invoke(RestFn.java:408)
> > at clojure.core$load_one.invoke(core.clj:5227)
> > at clojure.core$load_lib.doInvoke(core.clj:5264)
> > at clojure.lang.RestFn.applyTo(RestFn.java:142)
> > at clojure.core$apply.invoke(core.clj:603)
> > at clojure.core$load_libs.doInvoke(core.clj:5298)
> > at clojure.lang.RestFn.applyTo(RestFn.java:137)
> > at clojure.core$apply.invoke(core.clj:603)
> > at clojure.core$require.doInvoke(core.clj:5381)
> > at clojure.lang.RestFn.invoke(RestFn.java:408)
> > at user$eval27.invoke(NO_SOURCE_FILE:1)
> > at clojure.lang.Compiler.eval(Compiler.java:6511)
> > at clojure.lang.Compiler.eval(Compiler.java:6500)
> > at clojure.lang.Compiler.eval(Compiler.java:6501)
> > at clojure.lang.Compiler.eval(Compiler.java:6477)
> > at clojure.core$eval.invoke(core.clj:2797)
> > at clojure.main$eval_opt.invoke(main.clj:297)
> > at clojure.main$initialize.invoke(main.clj:316)
> > at clojure.main$null_opt.invoke(main.clj:349)
> > at clojure.main$main.doInvoke(main.clj:427)
> > at clojure.lang.RestFn.invoke(RestFn.java:421)
> > at clojure.lang.Var.invoke(Var.java:419)
> > at clojure.lang.AFn.applyToHelper(AFn.java:163)
> > at clojure.lang.Var.applyTo(Var.java:532)
> > at clojure.main.main(main.java:37)
> >
> > I do not get the error as i have the latest swank-1.4.4 (from
> > the profile.clj file). After cleaning up the current project (lein
> clean) I
> > decide to remove all the swank-clojure*.jar files in
> > my~/.m2/repository/swank-clojure. This way, the next time, the
> dependencies
> > are resolved, i will be able to see them.
> >
> > So here we go, lein deps
> >
> > tony@dagobah(1.33,) 21:02:44 (1) ~/repositories/perso/hmdb (hmdb) $ rm
> -r
> > /home/tony/.m2/repository/swank-clojure/
> >
> > tony@dagobah(0.98,) 21:05:57 ~/repositories/perso/hmdb (hmdb) $ lein
> swank
> > Could not find artifact swank-clojure:swank-clojure:pom:1.2.1 in central
> > (http://repo1.maven.org/maven2)
> > Retrieving swank-clojure/swank-clojure/1.2.1/swank-clojure-1.2.1.pom (1k)
> > from https://clojars.org/repo/
> > Could not find artifact swank-clojure:swank-clojure:jar:1.2.1 in central
> > (http://repo1.maven.org/maven2)
> > Retrieving swank-clojure/swank-clojure/1.2.1/swank-clojure-1.2.1.jar
> (41k)
> > from https://clojars.org/repo/
> >
> > So, indeed, someone is pulling swank-clojure-1.2.1 but what?
> >
> > I begin with the more local, my project.clj. So, i tried to exclude the
> > swank-clojure from the different dev dependencies that i had without
> > success :exclude [swank-clojure] in myproject.clj
> >
> > Then i remembered that the com.intellie/lazytest package that i use
> (which
> > is defined in the ~/.lein/profiles.clj) has that.
>

Re: Doseq, map-style

2012-06-16 Thread Kurt Harriger


On Saturday, June 16, 2012 12:26:34 PM UTC-6, Sean Corfield wrote:
>
> On Sat, Jun 16, 2012 at 10:58 AM, Kurt Harriger  
> wrote: 
> > How does one turn off pre/post conditions in production? 
>
> (binding [*assert* false] (call-my-code)) 
>  
>
> I agree with Sean 
> > however and generally think that assertions in production a bad thing. 
>
> I didn't say that. I said the question was a philosophical one. 
>
 

> I actually think assertions should stay _on_ in production (so I would 
> care about computationally intensive assertions - and I would prefer 
> those to be in a test suite). 
>


Sorry, I mistyped that.  I too agree that assertions should remain on 
in production. Sometimes my fingers don't keep up and I miss a word or two 
when that word is "not" the results can be disastrous. 

>
> (and I don't agree with you on using accessor functions vs data-as-API 
> either) 
>

I think there is a difference between data as an api and using data as a 
programming model.  I am fond of declarative programming, say what not how. 
 But, it is my opinion that good declarative data models require extremely 
good understanding of the problem domain which develops from reflecting 
of the commonality and differences in many different 
implementations. Declarative data models done right can simplify things... 
however, the wrong data model can also introduce complexity. Ant is a data 
driven api but the data model is poorly designed, maven is a much better 
example of a declarative data api, yet a lot of people still find maven to 
be more complex and inflexible than ant for various projects that require a 
lot of plugins. A really good clojure specific example of data vs api is 
the discussion regarding if the clojurescript analyzer should contain 
children or if children should be a multimethod 
https://groups.google.com/forum/m/?fromgroups#!topic/clojure-dev/vZLVKmKX0oc

HTML is another great example of a "declarative" data model that has shown 
the stress of increasing complexity from poor representation for common use 
cases (its a navbar not a table) and a multiplicity of vendor specific 
additions that do the same thing in a different way.  I don't think it is a 
stretch to say that rich client side web development was significantly more 
difficult to do correctly before apis such as jquery were written to 
abstract over the differences in vendor implementations.   HTML is data as 
an api that tells the browser how to render a page it cannot be anything 
else... but I wouldn't consume or construct the data structure directly 
instead I would use an api such as jquery so that when the data 
representation changes such as new css attributes that enable the same 
effect to be accomplished more efficiently I can quickly take advantage of 
them without needing to make massive breaking code changes.   APIs allow 
you to be DRY.

I'm not suggesting that the api for a program should not be 
a declarative data structure, what I am saying is that we should not 
consume the data structure directly without abstractions. Publish your api 
as a data structure...consume that the data structure through an api. 

Kurt

 

> -- 
> Sean A Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
> World Singles, LLC. -- http://worldsingles.com/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>

On Saturday, June 16, 2012 12:26:34 PM UTC-6, Sean Corfield wrote:
>
> On Sat, Jun 16, 2012 at 10:58 AM, Kurt Harriger  
> wrote: 
> > How does one turn off pre/post conditions in production? 
>
> (binding [*assert* false] (call-my-code)) 
>
> > I agree with Sean 
> > however and generally think that assertions in production a bad thing. 
>
> I didn't say that. I said the question was a philosophical one. 
>
> I actually think assertions should stay _on_ in production (so I would 
> care about computationally intensive assertions - and I would prefer 
> those to be in a test suite). 
>
> (and I don't agree with you on using accessor functions vs data-as-API 
> either) 
> -- 
> Sean A Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
> World Singles, LLC. -- http://worldsingles.com/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>

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

2012-06-16 Thread Kurt Harriger


On Saturday, June 16, 2012 1:28:21 PM UTC-6, Vinzent wrote:
>
> I agree, an explicit type field makes dispatching easy.  However this data 
>> structure returned by (http/get ... :as json) so if I want to add type 
>> information I need to walk the tree and rewrite it.  Not necessarily a bad 
>> idea, but in some cases the only thing I need is the eTag and so the 
>> additional processing may in some cases unnecessary. One could easily make 
>> data conversions lazy by doing something like (defrecord Contact [contact]) 
>> (defmethod emails Contact [contact] (map map->Email (:emails contact)) to 
>> delay the computation until the values are actually requested.  However, 
>> note that emails is now a multimethod method not a value and the consumer 
>> needs to use (emails contact) rather than (:emails contact)... Thus as I 
>> was saying previously is that (def emails :emails) gives you the 
>> flexibility to delay computation if desired.  
>>
>
> You have delays and lazy sequences for delaying computation.
>

This still requires changing your code to @(:emails contact).  If you use 
(emails contact) you need change your code in only one place. 

>
> Clojure does not distinguish between properties and data representation 
>> and these are NOT the same thing. 
>>
>
> Properties is OOP concept; clojure is not an object-orinted language.
>
 
>
>>  There are many different ways to represent data. For example the area of 
>> a shape can be represented in many different ways, square inches, square 
>> miles, a rectangle, circles, polygons, or perhaps complex geometry 
>> requiring calculus all of which could be asked what is your area in square 
>> feet.  Area is a property of the object, the width, radius, number of 
>> sides, etc is an implementation detail. 
>>
>
> No, area is a function.
>

Property is just the OO word for function, semantically they are the same. 
OO doesn't have functions they have properties and methods.  
 

>  
>
>> You may then ask so why don't you just pass in {:area } as square feet 
>> instead of the radius of the circle?  Because the value may not be used by 
>> the function.  If its not used then why is it part of the contract? 
>>  Because it may be used conditionally, for example, maybe the function 
>> needs to find the first shape that will fit within a region once that limit 
>> is reached it no longer requires the area for any other shapes.  So if the 
>> shape requires complex calculus which has been written in another 
>> programming language and thus requires a rpc call to a network service to 
>> compute the value that is only used sometimes seems wasteful and 
>> inefficient if the value is only sometimes computed.  This example is 
>> somewhat contrived, but it is not that different from what I am doing.
>>
>
> If getting a 'property' requires such computations, then it's clearly 
> should be a function.
>

Agree.  

>  
>
>> My point is that properties with getter functions allow you to defer 
>> computation, keywords do not.  Keywords are not like java getters they are 
>> like java fields.  
>>
>
> Keywords are just one of clojure's data structures (see 
> http://clojure.org/data_structures#Data 
> Structures-Keywords) 
>
 
>
>> Instead of (:property themap), one should use (def property :property) 
>> (property themap). 
>>
>
> No, one shouldn't.
>

I disagree... but I will continue to recommend otherwise.  
 

>
> Actually this is only somewhat contrived.  It is not uncommon for a user 
>> to the same nickname in his email nickn...@domain.com and in twitter 
>> handle, and this is a useful similarity feature when this computation is 
>> performed for each *pair* of field in each *pair* of contacts this 
>> computation may need to be performed millions of times.
>>
>
> Well, you can use memoization or choose to structure your data in some 
> other way.
>  
>
>> Perhaps lisp programmers already did? CLOS and OO was born?
>>
>
> Clojure is not Common Lisp. 
>

Agreed, clojure has a much stronger emphasis on immutability than 
traditional OO programming and is what I like about it... but it is 
possible to write OO code using immutable data structures but is not as 
idiomatic.  I don't want clojure to be like CLOS, but I also don't think 
that we should ignore more than 50 years of lessons learned and "SOLID" 
programming principles.


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

2012-06-16 Thread Kurt Harriger


-- 
Kurt Harriger
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Saturday, June 16, 2012 at 3:07 PM, Kurt Harriger wrote:

> 
> 
> On Saturday, June 16, 2012 1:28:21 PM UTC-6, Vinzent wrote:
> > > I agree, an explicit type field makes dispatching easy.  However this 
> > > data structure returned by (http/get ... :as json) so if I want to add 
> > > type information I need to walk the tree and rewrite it.  Not necessarily 
> > > a bad idea, but in some cases the only thing I need is the eTag and so 
> > > the additional processing may in some cases unnecessary. One could easily 
> > > make data conversions lazy by doing something like (defrecord Contact 
> > > [contact]) (defmethod emails Contact [contact] (map map->Email (:emails 
> > > contact)) to delay the computation until the values are actually 
> > > requested.  However, note that emails is now a multimethod method not a 
> > > value and the consumer needs to use (emails contact) rather than (:emails 
> > > contact)... Thus as I was saying previously is that (def emails :emails) 
> > > gives you the flexibility to delay computation if desired.  
> > 
> > 
> > You have delays and lazy sequences for delaying computation.
> 
> This still requires changing your code to @(:emails contact).  If you use 
> (emails contact) you need change your code in only one place. 
> > 
> > > Clojure does not distinguish between properties and data representation 
> > > and these are NOT the same thing. 
> > 
> > Properties is OOP concept; clojure is not an object-orinted language.
> >  
> > >  There are many different ways to represent data. For example the area of 
> > > a shape can be represented in many different ways, square inches, square 
> > > miles, a rectangle, circles, polygons, or perhaps complex geometry 
> > > requiring calculus all of which could be asked what is your area in 
> > > square feet.  Area is a property of the object, the width, radius, number 
> > > of sides, etc is an implementation detail. 
> > > 
> > 
> > 
> > No, area is a function.
> 
> Property is just the OO word for function, semantically they are the same. OO 
> doesn't have functions they have properties and methods.  
>  
> >  
> > > You may then ask so why don't you just pass in {:area } as square feet 
> > > instead of the radius of the circle?  Because the value may not be used 
> > > by the function.  If its not used then why is it part of the contract?  
> > > Because it may be used conditionally, for example, maybe the function 
> > > needs to find the first shape that will fit within a region once that 
> > > limit is reached it no longer requires the area for any other shapes.  So 
> > > if the shape requires complex calculus which has been written in another 
> > > programming language and thus requires a rpc call to a network service to 
> > > compute the value that is only used sometimes seems wasteful and 
> > > inefficient if the value is only sometimes computed.  This example is 
> > > somewhat contrived, but it is not that different from what I am doing.
> > > 
> > 
> > 
> > If getting a 'property' requires such computations, then it's clearly 
> > should be a function.
> 
> Agree.  
> >  
> > > My point is that properties with getter functions allow you to defer 
> > > computation, keywords do not.  Keywords are not like java getters they 
> > > are like java fields.  
> > > 
> > 
> > 
> > Keywords are just one of clojure's data structures (see 
> > http://clojure.org/data_structures#Data Structures-Keywords 
> > (http://clojure.org/data_structures#Data+Structures-Keywords)) 
> >  
> > > Instead of (:property themap), one should use (def property :property) 
> > > (property themap). 
> > > 
> > 
> > 
> > No, one shouldn't.
> 
> I disagree... but I will continue to recommend otherwise.  
> 
I disagree... and I will continue to recommend otherwise.   
> 
> > 
> > > Actually this is only somewhat contrived.  It is not uncommon for a user 
> > > to the same nickname in his email nickn...@domain.com 
> > > (mailto:nickn...@domain.com) and in twitter handle, and this is a useful 
> > > similarity feature when this computation is performed for each *pair* of 
> > > field in each *pair* of contacts this computation may need to be 
> > > performed millions of times.
> > 
> > Well, you can use memoization or choose to structure your data in some 
> > other way.
> >  
> > > Perhaps lisp programmers already did? CLOS and OO was born?
> > 
> > 
> > Clojure is not Common Lisp. 
> 
> Agreed, clojure has a much stronger emphasis on immutability than traditional 
> OO programming and is what I like about it... but it is possible to write OO 
> code using immutable data structures but is not as idiomatic.  I don't want 
> clojure to be like CLOS, but I also don't think that we should ignore more 
> than 50 years of lessons learned and "SOLID" programming principles.
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" gro

Catnip

2012-06-16 Thread Christian Guimaraes
Hi,

Anybody here already used "catnip" (https://github.com/bodil/catnip) to do
some web developement? I saw this video (http://vimeo.com/43808810) and
this tools is quite impressive.

I'm giving it a try.

Cheers.

Christian Guimaraes
@csgui

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

2012-06-16 Thread Softaddicts
50 years of solid programming principles, OO being the Holy Grail ? :)

I assume then that you programmed a lot in Simula-66 ? I did...

For over 50 years, we made the same mistakes that Clojure attempts to
correct. Most of the time new languages repackaged the same flawed concepts
of the past, this has been done over and over again.

Programmer's throughput have to increase somehow, any superfluous line of
code is too many.

Getters facades of any form are just that, superflous code lines that need to 
be maintained later on.

That led Java right in the russian puppet syndrom.

In these 50 years solid principles, many failed to deliver. It's time for a 
reset :)


Luc



> 
> 
> On Saturday, June 16, 2012 1:28:21 PM UTC-6, Vinzent wrote:
> >
> > I agree, an explicit type field makes dispatching easy.  However this data 
> >> structure returned by (http/get ... :as json) so if I want to add type 
> >> information I need to walk the tree and rewrite it.  Not necessarily a bad 
> >> idea, but in some cases the only thing I need is the eTag and so the 
> >> additional processing may in some cases unnecessary. One could easily make 
> >> data conversions lazy by doing something like (defrecord Contact 
> >> [contact]) 
> >> (defmethod emails Contact [contact] (map map->Email (:emails contact)) to 
> >> delay the computation until the values are actually requested.  However, 
> >> note that emails is now a multimethod method not a value and the consumer 
> >> needs to use (emails contact) rather than (:emails contact)... Thus as I 
> >> was saying previously is that (def emails :emails) gives you the 
> >> flexibility to delay computation if desired.  
> >>
> >
> > You have delays and lazy sequences for delaying computation.
> >
> 
> This still requires changing your code to @(:emails contact).  If you use 
> (emails contact) you need change your code in only one place. 
> 
> >
> > Clojure does not distinguish between properties and data representation 
> >> and these are NOT the same thing. 
> >>
> >
> > Properties is OOP concept; clojure is not an object-orinted language.
> >
>  
> >
> >>  There are many different ways to represent data. For example the area of 
> >> a shape can be represented in many different ways, square inches, square 
> >> miles, a rectangle, circles, polygons, or perhaps complex geometry 
> >> requiring calculus all of which could be asked what is your area in square 
> >> feet.  Area is a property of the object, the width, radius, number of 
> >> sides, etc is an implementation detail. 
> >>
> >
> > No, area is a function.
> >
> 
> Property is just the OO word for function, semantically they are the same. 
> OO doesn't have functions they have properties and methods.  
>  
> 
> >  
> >
> >> You may then ask so why don't you just pass in {:area } as square feet 
> >> instead of the radius of the circle?  Because the value may not be used by 
> >> the function.  If its not used then why is it part of the contract? 
> >>  Because it may be used conditionally, for example, maybe the function 
> >> needs to find the first shape that will fit within a region once that 
> >> limit 
> >> is reached it no longer requires the area for any other shapes.  So if the 
> >> shape requires complex calculus which has been written in another 
> >> programming language and thus requires a rpc call to a network service to 
> >> compute the value that is only used sometimes seems wasteful and 
> >> inefficient if the value is only sometimes computed.  This example is 
> >> somewhat contrived, but it is not that different from what I am doing.
> >>
> >
> > If getting a 'property' requires such computations, then it's clearly 
> > should be a function.
> >
> 
> Agree.  
> 
> >  
> >
> >> My point is that properties with getter functions allow you to defer 
> >> computation, keywords do not.  Keywords are not like java getters they are 
> >> like java fields.  
> >>
> >
> > Keywords are just one of clojure's data structures (see 
> > http://clojure.org/data_structures#Data 
> > Structures-Keywords) 
> >
>  
> >
> >> Instead of (:property themap), one should use (def property :property) 
> >> (property themap). 
> >>
> >
> > No, one shouldn't.
> >
> 
> I disagree... but I will continue to recommend otherwise.  
>  
> 
> >
> > Actually this is only somewhat contrived.  It is not uncommon for a user 
> >> to the same nickname in his email nickn...@domain.com and in twitter 
> >> handle, and this is a useful similarity feature when this computation is 
> >> performed for each *pair* of field in each *pair* of contacts this 
> >> computation may need to be performed millions of times.
> >>
> >
> > Well, you can use memoization or choose to structure your data in some 
> > other way.
> >  
> >
> >> Perhaps lisp programmers already did? CLOS and OO was born?
> >>
> >
> > Clojure is not Common Lisp. 
> >
> 
> Agreed, clojure has a much stronger emphasis on immutability than 
> traditional OO programming and is what I

Looking to help out with an open source web scanner

2012-06-16 Thread pvt
Hello Clojure fans.

I'am new to clojure, I've learned clojure for sometime, wow~ it's an 
interesting language.So I want to find some open source projects written in 
Clojure that I could get involved in and help out.

However I couldn't find any projects that I'm interested in it.And now I 
want to start a new open source project which is focus on web security.

I am planning to write a distributed web scanner which can do a huge number 
of scanning task in parallel.

I don't want to start from scratch with bare sockets, because I think there 
should be so many good parts of the battle-tested array of Java web 
infrastructure was waiting to be leveraged.

I found clj-http can be used in the worker module. 
I found Ring can be used in the web server module. 
I want to use a NoSQL DB to store the scan results and response, but there 
are many candidates: Cassandra, Redis, MangoDB, CouchDB, HBase.Is there any 
advice for choosing a NoSQL DB?
I want to find a framework the manage the master and workers, is 
storm(https://github.com/nathanmarz/storm) suitable for my project?

Any help 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: Scheme dotted pair equivalent in Clojure

2012-06-16 Thread Eric Seidel

>
> I have a need to learn enough scheme to read it and write a few functions. 
> I came across dotted pair notation. I am trying to grok it in terms of the 
> only Lisp I know, Clojure. Does dotted pair notation in Scheme compare to  
> form in Clojure, and if so, how?
>

 As David notes, dotted-pairs are not allowed in Clojure because they allow 
for improper lists, which would break many of the nice HOFs we like to use 
(map, filter, etc).

Dotted-pairs exist in Scheme because of the structure of the original 
cons-cell, essentially a structure with two pointers, car and cdr. In a 
proper list, car will point to some value and cdr will point to either 
another cons-cell or nil.

Now suppose you want to encode a list of properties, i.e. key-value pairs. 
You could make a proper list where each car points to a pair, which would 
be another cons-cell since that's all we have to work with. This will work 
very nicely for small-ish property lists. But how should we encode the 
properties themselves? We could make a proper list of length two, where the 
first car points to the key and the second points to the value, but that's 
kinda wasteful. We're using two whole cons-cells when we really just need 
one: car points to the key and cdr to the value.

And there you have it, the historical justification for dotted-pairs. They 
were very useful to save memory, perhaps other reasons as well, but this is 
the main one I know.

Of course with the abundance of RAM on modern machines, this is much less 
of a concern, so Clojure enforces proper lists to increase safety :)

Hope this was somewhat understandable, I'm too lazy to try to draw ASCII 
box-and-pointer diagrams right now..

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

Re: How to write XML?

2012-06-16 Thread mwillson
On Wednesday, 13 June 2012 20:35:41 UTC+1, fenton wrote:
>
> For some reason I cannot create an XML node.  Sample code 
> here. Any 
> assistance much appreciated.


I think you need to create a zipper from the root node returned by 
(zip/root), so,

(def joey-text (zd/xml-> (zip/xml-zip new-xml) :b2))

-mark

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 (Slim 1.4.0) and Azul don't like each other

2012-06-16 Thread Gil Tene
We've tracked down the problem, and it turns out to be a semantic issue 
around forced vs. hinted initialization (or initialization avoidance) on 
explicit class loading. It appears that Clojure makes multiple 
Class.forName() calls on the same class, with the first call intended to 
avoid static initialization, and the subsequent calls forcing 
initialization. We believe the issue may be with a difference between the 
Zing and OpenJDK HotSpot implementations of the spec for these calls.

We've created and quickly tested a replacement implementation of 
Class.forName() that mirrors OpenJDK HotSpot's exact behavior, and it seems 
to resolve the Clojure startup issues in our simple test. We'll include 
this change in a coming dot release for Zing, but in the meantime, we 
prepared an override jar file that can be placed in the booth class path to 
test the behavior. I'll get that to you via e-mail.

Please test it and let us know if it resolves your issue.

-- Gil.

On Wednesday, June 13, 2012 9:26:37 AM UTC-7, Edward Z. Yang wrote:
>
>  We've been attempting to run Clojure in Azul, and not having 
> particularly good luck. We got around the problem described here (
> http://www.mail-archive.com/clojure@googlegroups.com/msg17276.html) by 
> switching to slim, but now we are getting this exception:
>
> ExceptionInInitializerError: Compiler$CompilerException: 
> java.lang.NoSuchFieldException: close, compiling:(clojure/core.clj:6139)
>
> Any advice?
>
> Cheers,
> Edward
>  

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

2012-06-16 Thread Alfred Xiao
; z2 - by parsing and zipping a string - vs. new-xml

ftxml.core> (def z2 (zip-str "tonjoey"))
#'ftxml.core/z2
ftxml.core> (zd/xml-> z2 :b2)
([{:tag :b2, :attrs nil, :content ["joey"]} {:l [{:tag :b1, :attrs nil, 
:content ["ton"]}], :pnodes [{:tag :a, :attrs nil, :content [{:tag :b1, 
:attrs nil, :content ["ton"]} {:tag :b2, :attrs nil, :content ["joey"]}]}], 
:ppath nil, :r nil}])
ftxml.core> (class z2)
clojure.lang.PersistentVector
ftxml.core> (class new-xml)
clojure.lang.PersistentStructMap
ftxml.core> z2
[{:tag :a, :attrs nil, :content [{:tag :b1, :attrs nil, :content ["ton"]} 
{:tag :b2, :attrs nil, :content ["joey"]}]} nil]
ftxml.core> new-xml
{:tag :a, :attrs nil, :content [{:tag :b1, :attrs nil, :content ["ton"]} 
{:content ["joey"], :attrs nil, :tag :b2}]}


==> The above code shows that
1. z2 is a PersistentVector while new-xml is PersistentStructMap
2. z2 look similar to new-xml except z2 is a vector and has a nil element
3. expression (zd/xml-> z2 :b2) works

;; Going on
ftxml.core> (def n2 [new-xml nil])
#'ftxml.core/n2
ftxml.core> (class n2)
clojure.lang.PersistentVector
ftxml.core> n2
[{:tag :a, :attrs nil, :content [{:tag :b1, :attrs nil, :content ["ton"]} 
{:content ["joey"], :attrs nil, :tag :b2}]} nil]
ftxml.core> z2
[{:tag :a, :attrs nil, :content [{:tag :b1, :attrs nil, :content ["ton"]} 
{:tag :b2, :attrs nil, :content ["joey"]}]} nil]

==> The above code shows that
1. n2 is a PersistentVector, same as z2
2. n2 looks very similar to z2 except ordering of key/valure pairs for 
element b2

; Going on
ftxml.core> (= z2 n2)
true
ftxml.core> (zd/xml-> n2 :b2)
; Evaluation aborted.

==> The above code shows that
1. n2 equals z2 !!
2. but the expression (zd/xml-> n2 :b2) doesn't work for n2 !!

Wonder why..!

On Thursday, June 14, 2012 3:35:41 AM UTC+8, fenton wrote:
>
> For some reason I cannot create an XML node.  Sample code 
> here. Any 
> assistance much 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: ANN: lambic v. 0.1.0

2012-06-16 Thread Daniel
This is an amazing idea!!!

On Thursday, June 14, 2012 6:44:10 PM UTC-5, rob wrote:
>
> This announcement is more of a call for suggestions (even pull requests if 
> you are moved to do so) as there's not much to it yet, just enough to to 
> demonstrate the concept for simpler transformations.  I'm thinking of how 
> best to go about supporting a wider range of sequence transformations.
>
> https://github.com/rplevy/lambic
> https://clojars.org/lambic
>
> The basic idea is that languages like Prolog are very good at manipulating 
> sequences "by example" based on pattern matching, and that using core.match 
> this can become the norm for Clojure too (either using this library or some 
> other I don't yet know about.)
>
> In Clojure, when you encounter data that matches pattern X and you want to 
> systematically turn into data of the form Y, depending on how complex the 
> structures are, you tend to start with some solution, change it around, and 
> ultimately end up with a very elegant solution that is clearly the "best 
> way".
>
> My present take on how to implement lambic is essentially to catalog these 
> "best ways" for a number of different classes of sequence transformations, 
> so that lambic knows what to do with them.  What do you think of this idea? 
>  Is there a way to use logical magic (magical logic?) to do something 
> better? ;)
>

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

2012-06-16 Thread Carlo Zancanaro
On Sat, Jun 16, 2012 at 10:10 AM, Dave Kincaid  wrote:
> Sure can. Here is the project.clj:
>
> (defproject swank-test "0.1"
>   :source-path "src/main/clj"

Are you using lein 1.x or lein 2.x? In lein 2.x you need to use
`:source-paths ["src/main/clj"]` here.

>   :test-path "test/clj"
>   :java-source-path "src/main/java"

The same goes for :test-paths and :java-source-paths. The leiningen
girhub repository has a sample project.clj which is where I looked
this up (in case you need to look something else up later).

https://github.com/technomancy/leiningen/blob/master/sample.project.clj

>   :javac-options {:debug "true" :fork "true"}
>   :resources-path "src/main/resources"
>   :dependencies [[org.clojure/clojure "1.4.0"]
>                  [cascalog "1.9.0"]
>                  [org.apache.hadoop/hadoop-core "0.20.2" :exclusions
> [hsqldb/hsqldb]]])
>
> I have a file named generator.clj in src/main/clj. When I do a "lein swank"
> from the directory that project.clj is in then run slime-connect in Emacs
> with the generator.clj file open. Then I try to do (use 'generator) and get
>
> Could not locate generator__init.class or generator.clj on classpath:
>   [Thrown class java.io.FileNotFoundException]

When I do this with your supplied project.clj with lein 1.x it works.
With lein2.x and the changes outlined above it also works.

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


[ANN] Clojars deployment over https

2012-06-16 Thread Nelson Morris
It is now possible to deploy to clojars through the standard maven
deploy mechanism.  The url is https://clojars.org/repo.  There are
instructions at https://github.com/ato/clojars-web/wiki/Pushing for
configuring the various build tools.

One highlight, if you are using lein 2.0.0-preview6 then `lein clojars
deploy` should just work.

As a reminder, clojars recently had a security upgrade
(https://groups.google.com/forum/?fromgroups#!topic/clojure/Xg1I0rgt85s).
If you did not login during this time period then you will need to use
the forgot password functionality.

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

2012-06-16 Thread Kurt Harriger
On Jun 16, 2012, at 6:27 PM, Softaddicts  wrote:

> 50 years of solid programming principles, OO being the Holy Grail ? :)
>
> I assume then that you programmed a lot in Simula-66 ? I did...
>
> For over 50 years, we made the same mistakes that Clojure attempts to
> correct. Most of the time new languages repackaged the same flawed concepts
> of the past, this has been done over and over again.

How is clojure different? I have programmed in dozens of languages,
message based and functional, static and dynamic, garbage collected
and manage it yourself.  One thing that I have realized is there is no
magic bullet and they are as you say different versions of the same
thing.

Clojure is my first lisp however and I was really excited about it
when I started but after writing a project with more than a few
thousand lines of code I found it very frustrating to change.

>
> Programmer's throughput have to increase somehow, any superfluous line of
> code is too many.
>
> Getters facades of any form are just that, superflous code lines that need to 
> be maintained later on.
>
> That led Java right in the russian puppet syndrom.
>
> In these 50 years solid principles, many failed to deliver. It's time for a 
> reset :)
>

I too have experienced the russian doll syndrome and logic scattered
across multiple files, but I have already started migrating away from
clojure because the code is difficult to maintain.

If the code does not need to change then maintaining it is easy,
however if it does need to change i would prefer to make that change
in only one place.  DRY.  If that only requires one more line of code
then I think it is well worth it and I certainly do not believe that
lines of code are the best metric of maintainable code.  IMHO,
Readability and good domain abstractions are FAR more important then
LOC.

>
> Luc
>
>
>
>>
>>
>> On Saturday, June 16, 2012 1:28:21 PM UTC-6, Vinzent wrote:
>>>
>>> I agree, an explicit type field makes dispatching easy.  However this data
 structure returned by (http/get ... :as json) so if I want to add type
 information I need to walk the tree and rewrite it.  Not necessarily a bad
 idea, but in some cases the only thing I need is the eTag and so the
 additional processing may in some cases unnecessary. One could easily make
 data conversions lazy by doing something like (defrecord Contact [contact])
 (defmethod emails Contact [contact] (map map->Email (:emails contact)) to
 delay the computation until the values are actually requested.  However,
 note that emails is now a multimethod method not a value and the consumer
 needs to use (emails contact) rather than (:emails contact)... Thus as I
 was saying previously is that (def emails :emails) gives you the
 flexibility to delay computation if desired.

>>>
>>> You have delays and lazy sequences for delaying computation.
>>>
>>
>> This still requires changing your code to @(:emails contact).  If you use
>> (emails contact) you need change your code in only one place.
>>
>>>
>>> Clojure does not distinguish between properties and data representation
 and these are NOT the same thing.

>>>
>>> Properties is OOP concept; clojure is not an object-orinted language.
>>>
>>
>>>
 There are many different ways to represent data. For example the area of
 a shape can be represented in many different ways, square inches, square
 miles, a rectangle, circles, polygons, or perhaps complex geometry
 requiring calculus all of which could be asked what is your area in square
 feet.  Area is a property of the object, the width, radius, number of
 sides, etc is an implementation detail.

>>>
>>> No, area is a function.
>>>
>>
>> Property is just the OO word for function, semantically they are the same.
>> OO doesn't have functions they have properties and methods.
>>
>>
>>>
>>>
 You may then ask so why don't you just pass in {:area } as square feet
 instead of the radius of the circle?  Because the value may not be used by
 the function.  If its not used then why is it part of the contract?
 Because it may be used conditionally, for example, maybe the function
 needs to find the first shape that will fit within a region once that limit
 is reached it no longer requires the area for any other shapes.  So if the
 shape requires complex calculus which has been written in another
 programming language and thus requires a rpc call to a network service to
 compute the value that is only used sometimes seems wasteful and
 inefficient if the value is only sometimes computed.  This example is
 somewhat contrived, but it is not that different from what I am doing.

>>>
>>> If getting a 'property' requires such computations, then it's clearly
>>> should be a function.
>>>
>>
>> Agree.
>>
>>>
>>>
 My point is that properties with getter functions allow you to defer
 computation, keywords do not.  Keywords are not like ja

Re: Classpath set by lein swank or clojure-jack-in

2012-06-16 Thread Dave Kincaid
Thank you, Carlo! That was it! I'm using Leingingen 2. It's working great 
now.

Dave

On Saturday, June 16, 2012 8:34:08 PM UTC-5, Carlo wrote:
>
> On Sat, Jun 16, 2012 at 10:10 AM, Dave Kincaid  
> wrote: 
> > Sure can. Here is the project.clj: 
> > 
> > (defproject swank-test "0.1" 
> >   :source-path "src/main/clj" 
>
> Are you using lein 1.x or lein 2.x? In lein 2.x you need to use 
> `:source-paths ["src/main/clj"]` here. 
>
> >   :test-path "test/clj" 
> >   :java-source-path "src/main/java" 
>
> The same goes for :test-paths and :java-source-paths. The leiningen 
> girhub repository has a sample project.clj which is where I looked 
> this up (in case you need to look something else up later). 
>
> https://github.com/technomancy/leiningen/blob/master/sample.project.clj 
>
> >   :javac-options {:debug "true" :fork "true"} 
> >   :resources-path "src/main/resources" 
> >   :dependencies [[org.clojure/clojure "1.4.0"] 
> >  [cascalog "1.9.0"] 
> >  [org.apache.hadoop/hadoop-core "0.20.2" :exclusions 
> > [hsqldb/hsqldb]]]) 
> > 
> > I have a file named generator.clj in src/main/clj. When I do a "lein 
> swank" 
> > from the directory that project.clj is in then run slime-connect in 
> Emacs 
> > with the generator.clj file open. Then I try to do (use 'generator) and 
> get 
> > 
> > Could not locate generator__init.class or generator.clj on classpath: 
> >   [Thrown class java.io.FileNotFoundException] 
>
> When I do this with your supplied project.clj with lein 1.x it works. 
> With lein2.x and the changes outlined above it also works. 
>

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

Re: Classpath problem compiling or executing in emacs

2012-06-16 Thread Sean Corfield
What's in your project.clj file?

On Sat, Jun 16, 2012 at 1:19 PM, Dave Kincaid  wrote:
> I'm still having a hard time understanding how namespaces work apparently. I
> have a project that has two Clojure source files called core.clj and
> generator.clj. Both files are in the same directory, src/main/clj.
>
> In core.clj I have this:
>
> (ns core
>   (:use [cascalog.playground]
>         [generator])
>   (:import [org.joda.time.format DateTimeFormat DateTimeFormatter]))
>
> and trying to execute it or compile (using C-x C-e or C-c C-k) I get the
> error
>
> Could not locate generator__init.class or generator.clj on classpath:
>   [Thrown class java.io.FileNotFoundException]
>
> Could someone help me understand what I'm doing wrong?

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

2012-06-16 Thread aboy021
An official channel would be great, thank you.

Clojure is a great language with great ideas and a sticker on your laptop is a 
nice way to invite people to talk about it.

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


Re: Looking to help out with an open source web scanner

2012-06-16 Thread Baishampayan Ghose
Take a look at Itsy, a similar but simpler project written in Clojure
https://github.com/dakrone/itsy

Regards,
BG

On Sun, Jun 17, 2012 at 4:31 AM, pvt  wrote:

> Hello Clojure fans.
>
> I'am new to clojure, I've learned clojure for sometime, wow~ it's an
> interesting language.So I want to find some open source projects written in
> Clojure that I could get involved in and help out.
>
> However I couldn't find any projects that I'm interested in it.And now I
> want to start a new open source project which is focus on web security.
>
> I am planning to write a distributed web scanner which can do a huge
> number of scanning task in parallel.
>
> I don't want to start from scratch with bare sockets, because I think
> there should be so many good parts of the battle-tested array of Java web
> infrastructure was waiting to be leveraged.
>
> I found clj-http can be used in the worker module.
> I found Ring can be used in the web server module.
> I want to use a NoSQL DB to store the scan results and response, but there
> are many candidates: Cassandra, Redis, MangoDB, CouchDB, HBase.Is there any
> advice for choosing a NoSQL DB?
> I want to find a framework the manage the master and workers, is storm(
> https://github.com/nathanmarz/storm) suitable for my project?
>
> Any help 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




-- 
Baishampayan Ghose
b.ghose at gmail.com

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