Re: alter a map in a vector (reference)

2013-06-11 Thread Kelker Ryan
Here's the refactored version.user> (def example
 (ref 
  [{:id 1 :email {"a...@mail.com" 1}}
   {:id 2 :email {"d...@mail.com" 1}}
   {:id 3 :email {"g...@mail.com" 2}}
   {:id 4 :email {"f...@mail.com" 2}}]))
#'user/example
user> 
(defn update-counter [id xs]
  (dosync
   (let [_ @xs
 at-after (drop-while #(not= id (:id %)) _)
 mod-key (-> at-after first :email keys first)
 location (- (count _) (count at-after))]
 (alter xs update-in [location :email mod-key] inc
#'user/update-counter
user> (dotimes [_ 3]
	 (update-counter 3 example))
nil
user> (clojure.pprint/pprint @example)
[{:email {"a...@mail.com" 1}, :id 1}
 {:email {"d...@mail.com" 1}, :id 2}
 {:email {"g...@mail.com" 5}, :id 3}
 {:email {"f...@mail.com" 2}, :id 4}]
nil
   12.06.2013, 14:47, "Meikel Brandmeyer (kotarak)" :Hi,Am Mittwoch, 12. Juni 2013 06:39:59 UTC+2 schrieb Kelker Ryan:user> (defn update-counter [id xs](let [at-after (drop-while #(not= id (:id %)) @xs)
  to-modify (-> at-after first :email)
  mod-key (-> to-modify keys first)
  location (let [_ (- (count @xs) (count at-after))]
 (if-not (pos? _) 0 _))]
  (dosync
   (alter xs update-in [location :email mod-key] inc
 You have to wrap all accesses to xs in the same dosync. Kind regardsMeikel 



-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Re: Is there an approved way for testing if something is a zipper?

2013-06-11 Thread Stefan Kamphausen
Thanks for all your suggestions.  Seems like a useful addition to 
clojure.zip to me.

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




Re: alter a map in a vector (reference)

2013-06-11 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Mittwoch, 12. Juni 2013 06:39:59 UTC+2 schrieb Kelker Ryan:
>
> user> (defn update-counter [id xs]
>
> (let [at-after (drop-while #(not= id (:id %)) @xs)
>   to-modify (-> at-after first :email)
>   mod-key (-> to-modify keys first)
>   location (let [_ (- (count @xs) (count at-after))]
>  (if-not (pos? _) 0 _))]
>   (dosync
>(alter xs update-in [location :email mod-key] inc
>
>
You have to wrap all accesses to xs in the same dosync.

Kind regards
Meikel
 

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




Re: Clojure in production

2013-06-11 Thread Jason Wolfe
Hi Plínio,

At Prismatic (getprismatic.com), our entire backend (web crawling, machine 
learning, topic modeling, real-time ranking, API, web-servers, ...) is 
written in Clojure, and our frontend is moving towards 100% ClojureScript 
-- you can check out our blog at http://blog.getprismatic.com/ for details, 
or here's a talk from awhile ago on the subject:

http://www.infoq.com/presentations/Why-Prismatic-Goes-Faster-With-Clojure

Happy to answer any questions about our use of Clojure if you're 
interested. 

Cheers,
Jason

On Monday, June 10, 2013 2:47:25 PM UTC-7, Plinio Balduino wrote:
>
> Hi there 
>
> I'm writing a talk about Clojure in the real world and I would like to 
> know, if possible, which companies are using Clojure for production or 
> to make internal tools. 
>
> Thank you 
>
> Plínio Balduino 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: alter a map in a vector (reference)

2013-06-11 Thread Kelker Ryan
I've seen some interesting responses, but here's my solution. user> (def example
(ref 
 [{:id 1 :email {"a...@mail.com" 1}}
  {:id 2 :email {"d...@mail.com" 1}}
  {:id 3 :email {"g...@mail.com" 2}}
  {:id 4 :email {"f...@mail.com" 2}}]))

#'user/example
user> (defn update-counter [id xs]
(let [at-after (drop-while #(not= id (:id %)) @xs)
  to-modify (-> at-after first :email)
  mod-key (-> to-modify keys first)
  location (let [_ (- (count @xs) (count at-after))]
 (if-not (pos? _) 0 _))]
  (dosync
   (alter xs update-in [location :email mod-key] inc

#'user/update-counter
user> (update-counter 4 example)
-- output removed --
user> (update-counter 1 example)
-- output removed --
user> (clojure.pprint/pprint @example)
[{:email {"a...@mail.com" 2}, :id 1}
 {:email {"d...@mail.com" 1}, :id 2}
 {:email {"g...@mail.com" 2}, :id 3}
 {:email {"f...@mail.com" 3}, :id 4}]
nil

   12.06.2013, 11:19, "Yoshinori Kohyama" : >  Solutions seem to depend on whether you have two or more mail addresses in a ':emails' section or not.>  If you have, you should identify the mail address of which you want to increment the value.>  Anyway, try below:>>  (dosync>    (alter result>      (fn [v]>        (mapv second>          (update-in (into {} (map #(vector (:id %) %) v))>            [1 :emails "a...@mail.com"]>            inc)>>  HTH,>  with regards,>  Yoshinori Kohyama>>  -->  -->  You received this message because you are subscribed to the Google>  Groups "Clojure" group.>  To post to this group, send email to clojure@googlegroups.com>  Note that posts from new members are moderated - please be patient with your first post.>  To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com.>  For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Re: Clojure in production

2013-06-11 Thread Plínio Balduino
Come on. JavaScript is an awesome and misunderstood language =)

Thank you all for your help. I have lots of examples to show where we're
using Clojure.

Plínio


On Jun 11, 2013 10:20 PM, "Eric MacAdie"  wrote:

> OT, but, personally, I look forward to a world free of Javascript.
>
> On Tue, Jun 11, 2013 at 4:38 AM, Bruce Durling  wrote:
>
>> Hey!
>>
>> Oh, and we use clojure for all of our stuff at Mastodon C that isn't
>> html or javascript and I think the javascript's days are numbered.
>>
>> cheers,
>> Bruce
>>
>> --
>> @otfrom | CTO & co-founder @MastodonC | mastodonc.com
>> See recent coverage of us in the Economist http://econ.st/WeTd2i and
>> the Financial Times http://on.ft.com/T154BA
>>
>>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: alter a map in a vector (reference)

2013-06-11 Thread Yoshinori Kohyama
Solutions seem to depend on whether you have two or more mail addresses in 
a ':emails' section or not.
If you have, you should identify the mail address of which you want to 
increment the value.
Anyway, try below:

(dosync
  (alter result
(fn [v]
  (mapv second
(update-in (into {} (map #(vector (:id %) %) v))
  [1 :emails "a...@mail.com"]
  inc)

HTH,
with regards,
Yoshinori Kohyama

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure in production

2013-06-11 Thread Eric MacAdie
OT, but, personally, I look forward to a world free of Javascript.

On Tue, Jun 11, 2013 at 4:38 AM, Bruce Durling  wrote:

> Hey!
>
> Oh, and we use clojure for all of our stuff at Mastodon C that isn't
> html or javascript and I think the javascript's days are numbered.
>
> cheers,
> Bruce
>
> --
> @otfrom | CTO & co-founder @MastodonC | mastodonc.com
> See recent coverage of us in the Economist http://econ.st/WeTd2i and
> the Financial Times http://on.ft.com/T154BA
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] Instaparse 1.1.0

2013-06-11 Thread Mark Engelberg
On Tue, Jun 11, 2013 at 3:33 PM, Andy Fingerhut wrote:

>
> I haven't done anything but think about it during commute time yet, but I
> had been wondering in how many situations it might be useful to have a
> string type that was something like Relaxed Radix Binary trees, in that
> they can be concatenated and substring'd in O(log n) worst case time, and
> yet substrings would only hold onto references of the parts that they
> explicitly refer to, and perhaps a little bit more (but not the entire
> original string).
>

"Ropes" have been around for a long time as an alternative to strings, with
fast concatenation and splitting.  RRB trees might be another, similar
route to the same goal.

I remember years ago hearing rave reports from people using Cedar (which
used ropes as its default string data type), saying it was wonderful to
have such a feature-rich string type (well, mainly they were excited about
the fast concatenation), so yes, I think it would likely be useful.  As I
recall, back in 2007, the ICFP Programming Contest was pretty much
impossible to solve unless your language had a rope implementation:
http://save-endo.cs.uu.nl/

Ropes, like strings, used to be destructive, but I think most new
implementations are immutable:

Relevant link:

http://www.ibm.com/developerworks/library/j-ropes/

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Brian Marick

On Jun 11, 2013, at 2:08 PM, Tj Gabbour  wrote:

> Interesting; these arguments sound oddly like those surrounding Common Lisp's 
> "loop" macro. When reading Midje's docs, I got the weird impression Brian was 
> aware of the history of "non-lispy" macros.

I was a Common Lisp user and implementor (on the Gould PowerNode computers!) in 
the early 80's. 

However, I'm still not sure what I think of `loop`.

I like `format`, though, in practice, despite despising it in principle.


Latest book: /Functional Programming for the Object-Oriented Programmer/
https://leanpub.com/fp-oo

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] Instaparse 1.1.0

2013-06-11 Thread Mark Engelberg
Here's another link:
http://java-performance.info/changes-to-string-java-1-7-0_06/

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: swap keys / values in hash map

2013-06-11 Thread Kelker Ryan
 This is the easiest way to swap the keys with the values in a hash-map.(defn flip-map [m]
	(zipmap (vals m) (keys m)))
#'user/flip-map
user> (def m1 (apply hash-map (range 8)))
#'user/m1
user> m1
{0 1, 2 3, 4 5, 6 7}
user> (def m2 (flip-map m1))
#'user/m2
user> m2
{7 6, 5 4, 3 2, 1 0} 11.06.2013, 14:30, "Michael-Keith Bernard" :An alternative implementation that shuffles all printable characters. This version returns the encryption map and generalizes the encrypt/decrypt functionality. https://gist.github.com/SegFaultAX/5754209On Tuesday, August 12, 2008 10:25:00 PM UTC-7, Joubert Nel wrote:Hello,  I have a hash map, and want to derive another map from it but with the key/value pairs swapped.  To do this, I wrote:  (def *reverseMap* (loop [result (hash-map)  keys (keys *myMap*)]     (if (== (count keys) 0)       result       (recur (merge result (hash-map (val (find *myMap* (first keys)))      (first keys)))      (rest keys)   It works fine, but I suspect there is a better way. Any suggestions?  Joubert --  --  You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.    



-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Brian Marick

On Jun 11, 2013, at 10:02 AM, JeremyS  wrote:

> Now, opinion time (more opinionated actually). Midje might be full of macros 
> and abstractions that I don't understand when I read the code. Hell it's full 
> of them. But I honestly never had to read it to write my tests. More It's 
> well documented and I there's is more functionality in the doc than I have 
> had to use. So congrats Brian.

The Midje code is more obfuscated than it should be. It is gradually improving. 
Just as I've had a goal that the Midje API should be well-documented and 
gracious towards its user, I'm starting to have the goal that the internals 
should encourage extension. Kudos to those who've contributed (especially Alex 
Baranosky and Joseph Wilk).


Latest book: /Functional Programming for the Object-Oriented Programmer/
https://leanpub.com/fp-oo

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] Instaparse 1.1.0

2013-06-11 Thread Andy Fingerhut
And to answer my own question about a reference for this change in
behavior, which appears to have been made in Java 7:


http://stackoverflow.com/questions/16123446/java-7-string-substring-complexity

Andy


On Tue, Jun 11, 2013 at 3:33 PM, Andy Fingerhut wrote:

> Mark,
>
> I had not heard about Java changing the substring operation from O(1) to
> O(n).  Do you have a link to any further info about this change?
>
> I'm guessing that the implementation is changing from the O(1) "create a
> new String object that is a reference to a portion of the original String
> object" to O(n) "create a new String object that is a copy of a portion of
> the original String object"?
>
> If so, note that it is undesirable in some cases that the O(1) substring
> operation works as it does, because it prevents the longer string from
> being GC'ed if it would become garbage, except for the fact that one has
> created and keeps substrings of it around.  One can explicitly call the
> String constructor to copy the substrings if you want to avoid that
> behavior, of course, so the O(1) with the O(n) fallback is more flexible in
> that it lets the developer aware of this behavior choose between them.
>
> I haven't done anything but think about it during commute time yet, but I
> had been wondering in how many situations it might be useful to have a
> string type that was something like Relaxed Radix Binary trees, in that
> they can be concatenated and substring'd in O(log n) worst case time, and
> yet substrings would only hold onto references of the parts that they
> explicitly refer to, and perhaps a little bit more (but not the entire
> original string).
>
> Andy
>
>
> On Tue, Jun 11, 2013 at 3:09 PM, Mark Engelberg 
> wrote:
>
>> Honestly I hadn't yet given it any thought.  Thanks for the interest in
>> having it on Clojurescript.  Here are a few issues that come to mind:
>>
>> 1.  To achieve performance, I've spent time coding custom data structures
>> that implement various Clojure and Java interfaces.  I haven't done much
>> with Clojurescript, but my impression is that the ecosystem of protocols is
>> completely different, so I imagine that could be a pain to transfer over.
>>
>> 2.  I don't know much about the performance of Javascript/Clojurescript's
>> underlying data structures.  For example, in Java, the substring operation
>> used to be O(1), but recently, much to my dismay, they changed it to O(n).
>> That change was annoying, and it means I'm going to have to rework some
>> code to deal with that, but at least I heard about it and can take it into
>> account.  But in Javascript I don't even *know* the performance
>> characteristics of its strings and substring operation.  What other
>> Javascript performance gotchas don't I know about?
>>
>> 3. I'm assuming that due to the above, it won't be as simple as just
>> recompiling the code for Clojurescript.  I have no idea what's involved
>> with maintaining a code base for the two target languages simultaneously.
>> Sounds non-trivial, although maybe it won't seem so intimidating once
>> things have settled down and I'm not making quite so many performance
>> tweaks and feature enhancements to the code.
>>
>> In any case, please add your request as a github issue, so I don't forget
>> about it.
>>
>>
>> On Tue, Jun 11, 2013 at 8:06 AM, JeremyS  wrote:
>>
>>> Hi Puzzler,
>>>
>>> I was wondering if you planned to port Instaparse to ClojureScript. I
>>> know it's asking a lot, but I am one of those who would love
>>> to be able to run it in a browser or in node.js...
>>>
>>> Cheers,
>>>
>>> Jeremys.
>>>
>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

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

Re: [ANN] Instaparse 1.1.0

2013-06-11 Thread Andy Fingerhut
Mark,

I had not heard about Java changing the substring operation from O(1) to
O(n).  Do you have a link to any further info about this change?

I'm guessing that the implementation is changing from the O(1) "create a
new String object that is a reference to a portion of the original String
object" to O(n) "create a new String object that is a copy of a portion of
the original String object"?

If so, note that it is undesirable in some cases that the O(1) substring
operation works as it does, because it prevents the longer string from
being GC'ed if it would become garbage, except for the fact that one has
created and keeps substrings of it around.  One can explicitly call the
String constructor to copy the substrings if you want to avoid that
behavior, of course, so the O(1) with the O(n) fallback is more flexible in
that it lets the developer aware of this behavior choose between them.

I haven't done anything but think about it during commute time yet, but I
had been wondering in how many situations it might be useful to have a
string type that was something like Relaxed Radix Binary trees, in that
they can be concatenated and substring'd in O(log n) worst case time, and
yet substrings would only hold onto references of the parts that they
explicitly refer to, and perhaps a little bit more (but not the entire
original string).

Andy


On Tue, Jun 11, 2013 at 3:09 PM, Mark Engelberg wrote:

> Honestly I hadn't yet given it any thought.  Thanks for the interest in
> having it on Clojurescript.  Here are a few issues that come to mind:
>
> 1.  To achieve performance, I've spent time coding custom data structures
> that implement various Clojure and Java interfaces.  I haven't done much
> with Clojurescript, but my impression is that the ecosystem of protocols is
> completely different, so I imagine that could be a pain to transfer over.
>
> 2.  I don't know much about the performance of Javascript/Clojurescript's
> underlying data structures.  For example, in Java, the substring operation
> used to be O(1), but recently, much to my dismay, they changed it to O(n).
> That change was annoying, and it means I'm going to have to rework some
> code to deal with that, but at least I heard about it and can take it into
> account.  But in Javascript I don't even *know* the performance
> characteristics of its strings and substring operation.  What other
> Javascript performance gotchas don't I know about?
>
> 3. I'm assuming that due to the above, it won't be as simple as just
> recompiling the code for Clojurescript.  I have no idea what's involved
> with maintaining a code base for the two target languages simultaneously.
> Sounds non-trivial, although maybe it won't seem so intimidating once
> things have settled down and I'm not making quite so many performance
> tweaks and feature enhancements to the code.
>
> In any case, please add your request as a github issue, so I don't forget
> about it.
>
>
> On Tue, Jun 11, 2013 at 8:06 AM, JeremyS  wrote:
>
>> Hi Puzzler,
>>
>> I was wondering if you planned to port Instaparse to ClojureScript. I
>> know it's asking a lot, but I am one of those who would love
>> to be able to run it in a browser or in node.js...
>>
>> Cheers,
>>
>> Jeremys.
>>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there an approved way for testing if something is a zipper?

2013-06-11 Thread Anthony Grimes
I wrote a function for this in 
laser. 
https://github.com/Raynes/laser/blob/e351444a09e5c81b900767e955edf62558c33fd6/src/me/raynes/laser/zip.clj#L38

(defn zipper?
  "Checks to see if the object has zip/make-node metadata on it (confirming it
   to be a zipper."
  [obj]
  (contains? (meta obj) :zip/make-node))

This is all you really need to do. Someone would have to go really out of their 
way to fake this, and if they do that then they probably did it on purpose and 
you shouldn't worry about it.




On Tuesday, June 11, 2013 2:20:38 PM UTC-7, Stefan Kamphausen wrote:
>
> Hi,
>
>
> while working on some XML data extraction I got an NPE which boiled down 
> to calling some zipper related functions on an empty vector or nil.  
>
> I didn't find a function in clojure.zip, clojure.data.zip or 
> clojure.data.zip.xml to test if an object passed to a function is actually 
> a zipper.  Am I missing something obvious?  How would you test this?  I 
> could try to call clojure.zip/node and catch the exception, but maybe there 
> is a better aproach.
>
>
> Kind regards,
> stefan
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Michał Marczyk
On 12 June 2013 00:08, Steven Degutis  wrote:
> Right now they both point to test2.api.asserters/*assertion-results*. But
> I'd really like to get rid of the concreteness of this if possible. But even
> throwing exceptions to indicate assertion results won't do, because the
> specific exception class to throw/catch is still too concrete.
>
> Anyone have any ideas?

Use ex-info / ex-data? (NB. ex-info optionally takes a cause argument,
so you can use it to wrap exceptions thrown from inside the
expressions under test.)

Cheers,
Michał


>
>
> On Sun, Jun 9, 2013 at 3:27 AM, Stuart Halloway 
> wrote:
>>
>> Hi Steven,
>>
>> A few thoughts:
>>
>> 1. You may want to look at
>> https://github.com/clojure/test.generative/blob/master/data-model.org.
>>
>> 2. I don't think you want a ref for *assertion-results* -- I am not aware
>> of any use cases that would need transactions. In any case the choice of
>> reference type probably belongs in the impl, not the spec.
>>
>> Good luck with this!
>> Stu
>>
>>
>> On Sat, Jun 8, 2013 at 4:14 PM, Steven Degutis 
>> wrote:
>>>
>>> Test2 is a new testing lib for Clojure, where the power is its
>>> simplicity, extensibility, and a SPEC much like Ring's.
>>>
>>> Github: https://github.com/evanescence/test2
>>>
>>> Some background: It came out of discussions with the smart folks in
>>> #clojure, who were frustrated with the inflexibility of existing libs, and
>>> intended this to be the spiritual successor to clojure.test. We wanted
>>> something that was still simple like clojure.test, but could be extended
>>> externally much more easily in case you wanted features found in
>>> clojure.test, Midje, Speclj, or Expectations, or whatever else.
>>>
>>> This is a pre-ANN because it's more of a call for extensions. I've
>>> written one last night, test2-autorunner, which took about an hour. This
>>> should give some idea of how easy it is and how well-designed the SPEC was
>>> by the smart folks of #clojure. There are some ideas at the bottom of the
>>> wiki, but of course any extensions are encouraged.
>>>
>>> -Steven
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more o

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Steven Degutis
Ah, you're right. Thanks for helping me understand.

Now, the runner and discoverer logic are separated.

Here's the function that calls the runner, passing in a finder:
https://github.com/evanescence/test2/blob/master/src/test2/run.clj
Here's the default runner, and how it uses the finder:
https://github.com/evanescence/test2/blob/master/src/test2/default/runner.clj


On Tue, Jun 11, 2013 at 5:12 PM, Michał Marczyk wrote:

> On 11 June 2013 14:42, Steven Degutis  wrote:
> > Timothy, Brandon, Cedric, et al.:
> >
> > Separating out the Discoverer from the Runner in the SPEC is a bad idea.
> >
> > The main benefit mentioned so far for such a separation is so we can have
> > different definitions of what constitutes a test. For example,
> > test.generative can generate multiple tests from just one block of code.
>
> At least in this thread, the key benefit -- IMO -- was mentioned by
> Brandon (a few e-mails upthread from the one I'm replying to):
>
> On 11 June 2013 01:53, Brandon Bloom  wrote:
> > I
> > might want to just ask "What tests do I have?" without actually running
> > anyway. I may also want a different Executor, like a distributed/parallel
> > executor, while preserving the discovery logic.
>
> So, even if the discovery logic was completely fixed by the spec,
> there's still value in having it separated from the runner.
>
> (For example with clojure.test it's trivial to discover what tests are
> available without running any -- (->> 'test.ns ns-interns vals (filter
> (comp :test meta))). I imagine it'll probably be the case with any
> other framework, but if this effort is specifically about decoupling,
> why have every separate runner reimplement the same discovery logic?)
>
> Cheers,
> Michał
>
>
> >
> > But this creates the same incompatibility problem that we already have
> > between existing test suites. Instead, if we have a single definition of
> a
> > test, every definer is compatible with another.
> >
> > And the current definition is already flexible enough to let you generate
> > multiple tests based on one block of code, like test.generative does.
> >
> >
> > On Tue, Jun 11, 2013 at 1:57 AM, Cedric Greevey 
> wrote:
> >>
> >> You pass not the Discoverer's results to the Runner, but the Discoverer
> >> itself, which the Runner then invokes at need, possibly more than once.
> >>
> >>
> >> On Tue, Jun 11, 2013 at 1:35 AM, Steven Degutis 
> >> wrote:
> >>>
> >>> Originally we had Runner split into Discoverer and Runner, but I had to
> >>> combine them both in Runner again so that we can have an autorunner.
> >>>
> >>> Imagine that you've started your autorunner at the command line, and
> you
> >>> create a new test in your existing file and save it. The discoverer has
> >>> already done his role and found all existing tests and passed them to
> the
> >>> runner, so the runner can't see your new test, he only re-runs the
> tests
> >>> that existed when he first started.
> >>>
> >>> That's why I combined them again. So that he could re-discover all the
> >>> tests "matching some criteria" and run them.
> >>>
> >>> So how do you solve this problem while separating Discoverer from
> Runner?
> >>>
> >>>
> >>> On Mon, Jun 10, 2013 at 6:53 PM, Brandon Bloom
> >>>  wrote:
> 
>  There are currently 4 roles defined: Definer, Asserter, Runner, and
>  Reporter.
> 
>  It looks like the "Runner" does finding, filtering, and execution. I
>  think you could further break the Runner down into Discoverer and
> Executor.
>  I might want to just ask "What tests do I have?" without actually
> running
>  anyway. I may also want a different Executor, like a
> distributed/parallel
>  executor, while preserving the discovery logic.
> 
>  On Saturday, June 8, 2013 11:14:42 AM UTC-4, Steven Degutis wrote:
> >
> > Test2 is a new testing lib for Clojure, where the power is its
> > simplicity, extensibility, and a SPEC much like Ring's.
> >
> > Github: https://github.com/evanescence/test2
> >
> > Some background: It came out of discussions with the smart folks in
> > #clojure, who were frustrated with the inflexibility of existing
> libs, and
> > intended this to be the spiritual successor to clojure.test. We
> wanted
> > something that was still simple like clojure.test, but could be
> extended
> > externally much more easily in case you wanted features found in
> > clojure.test, Midje, Speclj, or Expectations, or whatever else.
> >
> > This is a pre-ANN because it's more of a call for extensions. I've
> > written one last night, test2-autorunner, which took about an hour.
> This
> > should give some idea of how easy it is and how well-designed the
> SPEC was
> > by the smart folks of #clojure. There are some ideas at the bottom
> of the
> > wiki, but of course any extensions are encouraged.
> >
> > -Steven
> 
>  --
>  --
>  You received this message because you are subscribed to 

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Michał Marczyk
On 11 June 2013 14:42, Steven Degutis  wrote:
> Timothy, Brandon, Cedric, et al.:
>
> Separating out the Discoverer from the Runner in the SPEC is a bad idea.
>
> The main benefit mentioned so far for such a separation is so we can have
> different definitions of what constitutes a test. For example,
> test.generative can generate multiple tests from just one block of code.

At least in this thread, the key benefit -- IMO -- was mentioned by
Brandon (a few e-mails upthread from the one I'm replying to):

On 11 June 2013 01:53, Brandon Bloom  wrote:
> I
> might want to just ask "What tests do I have?" without actually running
> anyway. I may also want a different Executor, like a distributed/parallel
> executor, while preserving the discovery logic.

So, even if the discovery logic was completely fixed by the spec,
there's still value in having it separated from the runner.

(For example with clojure.test it's trivial to discover what tests are
available without running any -- (->> 'test.ns ns-interns vals (filter
(comp :test meta))). I imagine it'll probably be the case with any
other framework, but if this effort is specifically about decoupling,
why have every separate runner reimplement the same discovery logic?)

Cheers,
Michał


>
> But this creates the same incompatibility problem that we already have
> between existing test suites. Instead, if we have a single definition of a
> test, every definer is compatible with another.
>
> And the current definition is already flexible enough to let you generate
> multiple tests based on one block of code, like test.generative does.
>
>
> On Tue, Jun 11, 2013 at 1:57 AM, Cedric Greevey  wrote:
>>
>> You pass not the Discoverer's results to the Runner, but the Discoverer
>> itself, which the Runner then invokes at need, possibly more than once.
>>
>>
>> On Tue, Jun 11, 2013 at 1:35 AM, Steven Degutis 
>> wrote:
>>>
>>> Originally we had Runner split into Discoverer and Runner, but I had to
>>> combine them both in Runner again so that we can have an autorunner.
>>>
>>> Imagine that you've started your autorunner at the command line, and you
>>> create a new test in your existing file and save it. The discoverer has
>>> already done his role and found all existing tests and passed them to the
>>> runner, so the runner can't see your new test, he only re-runs the tests
>>> that existed when he first started.
>>>
>>> That's why I combined them again. So that he could re-discover all the
>>> tests "matching some criteria" and run them.
>>>
>>> So how do you solve this problem while separating Discoverer from Runner?
>>>
>>>
>>> On Mon, Jun 10, 2013 at 6:53 PM, Brandon Bloom
>>>  wrote:

 There are currently 4 roles defined: Definer, Asserter, Runner, and
 Reporter.

 It looks like the "Runner" does finding, filtering, and execution. I
 think you could further break the Runner down into Discoverer and Executor.
 I might want to just ask "What tests do I have?" without actually running
 anyway. I may also want a different Executor, like a distributed/parallel
 executor, while preserving the discovery logic.

 On Saturday, June 8, 2013 11:14:42 AM UTC-4, Steven Degutis wrote:
>
> Test2 is a new testing lib for Clojure, where the power is its
> simplicity, extensibility, and a SPEC much like Ring's.
>
> Github: https://github.com/evanescence/test2
>
> Some background: It came out of discussions with the smart folks in
> #clojure, who were frustrated with the inflexibility of existing libs, and
> intended this to be the spiritual successor to clojure.test. We wanted
> something that was still simple like clojure.test, but could be extended
> externally much more easily in case you wanted features found in
> clojure.test, Midje, Speclj, or Expectations, or whatever else.
>
> This is a pre-ANN because it's more of a call for extensions. I've
> written one last night, test2-autorunner, which took about an hour. This
> should give some idea of how easy it is and how well-designed the SPEC was
> by the smart folks of #clojure. There are some ideas at the bottom of the
> wiki, but of course any extensions are encouraged.
>
> -Steven

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

Re: [ANN] Instaparse 1.1.0

2013-06-11 Thread Mark Engelberg
Honestly I hadn't yet given it any thought.  Thanks for the interest in
having it on Clojurescript.  Here are a few issues that come to mind:

1.  To achieve performance, I've spent time coding custom data structures
that implement various Clojure and Java interfaces.  I haven't done much
with Clojurescript, but my impression is that the ecosystem of protocols is
completely different, so I imagine that could be a pain to transfer over.

2.  I don't know much about the performance of Javascript/Clojurescript's
underlying data structures.  For example, in Java, the substring operation
used to be O(1), but recently, much to my dismay, they changed it to O(n).
That change was annoying, and it means I'm going to have to rework some
code to deal with that, but at least I heard about it and can take it into
account.  But in Javascript I don't even *know* the performance
characteristics of its strings and substring operation.  What other
Javascript performance gotchas don't I know about?

3. I'm assuming that due to the above, it won't be as simple as just
recompiling the code for Clojurescript.  I have no idea what's involved
with maintaining a code base for the two target languages simultaneously.
Sounds non-trivial, although maybe it won't seem so intimidating once
things have settled down and I'm not making quite so many performance
tweaks and feature enhancements to the code.

In any case, please add your request as a github issue, so I don't forget
about it.

On Tue, Jun 11, 2013 at 8:06 AM, JeremyS  wrote:

> Hi Puzzler,
>
> I was wondering if you planned to port Instaparse to ClojureScript. I know
> it's asking a lot, but I am one of those who would love
> to be able to run it in a browser or in node.js...
>
> Cheers,
>
> Jeremys.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Steven Degutis
Thanks for that link Stu. It's quite a lot to take in but it's very useful.

As for *assertion-results*, it seems this has to be in the implementation,
because both Asserters and Runners need a concrete but detached way to
communicate.

Right now they both point to
test2.api.asserters/*assertion-results*.
But I'd really like to get rid of the concreteness of this if possible. But
even throwing exceptions to indicate assertion results won't do, because
the specific exception class to throw/catch is still too concrete.

Anyone have any ideas?


On Sun, Jun 9, 2013 at 3:27 AM, Stuart Halloway
wrote:

> Hi Steven,
>
> A few thoughts:
>
> 1. You may want to look at
> https://github.com/clojure/test.generative/blob/master/data-model.org.
>
> 2. I don't think you want a ref for *assertion-results* -- I am not aware
> of any use cases that would need transactions. In any case the choice of
> reference type probably belongs in the impl, not the spec.
>
> Good luck with this!
> Stu
>
>
> On Sat, Jun 8, 2013 at 4:14 PM, Steven Degutis wrote:
>
>> Test2 is a new testing lib for Clojure, where the power is its
>> simplicity, extensibility, and a 
>> SPEC much
>> like Ring's.
>>
>> Github: https://github.com/evanescence/test2
>>
>> Some background: It came out of 
>> discussions
>>  with
>> the smart folks in #clojure, who were frustrated with the inflexibility of
>> existing libs, and intended this to be the spiritual successor to
>> clojure.test. We wanted something that was still simple like clojure.test,
>> but could be extended externally much more easily in case you wanted
>> features found in clojure.test, Midje, Speclj, or Expectations, or whatever
>> else.
>>
>> This is a pre-ANN because it's more of a call for extensions. I've
>> written one last night, 
>> test2-autorunner,
>> which took about an hour. This should give some idea of how easy it is and
>> how well-designed the SPEC was by the smart folks of #clojure. There are
>> some ideas at the bottom of the wiki, but of course any extensions are
>> encouraged.
>>
>> -Steven
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there an approved way for testing if something is a zipper?

2013-06-11 Thread Michael-Keith Bernard
If you're using clojure.zip then a zipper is merely a vector with 3 
specific keys (:zip/make-node, :zip/children, and :zip/branch?) in the 
metadata which the zipper algorithms use to manipulate and traverse the 
data structure. You can trivially check using something like (and (vector? 
z) (every? #(contains? (meta z) %) [:zip/make-node :zip/children 
:zip/branch?])) but there is no official way that I'm aware of that 
encapsulates this functionality already.

On Tuesday, June 11, 2013 2:20:38 PM UTC-7, Stefan Kamphausen wrote:
>
> Hi,
>
>
> while working on some XML data extraction I got an NPE which boiled down 
> to calling some zipper related functions on an empty vector or nil.  
>
> I didn't find a function in clojure.zip, clojure.data.zip or 
> clojure.data.zip.xml to test if an object passed to a function is actually 
> a zipper.  Am I missing something obvious?  How would you test this?  I 
> could try to call clojure.zip/node and catch the exception, but maybe there 
> is a better aproach.
>
>
> Kind regards,
> stefan
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Steven Degutis
As of this moment, it's usable for writing test suites.

The readme is a lot cleaner now: https://github.com/evanescence/test2
The spec is a lot shoerter now:
https://github.com/evanescence/test2/blob/master/SPEC.md
There's a working auto-runner extension:
https://github.com/evanescence/test2-autorunner

You can write tests one of the 3 ways shown in the wiki.
You can use (test2.expect/expect) or (test2.mimic.clojure-test/is) for
making assertions.

Next is to work on making the default reporter better.


On Tue, Jun 11, 2013 at 3:18 PM, Brandon Bloom wrote:

> > Maybe it makes sense to separate out the 'common testing interop' effort
> > from the 'another test framework' effort, so it can can get off the
> ground?
>
> I agree with this. It's easier to solve fewer problems at once. Maybe
> you should reduce the scope to just the common result reporting
> schema? At least for the first try at this.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: expectations documentation

2013-06-11 Thread Jay Fields
Thanks for the report Phillip, I've pushed an update that I hope addresses 
your issue. Let me know if things aren't fixed.

Cheers, Jay

On Tuesday, June 11, 2013 4:51:08 PM UTC-4, Phillip Lord wrote:
>
> I can't get the nav bar on the left to scroll -- so I can't get to all the 
> documentation. The bottom two 
> also overlap the "isn't github fun" links. 
>
> Haven't seen expectations before. Looks really nice. 
>
> Phil 
>  
> From: clo...@googlegroups.com  
> [clo...@googlegroups.com] 
> on behalf of Jay Fields [j...@jayfields.com ] 
> Sent: 11 June 2013 19:39 
> To: clo...@googlegroups.com  
> Subject: expectations documentation 
>
> expectations* has always had a decent amount of documentation; however, 
> it's traditionally been in the form of blog entries. 
>
> I spent a bit of time and converted those entries into the following site: 
> http://jayfields.com/expectations/index.html 
>
> If you've never looked at expectations and you'd like an alternative to 
> clojure.test, you might want to look at the 10 second example. If the 10 
> second example looks interesting, take 2 minutes to read the introduction - 
> that should give you an idea of whether or not you should invest more in 
> expectations. 
>
> Cheers, Jay 
>
> -- 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Clojure" group. 
> To post to this group, send email to clo...@googlegroups.com  
> Note that posts from new members are moderated - please be patient with 
> your first post. 
> To unsubscribe from this group, send email to 
> clojure+u...@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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+u...@googlegroups.com . 
> For more options, visit https://groups.google.com/groups/opt_out. 
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-11 Thread Michael-Keith Bernard
Ok fair enough. Check out the updated gist, I think it more exactly fits 
your guidelines.

https://gist.github.com/SegFaultAX/5754209

(defn crypt-range [low high]
  (let [chars (map char (range low high))]
(zipmap chars (shuffle chars
 
(defn make-crypto []
  (let [ranges [[97 123] [65 91] [48 58]]]
(apply merge (map #(apply crypt-range %) ranges
 
(defn encrypt [crypto s]
  "Encrypt string with crypto map"
  (apply str (map #(crypto % %) s)))
 (defn decrypt [crypto s]
  "Decrypt string with crypto map"
  (let [decrypto (clojure.set/map-invert crypto)]
(apply str (map #(decrypto % %) s
 
(comment
  (def crypt (make-crypto))
 
  (encrypt crypt "hello GOODBYE 12345")
  (decrypt crypt (encrypt crypt "still reversible!"))
)


On Monday, June 10, 2013 6:16:03 PM UTC-7, Shannon Severance wrote:
>
> I'm new to Clojure, but with some lisp experience, I've dabbled in Scheme 
> for a few years. Used Racket earlier this year for a couple of sectoins of 
> a MOOC. And occasionally write Emacs lisp.
>
> The idea is to create cyptograms. 
> These are word puzzles using simple ciphers, and not meant for keeping real 
> secrets.
>
> ;;  -> (String -> String)
> ;; Returns a function that takes a string and produces a cryptogram.
> ;; Multiple calls to make-crypto will return different cryptos 
> ;; each with different substitution keys. Multiple calls to a given
> ;; crypto returned by make-crypto will use the same substitution key.
> (defn make-crypto []
>   (let [lower (seq "abcdefghijklmnopqrstuvwxyz")
> upper (seq "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
> digit (seq "0123456789")
>
> shuffled-lower (shuffle lower)
> shuffled-upper (shuffle upper)
> shuffled-digit (shuffle digit)
>
> encrypt (reduce 
>  conj 
>  (map (partial assoc {}) 
>   (concat lower upper digit) 
>   (concat shuffled-lower shuffled-upper 
> shuffled-digit)))]
> (fn [s]
>   (apply str (map #(encrypt % %) s)
>
> To me, it looks like too much code in defining the encrypt map. But I do 
> not know how.
>
> -- Shannon
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Is there an approved way for testing if something is a zipper?

2013-06-11 Thread Stefan Kamphausen
Hi,


while working on some XML data extraction I got an NPE which boiled down to 
calling some zipper related functions on an empty vector or nil.  

I didn't find a function in clojure.zip, clojure.data.zip or 
clojure.data.zip.xml to test if an object passed to a function is actually 
a zipper.  Am I missing something obvious?  How would you test this?  I 
could try to call clojure.zip/node and catch the exception, but maybe there 
is a better aproach.


Kind regards,
stefan

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




RE: expectations documentation

2013-06-11 Thread Phillip Lord
I can't get the nav bar on the left to scroll -- so I can't get to all the 
documentation. The bottom two 
also overlap the "isn't github fun" links.

Haven't seen expectations before. Looks really nice.

Phil

From: clojure@googlegroups.com [clojure@googlegroups.com] on behalf of Jay 
Fields [j...@jayfields.com]
Sent: 11 June 2013 19:39
To: clojure@googlegroups.com
Subject: expectations documentation

expectations* has always had a decent amount of documentation; however, it's 
traditionally been in the form of blog entries.

I spent a bit of time and converted those entries into the following site: 
http://jayfields.com/expectations/index.html

If you've never looked at expectations and you'd like an alternative to 
clojure.test, you might want to look at the 10 second example. If the 10 second 
example looks interesting, take 2 minutes to read the introduction - that 
should give you an idea of whether or not you should invest more in 
expectations.

Cheers, Jay

--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Sean Corfield
That was what I was suggesting the other day... I see more value in
providing a standardizing test result format and better reporting
tools / integration with IDEs etc than in YATF (Yet Another testing
Framework).

On Tue, Jun 11, 2013 at 1:18 PM, Brandon Bloom
 wrote:
>> Maybe it makes sense to separate out the 'common testing interop' effort
>> from the 'another test framework' effort, so it can can get off the ground?
>
> I agree with this. It's easier to solve fewer problems at once. Maybe
> you should reduce the scope to just the common result reporting
> schema? At least for the first try at this.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-11 Thread Shannon Severance
Thank you. I will sit down with the code and Clojure references to figure 
out what it is doing. 

For this problem, I don't want to use the full printable range. That would 
make the word problem too difficult. I specifically set mine up to 
substitute UPPER for UPPER, lower for lower, digit for digit, and then 
preserve any other characters, (spacing punctuation etc.) as is, to 
decrease the diffieculty.

On Monday, June 10, 2013 8:00:41 PM UTC-7, Michael-Keith Bernard wrote:
>
> Here is an alternative implementation that generalizes the encrypt/decrypt 
> functionality. It also uses all printable characters for the source 
> dictionary.
>
> https://gist.github.com/SegFaultAX/5754209
>
> P.S. I accidentally posted this as a reply to an older question I happened 
> to have open.
>
> On Monday, June 10, 2013 6:16:03 PM UTC-7, Shannon Severance wrote:
>>
>> I'm new to Clojure, but with some lisp experience, I've dabbled in Scheme 
>> for a few years. Used Racket earlier this year for a couple of sectoins of 
>> a MOOC. And occasionally write Emacs lisp.
>>
>> The idea is to create cyptograms. 
>> These are word puzzles using simple ciphers, and not meant for keeping real 
>> secrets.
>>
>> ;;  -> (String -> String)
>> ;; Returns a function that takes a string and produces a cryptogram.
>> ;; Multiple calls to make-crypto will return different cryptos 
>> ;; each with different substitution keys. Multiple calls to a given
>> ;; crypto returned by make-crypto will use the same substitution key.
>> (defn make-crypto []
>>   (let [lower (seq "abcdefghijklmnopqrstuvwxyz")
>> upper (seq "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
>> digit (seq "0123456789")
>>
>> shuffled-lower (shuffle lower)
>> shuffled-upper (shuffle upper)
>> shuffled-digit (shuffle digit)
>>
>> encrypt (reduce 
>>  conj 
>>  (map (partial assoc {}) 
>>   (concat lower upper digit) 
>>   (concat shuffled-lower shuffled-upper 
>> shuffled-digit)))]
>> (fn [s]
>>   (apply str (map #(encrypt % %) s)
>>
>> To me, it looks like too much code in defining the encrypt map. But I do 
>> not know how.
>>
>> -- Shannon
>>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: expectations documentation

2013-06-11 Thread Jay Fields
No worries. It's been on my todo list for awhile, and confusion about features 
motivated the actual effort. 

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




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Brandon Bloom
> Maybe it makes sense to separate out the 'common testing interop' effort
> from the 'another test framework' effort, so it can can get off the ground?

I agree with this. It's easier to solve fewer problems at once. Maybe
you should reduce the scope to just the common result reporting
schema? At least for the first try at this.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Steven Degutis
Good idea. Thanks guys, I'll do that.


On Tue, Jun 11, 2013 at 3:18 PM, Brandon Bloom wrote:

> > Maybe it makes sense to separate out the 'common testing interop' effort
> > from the 'another test framework' effort, so it can can get off the
> ground?
>
> I agree with this. It's easier to solve fewer problems at once. Maybe
> you should reduce the scope to just the common result reporting
> schema? At least for the first try at this.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Gary Trakhman
2 cents, I don't see the value in mixing and matching lower-level
constructs between test frameworks, which also sounds hard.  I see a lot of
value in what the SPEC provides, standardized test-reporting, metadata and
runner infra. This makes tooling's life easier, and would ease the burden
of using multiple test frameworks in a single project.

Maybe it makes sense to separate out the 'common testing interop' effort
from the 'another test framework' effort, so it can can get off the ground?


On Tue, Jun 11, 2013 at 4:09 PM, Steven Degutis  wrote:

> One of the goals is to create extensions that mimic each existing
> test-lib, so that migrating to test2 just means changing your :requires.
>
> But there are some tricky spots:
>
> 1. I don't fully understand how clojure.test's fixtures plays into its
> ability to call test functions from within other test functions.
>
> This probably just requires lots of experimenting and taking extensive
> notes. Tedious but possible.
>
>
> 2. clojure.test's once-fixtures can't be done with the current incarnation
> of the SPEC.
>
> We may be able to add a simple special-case to the Runner and Test-fn
> portion of the spec to make it work.
>
> I'm just worried about being too biased toward clojure.test in this, and
> hard-coding something into the spec that no other extension will ever
> need/want.
>
>
> 3. Midje has the ability to use the infix => anywhere any number of times
> within (fact), which means we can't implement (fact) as a simple
> macro/function.
>
> We can probably just do whatever Midje itself does to make this work.
>
>
> 4. Both Expectations and Midje allow making assertions at the top-level,
> but the spec only lets them exist within a test-fn's execution.
>
> A possible solution is to make (expect) and (fact) have two roles: the
> assertion, as well as conditionally def'ing vars if they aren't already
> inside one.
>
> Another solution is to change the spec to allow making assertions anywhere
> at any time. Several people expressed concerns about the undue complexity
> this would add, and I agree.
>
>
>
> On Sat, Jun 8, 2013 at 10:14 AM, Steven Degutis wrote:
>
>> Test2 is a new testing lib for Clojure, where the power is its
>> simplicity, extensibility, and a 
>> SPEC much
>> like Ring's.
>>
>> Github: https://github.com/evanescence/test2
>>
>> Some background: It came out of 
>> discussions
>>  with
>> the smart folks in #clojure, who were frustrated with the inflexibility of
>> existing libs, and intended this to be the spiritual successor to
>> clojure.test. We wanted something that was still simple like clojure.test,
>> but could be extended externally much more easily in case you wanted
>> features found in clojure.test, Midje, Speclj, or Expectations, or whatever
>> else.
>>
>> This is a pre-ANN because it's more of a call for extensions. I've
>> written one last night, 
>> test2-autorunner,
>> which took about an hour. This should give some idea of how easy it is and
>> how well-designed the SPEC was by the smart folks of #clojure. There are
>> some ideas at the bottom of the wiki, but of course any extensions are
>> encouraged.
>>
>> -Steven
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Steven Degutis
One of the goals is to create extensions that mimic each existing test-lib,
so that migrating to test2 just means changing your :requires.

But there are some tricky spots:

1. I don't fully understand how clojure.test's fixtures plays into its
ability to call test functions from within other test functions.

This probably just requires lots of experimenting and taking extensive
notes. Tedious but possible.


2. clojure.test's once-fixtures can't be done with the current incarnation
of the SPEC.

We may be able to add a simple special-case to the Runner and Test-fn
portion of the spec to make it work.

I'm just worried about being too biased toward clojure.test in this, and
hard-coding something into the spec that no other extension will ever
need/want.


3. Midje has the ability to use the infix => anywhere any number of times
within (fact), which means we can't implement (fact) as a simple
macro/function.

We can probably just do whatever Midje itself does to make this work.


4. Both Expectations and Midje allow making assertions at the top-level,
but the spec only lets them exist within a test-fn's execution.

A possible solution is to make (expect) and (fact) have two roles: the
assertion, as well as conditionally def'ing vars if they aren't already
inside one.

Another solution is to change the spec to allow making assertions anywhere
at any time. Several people expressed concerns about the undue complexity
this would add, and I agree.



On Sat, Jun 8, 2013 at 10:14 AM, Steven Degutis  wrote:

> Test2 is a new testing lib for Clojure, where the power is its simplicity,
> extensibility, and a 
> SPEC much
> like Ring's.
>
> Github: https://github.com/evanescence/test2
>
> Some background: It came out of 
> discussions 
> with
> the smart folks in #clojure, who were frustrated with the inflexibility of
> existing libs, and intended this to be the spiritual successor to
> clojure.test. We wanted something that was still simple like clojure.test,
> but could be extended externally much more easily in case you wanted
> features found in clojure.test, Midje, Speclj, or Expectations, or whatever
> else.
>
> This is a pre-ANN because it's more of a call for extensions. I've written
> one last night, 
> test2-autorunner,
> which took about an hour. This should give some idea of how easy it is and
> how well-designed the SPEC was by the smart folks of #clojure. There are
> some ideas at the bottom of the wiki, but of course any extensions are
> encouraged.
>
> -Steven
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure in production

2013-06-11 Thread Softaddicts
Ok, my turn to let some testosterone out :)

Presently migrating to 1.5.1 from 1.3

Around 8500 slocs with another 3000 slocs of custom DSL definitions.
Less than 1000 lines of unit tests, increasing slowly.

132 namespaces
166 atoms/refs
226 vars
170 private fns
585 public fns
46 macros

Some yet unqualified slocs of ClojureScript.

Luc P.



> The latest data from World Singles llc (which is listed on that
> Success Stories page):
> > Clojure source 76 files 13178 total loc, 1064 fns, 554 of which are
> private, 152 vars, 2 macros, 17 atoms
> Clojure tests 37 files 3016 total loc
> Clojure WebDriver tests 11 files 371 total loc
> > We're on Clojure 1.5.1 in production now. We started with 1.3.0 Alpha
> 7 (or 8?) and have upgraded pretty much immediately as each final
> build has become available (we skipped 1.5.0 due to the memory leak
> that was identified - and fixed in 1.5.1).
> > We generally do multi-version testing so we can easily migrate to each
> version as it is released.
> > Sean
> > > On Mon, Jun 10, 2013 at 3:17 PM, Plínio Balduino  
> > > wrote:
> > Thanks. I went there before ask here =)
> >
> > Plínio
> >
> > On Jun 10, 2013 6:58 PM, "Softaddicts"  wrote:
> >>
> >> Look at this:
> >>
> >> http://dev.clojure.org/display/community/Clojure+Success+Stories
> >>
> >> Luc
> >>
> >>
> >> > Hi there
> >> > > I'm writing a talk about Clojure in the real world and I would like to
> >> > know, if possible, which companies are using Clojure for production or
> >> > to make internal tools.
> >> > > Thank you
> >> > > Plínio Balduino
> >> > > -- > -- > You received this message because you are subscribed to the
> >> > > Google
> >> > Groups "Clojure" group.
> >> > To post to this group, send email to clojure@googlegroups.com
> >> > Note that posts from new members are moderated - please be patient with
> >> > your first post.
> >> > To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send
> >> > an email to clojure+unsubscr...@googlegroups.com.
> >> > For more options, visit https://groups.google.com/groups/opt_out.
> >> > > > --
> >> Softaddicts sent by ibisMail from my ipad!
> >>
> >> --
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Clojure" group.
> >> To post to this group, send email to clojure@googlegroups.com
> >> Note that posts from new members are moderated - please be patient with
> >> your first post.
> >> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> >> email to clojure+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/groups/opt_out.
> >>
> >>
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with your
> > first post.
> > To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> > email to clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> > > > -- > 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
> --- > You received this message because you are subscribed to the Google 
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
> > > --
S

Re: what directs the program in my-website progream to execute the various files, welcome, users?

2013-06-11 Thread Michael-Keith Bernard
Re-paste for formatting:

;;  project.clj
(defproject my-website "0.1.0-SNAPSHOT"
  :description "my Noir website"
  :dependencies [[org.clojure/clojure "1.3.0"]
 [noir "1.3.0-beta3"]
 [org.clojure/java.jdbc "0.2.3"]
 [mysql/mysql-connector-java "5.1.6"]] 
  :main my-website.server)
 
;; db.clj
(ns my-website.models.db
  (:require [clojure.java.jdbc :as sql]))
(def db {:classname "com.mysql.jdbc.Driver"
 :subprotocol "mysql"
 :subname "//localhost:8080/world"
 :user "root"
 :password "pass"})
(defn init-db []
  (try
(sql/with-connection
  db
  (sql/create-table
:users
[:id "SERIAL"]
[:handle "varchar(100)"]
[:pass "varchar(100)"]))
(catch Exception ex
  (.getMessage (.getNextException ex)
 
 
(defn db-read
  "returns the result of running the supplied SQL query"
  [query & args]
  (sql/with-connection 
db
(sql/with-query-results res (vec (cons query args)) (doall res
 
(defn add-user [user]
  (sql/with-connection 
db
(sql/insert-record :users user)))
 
(defn get-user [handle]
  (first (db-read "select * from users where handle=?" handle)))
 
;; server.clj
(ns my-website.server
  (:require [noir.server :as server])
  (:gen-class))
 
(server/load-views "src/my_website/views/")
 
(defn -main [& m]
  (let [mode (keyword (or (first m) :dev))
port (Integer. (get (System/getenv) "PORT" "8080"))]
(server/start port {:mode mode
:ns 'my-website})))
;; welcome.clj
ns my-website.views.welcome
(:require [my-website.views.common :as common])
(:use [noir.core :only [defpage]]
  hiccup.core hiccup.form))
 
(defpage "/" []
  (common/layout 
))
 
(defpage "/welcome" {:keys [greeting]}
  (common/layout
(if greeting [:h2 greeting]) 
(form-to [:post "/welcome"]
 (label "name" "name")
 (text-field "name")
 (submit-button "submit"
 
(defpage [:post "/welcome"] {:keys [name]}
  (noir.core/render "/welcome" {:greeting (str "Welcome " name)}))
 
;; common.clj
(ns my-website.views.common
  (:use [noir.core :only [defpartial]]
hiccup.element 
hiccup.form
[hiccup.page :only [include-css html5]])
  (:require [noir.session :as session]))
 
(defn login-form []
  (form-to [:post "/login"] 
   (text-field {:placeholder "user id"} "handle") 
   (password-field {:placeholder "password"} "pass") 
   (submit-button "login")))
 
(defpartial layout [& content]
  (html5
[:head
 [:title "my-website"]
 (include-css "/css/reset.css")]
[:body 
 (if-let [user (session/get :user)]
   [:h2 "welcome " user 
(form-to [:post "/logout"] (submit-button "logout"))]
   [:div.login
(login-form) [:p "or"] (link-to "/signup" "sign up")])
 
 content]))
 
;; users.clj
(ns my-website.views.users
  (:use [noir.core]
hiccup.core hiccup.form)
  (:require [my-website.views.common :as common]
[my-website.models.db :as db]
[noir.util.crypt :as crypt]
[noir.session :as session]
[noir.response :as resp]))
 
(defpage "/signup" {:keys [handle error]}
  (common/layout
[:div.error error]
(form-to [:post "/signup"]
 (label "user-id" "user id")
 (text-field "handle" handle)
 [:br]
 (label "pass" "password")
 (password-field "pass") 
 [:br]
 (submit-button "create account"
 
(defpage [:post "/signup"] user
  (try 
(db/add-user (update-in user [:pass] crypt/encrypt))
(resp/redirect "/")
(catch Exception ex
  (render "/signup" (assoc user :error (.getMessage ex))
 
(defpage [:post "/login"] {:keys [handle pass]}
  (render "/" 
  (let [user (db/get-user handle)] 
(if (and user (crypt/compare pass (:pass user))) 
  (session/put! :user handle)
  {:handle handle :error "login failed"}
 
(defpage [:post "/logout"] []
  (session/clear!)
  (resp/redirect "/"))


On Tuesday, June 11, 2013 5:32:46 AM UTC-7, jayvandal wrote:
>
> what statements makes the program execute.
> The main statement tells the program to execute server file
> what statements in the server file tell the program to run the welcome 
> file ? the user file
>

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

Re: what directs the program in my-website progream to execute the various files, welcome, users?

2013-06-11 Thread jayvandal
I put the code in my reply hope you can tell me how clojure works

On Tuesday, June 11, 2013 12:53:16 PM UTC-6, Michael-Keith Bernard wrote:
>
> Without some code it would be impossible for us to speculate about how 
> your program operates. Please provide the relevant source code and we can 
> easily help you trace the flow of execution.
>
> On Tuesday, June 11, 2013 5:32:46 AM UTC-7, jayvandal wrote:
>>
>> what statements makes the program execute.
>> The main statement tells the program to execute server file
>> what statements in the server file tell the program to run the welcome 
>> file ? the user file
>>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure in production

2013-06-11 Thread Chris Wilson
Hi,

At Planspot.com we're migrating some old code to Clojure and writing most
new backend code in it.  So far that is some API components for recording
and serving statistical data and the backend of a contact aggregation,
enrichment and management system.

Cheers,

Chris


On 11 June 2013 20:08, Sean Corfield  wrote:

> The latest data from World Singles llc (which is listed on that
> Success Stories page):
>
> Clojure source 76 files 13178 total loc, 1064 fns, 554 of which are
> private, 152 vars, 2 macros, 17 atoms
> Clojure tests 37 files 3016 total loc
> Clojure WebDriver tests 11 files 371 total loc
>
> We're on Clojure 1.5.1 in production now. We started with 1.3.0 Alpha
> 7 (or 8?) and have upgraded pretty much immediately as each final
> build has become available (we skipped 1.5.0 due to the memory leak
> that was identified - and fixed in 1.5.1).
>
> We generally do multi-version testing so we can easily migrate to each
> version as it is released.
>
> Sean
>
>
> On Mon, Jun 10, 2013 at 3:17 PM, Plínio Balduino 
> wrote:
> > Thanks. I went there before ask here =)
> >
> > Plínio
> >
> > On Jun 10, 2013 6:58 PM, "Softaddicts" 
> wrote:
> >>
> >> Look at this:
> >>
> >> http://dev.clojure.org/display/community/Clojure+Success+Stories
> >>
> >> Luc
> >>
> >>
> >> > Hi there
> >> > > I'm writing a talk about Clojure in the real world and I would like
> to
> >> > know, if possible, which companies are using Clojure for production or
> >> > to make internal tools.
> >> > > Thank you
> >> > > Plínio Balduino
> >> > > -- > -- > You received this message because you are subscribed to
> the
> >> > > Google
> >> > Groups "Clojure" group.
> >> > To post to this group, send email to clojure@googlegroups.com
> >> > Note that posts from new members are moderated - please be patient
> with
> >> > your first post.
> >> > To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send
> >> > an email to clojure+unsubscr...@googlegroups.com.
> >> > For more options, visit https://groups.google.com/groups/opt_out.
> >> > > > --
> >> Softaddicts sent by ibisMail from my ipad!
> >>
> >> --
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Clojure" group.
> >> To post to this group, send email to clojure@googlegroups.com
> >> Note that posts from new members are moderated - please be patient with
> >> your first post.
> >> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to clojure+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/groups/opt_out.
> >>
> >>
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> your
> > first post.
> > To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> > email to clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
>
>
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received th

Re: what directs the program in my-website progream to execute the various files, welcome, users?

2013-06-11 Thread jayvandal
 am using the my-website  code. I then tried to create jimsweb and use the 
exact code
I think the main calls the server file, but I don't understand  how the 
logon screen is called?
I can think in cobol but this??


* project.clj
(defproject my-website "0.1.0-SNAPSHOT"
:description "my Noir website"
:dependencies [[org.clojure/clojure "1.3.0"]
[noir "1.3.0-beta3"]
[org.clojure/java.jdbc "0.2.3"]
[mysql/mysql-connector-java "5.1.6"]] 
:main my-website.server)
**db.clj
(ns my-website.models.db
(:require [clojure.java.jdbc :as sql]))
(def db {:classname "com.mysql.jdbc.Driver"
:subprotocol "mysql"
:subname "//localhost:8080/world"
:user "root"
:password "pass"})
(defn init-db []
(try
(sql/with-connection
db
(sql/create-table
:users
[:id "SERIAL"]
[:handle "varchar(100)"]
[:pass "varchar(100)"]))
(catch Exception ex
(.getMessage (.getNextException ex)


(defn db-read
"returns the result of running the supplied SQL query"
[query & args]
(sql/with-connection 
db
(sql/with-query-results res (vec (cons query args)) (doall res

(defn add-user [user]
(sql/with-connection 
db
(sql/insert-record :users user)))

(defn get-user [handle]
(first (db-read "select * from users where handle=?" handle)))
**server.clj
(ns my-website.server
(:require [noir.server :as server])
(:gen-class))

(server/load-views "src/my_website/views/")

(defn -main [& m]
(let [mode (keyword (or (first m) :dev))
port (Integer. (get (System/getenv) "PORT" "8080"))]
(server/start port {:mode mode
:ns 'my-website})))
**welcome.clj
ns my-website.views.welcome
(:require [my-website.views.common :as common])
(:use [noir.core :only [defpage]]
hiccup.core hiccup.form))

(defpage "/" []
(common/layout 
))

(defpage "/welcome" {:keys [greeting]}
(common/layout
(if greeting [:h2 greeting]) 
(form-to [:post "/welcome"]
(label "name" "name")
(text-field "name")
(submit-button "submit"

(defpage [:post "/welcome"] {:keys [name]}
(noir.core/render "/welcome" {:greeting (str "Welcome " name)}))

**common.clj
(ns my-website.views.common
(:use [noir.core :only [defpartial]]
hiccup.element 
hiccup.form
[hiccup.page :only [include-css html5]])
(:require [noir.session :as session]))

(defn login-form []
(form-to [:post "/login"] 
(text-field {:placeholder "user id"} "handle") 
(password-field {:placeholder "password"} "pass") 
(submit-button "login")))

(defpartial layout [& content]
(html5
[:head
[:title "my-website"]
(include-css "/css/reset.css")]
[:body 
(if-let [user (session/get :user)]
[:h2 "welcome " user 
(form-to [:post "/logout"] (submit-button "logout"))]
[:div.login
(login-form) [:p "or"] (link-to "/signup" "sign up")])

content]))
**users.clj
ns my-website.views.users
(:use [noir.core]
hiccup.core hiccup.form)
(:require [my-website.views.common :as common]
[my-website.models.db :as db]
[noir.util.crypt :as crypt]
[noir.session :as session]
[noir.response :as resp]))

(defpage "/signup" {:keys [handle error]}
(common/layout
[:div.error error]
(form-to [:post "/signup"]
(label "user-id" "user id")
(text-field "handle" handle)
[:br]
(label "pass" "password")
(password-field "pass") 
[:br]
(submit-button "create account"

(defpage [:post "/signup"] user
(try 
(db/add-user (update-in user [:pass] crypt/encrypt))
(resp/redirect "/")
(catch Exception ex
(render "/signup" (assoc user :error (.getMessage ex))

(defpage [:post "/login"] {:keys [handle pass]}
(render "/" 
(let [user (db/get-user handle)] 
(if (and user (crypt/compare pass (:pass user))) 
(session/put! :user handle)
{:handle handle :error "login failed"}

(defpage [:post "/logout"] []
(session/clear!)
(resp/redirect "/"))


On Tuesday, June 11, 2013 6:32:46 AM UTC-6, jayvandal wrote:
>
> what statements makes the program execute.
> The main statement tells the program to execute server file
> what statements in the server file tell the program to run the welcome 
> file ? the user file
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] Clojure/conj tickets on sale at 3pm EST today!

2013-06-11 Thread Michael Fogus
Hi Lynn,

> Let me know if you have any questions/comments/concerns/ideas

I have one question.  As someone who has submitted a talk proposal
(two rather) I wonder if I should go ahead and sign up for the
conference now and work though the reimbursement details later should
my talk get accepted.

I hope that made sense.

Any guidance on this for (potential) speakers would be welcomed.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: expectations documentation

2013-06-11 Thread Michael Klishin
2013/6/11 Jay Fields 

> I spent a bit of time and converted those entries into the following site:
> http://jayfields.com/expectations/index.html
>

That's very helpful! Thanks Jay!
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: expectations documentation

2013-06-11 Thread Sean Corfield
This is very helpful Jay, thank you!

We switched from clojure.test to Expectations after Clojure/West 2012
and we've been very happy with the framework. Centralized
documentation will certainly make life easier for my team!

Sean

On Tue, Jun 11, 2013 at 11:39 AM, Jay Fields  wrote:
> expectations* has always had a decent amount of documentation; however, it's
> traditionally been in the form of blog entries.
>
> I spent a bit of time and converted those entries into the following site:
> http://jayfields.com/expectations/index.html
>
> If you've never looked at expectations and you'd like an alternative to
> clojure.test, you might want to look at the 10 second example. If the 10
> second example looks interesting, take 2 minutes to read the introduction -
> that should give you an idea of whether or not you should invest more in
> expectations.
>
> Cheers, Jay
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Tj Gabbour
Interesting; these arguments sound oddly like those surrounding Common 
Lisp's "loop" macro. When reading Midje's docs, I got the weird impression 
Brian was aware of the history of "non-lispy" macros.

Taken straight from 
http://www.gigamonkeys.com/book/loop-for-black-belts.html :

(loop repeat 5 
  for x = 0 then y
  and y = 1 then (+ x y)
  collect y) ==> (1 1 2 3 5)


Note:

   - Keywords
   - Infix
   - Updating-machinery is textually close to declaration
   - Of course, the arrow to describe output, which motivates Midje.


I'm not sure how Midje obscures your debugging?

Personally, I have strong positive opinions of loop and Midje. I believe 
that I can show people Midje tests, and they're very clear. To the extent 
that lack of composition/flexibility becomes a problem, I can incur the 
cost of an occasional rewrite; or if I can foresee the complexity becoming 
a problem, I'll do something else more appropriate. My attraction towards 
Lisp lies in clarity; I can often spend a bit of virtuousness to gain this, 
and not notice the cost.

(Disclaimer: my Clojure use isn't nearly as complex as yours; I don't get 
to use it as much as I'd wish. So maybe I'm missing something.)


All the best,
  Tj

On Tuesday, June 11, 2013 2:27:03 AM UTC+2, tbc++ wrote:
>
> >> It might surprise you to know that there are actual human beings with 
> feelings who write the software you slam.
>
> You are right. And I apologize for my strong words. For the goals that 
> Midje strives for, it is an excellent library. 
>
> My reaction is more against the ideas behind Midje (from the docs): "I 
> believe you should have the same reaction to test suites written like that: 
> a slavish adherence to Lisp style in tests incorrectly exalts purity over 
> user-friendliness. "
>
> I disagree strongly with this assertion. I wish to see my tests in the 
> same language as my code. Midje succeeds in reaching the goals that it sets 
> forth. I can write tests, top-to-bottom, left-to-right. But at the expense 
> of debugging power, and intuitiveness. 
>
> It may be harder to read:
>
> (is (= (foo 1) 42))
>
> But even a beginner programmer in Clojure can parse and understand it. 
>
> I think the ideals Midje enspouses may be more applicable in other 
> languages, and IMO they are not needed in Clojure. 
>
> These are all my own, highly biased, opinions. I congratulate you, Brian, 
> on a well written, mature, library. I simply question the premise. 
>
> Timothy
>
>
> On Mon, Jun 10, 2013 at 5:30 PM, Brian Marick 
> 
> > wrote:
>
>>
>> On Jun 10, 2013, at 9:20 AM, Timothy Baldridge 
>> > 
>> wrote:
>> > Midje on the other hand, is a massive pile of macros and DSLs that so 
>> complicate your code that advanced tests are insanely hard to debug. ... 
>> And I can't tell you how many dozens of hours I've lost trying to figure 
>> out why Midje doesn't like my test results.
>>
>> It might surprise you to know that there are actual human beings with 
>> feelings who write the software you slam.
>>
>> Before people spend dozens of hours being frustrated, I suggest they post 
>> to the Midje mailing list. I try to be reasonably responsive, and I have a 
>> good track record helping people with their problems.
>>
>> 
>> Latest book: /Functional Programming for the Object-Oriented Programmer/
>> https://leanpub.com/fp-oo
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_o

Re: expectations documentation

2013-06-11 Thread Steven Degutis
Looks really neat! I'm glad you're switching away from the blog-style
documentation, I found that harder to follow. And sorry I hadn't said so
sooner, my mistake :)


On Tue, Jun 11, 2013 at 1:39 PM, Jay Fields  wrote:

> expectations* has always had a decent amount of documentation; however,
> it's traditionally been in the form of blog entries.
>
> I spent a bit of time and converted those entries into the following site:
> http://jayfields.com/expectations/index.html
>
> If you've never looked at expectations and you'd like an alternative to
> clojure.test, you might want to look at the 10 second example. If the 10
> second example looks interesting, take 2 minutes to read the introduction -
> that should give you an idea of whether or not you should invest more in
> expectations.
>
> Cheers, Jay
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: what directs the program in my-website progream to execute the various files, welcome, users?

2013-06-11 Thread Michael-Keith Bernard
Without some code it would be impossible for us to speculate about how your 
program operates. Please provide the relevant source code and we can easily 
help you trace the flow of execution.

On Tuesday, June 11, 2013 5:32:46 AM UTC-7, jayvandal wrote:
>
> what statements makes the program execute.
> The main statement tells the program to execute server file
> what statements in the server file tell the program to run the welcome 
> file ? the user file
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




expectations documentation

2013-06-11 Thread Jay Fields
expectations* has always had a decent amount of documentation; however,
it's traditionally been in the form of blog entries.

I spent a bit of time and converted those entries into the following site:
http://jayfields.com/expectations/index.html

If you've never looked at expectations and you'd like an alternative to
clojure.test, you might want to look at the 10 second example. If the 10
second example looks interesting, take 2 minutes to read the introduction -
that should give you an idea of whether or not you should invest more in
expectations.

Cheers, Jay

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure in production

2013-06-11 Thread Sean Corfield
The latest data from World Singles llc (which is listed on that
Success Stories page):

Clojure source 76 files 13178 total loc, 1064 fns, 554 of which are
private, 152 vars, 2 macros, 17 atoms
Clojure tests 37 files 3016 total loc
Clojure WebDriver tests 11 files 371 total loc

We're on Clojure 1.5.1 in production now. We started with 1.3.0 Alpha
7 (or 8?) and have upgraded pretty much immediately as each final
build has become available (we skipped 1.5.0 due to the memory leak
that was identified - and fixed in 1.5.1).

We generally do multi-version testing so we can easily migrate to each
version as it is released.

Sean


On Mon, Jun 10, 2013 at 3:17 PM, Plínio Balduino  wrote:
> Thanks. I went there before ask here =)
>
> Plínio
>
> On Jun 10, 2013 6:58 PM, "Softaddicts"  wrote:
>>
>> Look at this:
>>
>> http://dev.clojure.org/display/community/Clojure+Success+Stories
>>
>> Luc
>>
>>
>> > Hi there
>> > > I'm writing a talk about Clojure in the real world and I would like to
>> > know, if possible, which companies are using Clojure for production or
>> > to make internal tools.
>> > > Thank you
>> > > Plínio Balduino
>> > > -- > -- > You received this message because you are subscribed to the
>> > > Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clojure@googlegroups.com
>> > Note that posts from new members are moderated - please be patient with
>> > your first post.
>> > To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send
>> > an email to clojure+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> > > > --
>> Softaddicts sent by ibisMail from my ipad!
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[ANN] Clojure/conj tickets on sale at 3pm EST today!

2013-06-11 Thread Lynn Grogan
Hey All,
Tickets for the 4th Annual Clojure/conj conference will be going on sale 
today at 3pm EST! 
Early registration starts at $400. A limited number of student tickets will 
be available for $200.  

We will also be offering ClojureScript, Datomic and Pedestal training in 
the days prior to the conference. 

Watch www.clojure-conj.org for more info. 
Lodging and transportation information will also be listed on the website.

Let me know if you have any questions/comments/concerns/ideas

Thanks!
Lynn Grogan, Relevance

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Reflective method invocation

2013-06-11 Thread N8Dawgrr
Thanks for the responses Ambrose and Gary,

I suppose the answer is its dependent on JVM implementation/version. As 
Gary pointed out his code broke on the JVM upgrade. The real question is, 
if there is ambiguity what "should" the behaviour be? It seems far from 
ideal atm, brodering on non-deterministic. One option would be to throw a 
RuntimeException if multiple methods match.

On Tuesday, June 11, 2013 3:14:46 PM UTC+1, Ambrose Bonnaire-Sergeant wrote:
>
> Hi Nathan,
>
> I just had a quick look at the implementation: I think Clojure picks the 
> first matching method if several are found.
>
>
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Reflector.java#L70
>
> It's probably worth testing this out though.
>
> Thanks,
> Ambrose
>
>
> On Tue, Jun 11, 2013 at 9:24 PM, N8Dawgrr 
> > wrote:
>
>> Hi All, 
>>
>> I have a question regarding ambiguity in reflective dynamic invocation.
>>
>> In Clojure you can dynamically invoke a method on a Java class like so:
>>
>> (. some-instance bar arg)
>>
>> where bar is a method name.
>> If the type inferencer can't ascertain the type of some-instance a 
>> runtime reflective path is used to perform the method invocation.
>> Lets suppose some-instance is of type Foo which has two overloads of 
>> method bar:
>>
>> bar(Apple arg) 
>>
>> and 
>>
>> bar(Orange arg)
>>
>> Now lets suppose Apple is an interface which extends Fruit and so is 
>> Orange.
>>  
>> Now lastly lets suppose we have a class MutantFruit which implements BOTH 
>> Apple and Orange. 
>>
>> My question is what method is invoked at runtime for the following code:
>>
>>  (. some-instance bar mutant) 
>>
>> where mutant is an instance of MutantFruit
>>
>> Regards,
>>
>> Nathan
>>
>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Steven Degutis
You're right. I'm sorry for doing that. From now on I'll make a bigger
point of it to be more correct.


On Tue, Jun 11, 2013 at 10:18 AM, Jay Fields  wrote:

> On Tuesday, June 11, 2013 11:11:23 AM UTC-4, Steven Degutis wrote:
>
>> Jay,
>>
>> [elided]
>>
> That's the issue I'm trying to solve. Maybe that's not what everyone sees
>> in this. But this is the big win I see in it.
>>
>
> I think that's a good goal, I think you should stick to that, instead of
> continuing to make incorrect statements about the existing libraries.
>
> So far you've called my framework 'inflexible' and claimed that 'around'
> isn't possible. Both statements are (a) incorrect and (b) not relevant. I
> have an issue with that, and will continue to keep responding as long as
> you keep making inaccurate statements.
>
> Cheers, Jay
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Jay Fields
On Tuesday, June 11, 2013 11:11:23 AM UTC-4, Steven Degutis wrote:

> Jay,
>
> [elided] 
>
That's the issue I'm trying to solve. Maybe that's not what everyone sees 
> in this. But this is the big win I see in it.
>

I think that's a good goal, I think you should stick to that, instead of 
continuing to make incorrect statements about the existing libraries. 

So far you've called my framework 'inflexible' and claimed that 'around' 
isn't possible. Both statements are (a) incorrect and (b) not relevant. I 
have an issue with that, and will continue to keep responding as long as 
you keep making inaccurate statements. 

Cheers, Jay

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Steven Degutis
Jay,

Imagine there is no Micah or Marick or you, there's only Bob and Alice, two
Clojure geeks who have a really big test suite.

If they wrote their whole test suite using clojure.test, they can't use an
autorunner unless they rewrite it in one of the other libs.

If they wrote their whole test suite using expectations, they can't use
difftest unless they rewrite it in clojure.test.

If they wrote their whole test suite using speclj, they can't use your
(expect) function unless they rewrite the whole thing in expectations.

etc.

But these libs share mostly the same feature-set with each other. So why do
they each re-invent the wheel in a way that make them incompatible with one
another?

That's the issue I'm trying to solve. Maybe that's not what everyone sees
in this. But this is the big win I see in it.


On Tue, Jun 11, 2013 at 9:43 AM, Jay Fields  wrote:

> On Tuesday, June 11, 2013 12:39:59 AM UTC-4, Steven Degutis wrote:
>
>> It's pretty frustrating that I, a regular old Clojure user who likes
>> writing tests, can't mix and match tools from existing testing libraries.
>> Seriously, there's 4 major ones (clojure.test, speclj, midje, expectations)
>> and they each do mostly the same things but vary slightly in some areas. I
>> can't use speclj's around-all feature with expectations' (expect) function.
>>
>
> Unless I'm missing something, I don't see how expectations doesn't support
> around.
>
> here's the speclj from the wiki:
> https://gist.github.com/jaycfields/5757320
> here's the expectations equivalent:
> https://gist.github.com/jaycfields/5757387
>
> Maybe the issue is more around knowing the frameworks than lack of
> features - which could speak to a need for better documentation.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] Instaparse 1.1.0

2013-06-11 Thread JeremyS
Hi Puzzler,

I was wondering if you planned to port Instaparse to ClojureScript. I know 
it's asking a lot, but I am one of those who would love
to be able to run it in a browser or in node.js...

Cheers,

Jeremys.

On Tuesday, May 14, 2013 10:13:52 AM UTC+2, puzzler wrote:
>
> Instaparse is an easy-to-use, feature-rich parser generator for Clojure.  
> The big idea behind instaparse is to make it simple to convert grammars to 
> parsers without needing to know the idiosyncrasies of LL1, LALR, and other 
> esoteric grammar restrictions imposed by most parser generators.
>
> When I announced instaparse a little over a month ago, I imagined that I 
> had packed so many features into it, that surely there was nothing more 
> that anyone could possibly want.  Oh, how naive I was :) .  Within a few 
> days, there were a half-dozen great enhancement ideas posted on the github 
> site.  
>
> Here are the highlights of the new 1.1.0 release:
>
> 1. Support for comments in the grammar.  (This was by far the most popular 
> request.)
>
> 2. A new front-end for ABNF grammars.  ABNF is a syntax popular for 
> carefully defining protocols in formal specs.  Instaparse's support for 
> ABNF means that it is a simple copy-paste exercise to turn these 
> specifications into an executable parser.
>
> 3. The ability to convert EBNF and ABNF *fragments* into Clojure data 
> structures that can be easily merged with one another and with data 
> structures built by the combinator library.
>
> https://github.com/Engelberg/instaparse for full feature list and 
> extensive tutorial.
> https://github.com/Engelberg/instaparse/blob/master/CHANGES.md for a list 
> of changes since the last version.
> https://github.com/Engelberg/instaparse/blob/master/docs/ABNF.md for 
> detailed docs about the new ABNF syntax.
>
> It seems that whenever instaparse comes up, there is an outcry from people 
> who have a visceral reaction against the notion of building a parser from a 
> *string specification* of a grammar.  So I want to be clear up front that 
> instaparse supports *three *input formats that you can freely 
> mix-and-match: EBNF strings, ABNF strings, and Clojure data structures.  
> String input  is particularly handy since most grammars are already written 
> down somewhere in one of these two notations, but the data structures are 
> an option if you need them.  Instaparse also supports two output formats: 
> hiccup and enlive.
>
> This release focused mostly on adding new features; the next version will 
> primarily be another round of performance tuning.  If you want to follow 
> along and help test as I try out new optimization strategies, keep an eye 
> on the 1.2.0-SNAPSHOT branch:
> https://github.com/Engelberg/instaparse/tree/v1.2
>
> Special thanks to Alex Engelberg who implemented the new ABNF input 
> format, and David Powell and Peter Monks who suggested the feature and 
> helped test 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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] lein-pedantic is now deprecated

2013-06-11 Thread Rob Jens
+1 for both features... I found these *very* helpful

Op donderdag 30 mei 2013 03:25:22 UTC+2 schreef Nelson Morris het volgende:
>
> Good news everybody! As of leiningen 2.2.0 using `lein deps :tree` will 
> perform version checks and version range detection. Therefore, I have 
> deprecated lein-pedantic.  I appreciate all of the users of the plugin that 
> found it useful.
>
> I believe there are two pieces of functionality that do not currently have 
> a replacement:
> 1) ability to fail the task when a "bad" dependency resolution happens
> 2) exact instructions of what to place in project.clj to make things work
>
> If you are interested in these, please let me know here, and I'll see 
> about adding them in a future leiningen release.
>
> -
> Nelson Morris
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread JeremyS
I'd like to support Laurent on this and the Test2 effort, having a spec of 
tests in terms of abstractions useable from library to library, possibly 
having tests as data, (since I have learned that it's all about data) would 
really be really useful. The ring-spec like idea for tests really has 
something good to it.

Now, opinion time (more opinionated actually). Midje might be full of 
macros and abstractions that I don't understand when I read the code. Hell 
it's full of them. But I honestly never had to read it to write my tests. 
More It's well documented and I there's is more functionality in the doc 
than I have had to use. So congrats Brian.

Once again it would also be nice to see Test2 include ClojureScript. And 
the spec might be a good start.

Cheers,

Jeremys.

On Tuesday, June 11, 2013 2:56:44 PM UTC+2, Laurent PETIT wrote:
>
> You know, if some day all the test libs / frameworks can be run, test 
> results exploited, etc. through the same abstraction, this will 
> greatly ease the pain of tools developers ! 
>
> I would better write once the integration between Eclipse way of 
> running and displaying tests, than once per library ! 
>
> So ... looking forward to see this globally adopted :-) 
>
> 2013/6/11 Steven Degutis >: 
> > Timothy, Brandon, Cedric, et al.: 
> > 
> > Separating out the Discoverer from the Runner in the SPEC is a bad idea. 
> > 
> > The main benefit mentioned so far for such a separation is so we can 
> have 
> > different definitions of what constitutes a test. For example, 
> > test.generative can generate multiple tests from just one block of code. 
> > 
> > But this creates the same incompatibility problem that we already have 
> > between existing test suites. Instead, if we have a single definition of 
> a 
> > test, every definer is compatible with another. 
> > 
> > And the current definition is already flexible enough to let you 
> generate 
> > multiple tests based on one block of code, like test.generative does. 
> > 
> > 
> > On Tue, Jun 11, 2013 at 1:57 AM, Cedric Greevey 
> > > 
> wrote: 
> >> 
> >> You pass not the Discoverer's results to the Runner, but the Discoverer 
> >> itself, which the Runner then invokes at need, possibly more than once. 
> >> 
> >> 
> >> On Tue, Jun 11, 2013 at 1:35 AM, Steven Degutis 
> >> > 
>
> >> wrote: 
> >>> 
> >>> Originally we had Runner split into Discoverer and Runner, but I had 
> to 
> >>> combine them both in Runner again so that we can have an autorunner. 
> >>> 
> >>> Imagine that you've started your autorunner at the command line, and 
> you 
> >>> create a new test in your existing file and save it. The discoverer 
> has 
> >>> already done his role and found all existing tests and passed them to 
> the 
> >>> runner, so the runner can't see your new test, he only re-runs the 
> tests 
> >>> that existed when he first started. 
> >>> 
> >>> That's why I combined them again. So that he could re-discover all the 
> >>> tests "matching some criteria" and run them. 
> >>> 
> >>> So how do you solve this problem while separating Discoverer from 
> Runner? 
> >>> 
> >>> 
> >>> On Mon, Jun 10, 2013 at 6:53 PM, Brandon Bloom 
> >>> > wrote: 
>  
>  There are currently 4 roles defined: Definer, Asserter, Runner, and 
>  Reporter. 
>  
>  It looks like the "Runner" does finding, filtering, and execution. I 
>  think you could further break the Runner down into Discoverer and 
> Executor. 
>  I might want to just ask "What tests do I have?" without actually 
> running 
>  anyway. I may also want a different Executor, like a 
> distributed/parallel 
>  executor, while preserving the discovery logic. 
>  
>  On Saturday, June 8, 2013 11:14:42 AM UTC-4, Steven Degutis wrote: 
> > 
> > Test2 is a new testing lib for Clojure, where the power is its 
> > simplicity, extensibility, and a SPEC much like Ring's. 
> > 
> > Github: https://github.com/evanescence/test2 
> > 
> > Some background: It came out of discussions with the smart folks in 
> > #clojure, who were frustrated with the inflexibility of existing 
> libs, and 
> > intended this to be the spiritual successor to clojure.test. We 
> wanted 
> > something that was still simple like clojure.test, but could be 
> extended 
> > externally much more easily in case you wanted features found in 
> > clojure.test, Midje, Speclj, or Expectations, or whatever else. 
> > 
> > This is a pre-ANN because it's more of a call for extensions. I've 
> > written one last night, test2-autorunner, which took about an hour. 
> This 
> > should give some idea of how easy it is and how well-designed the 
> SPEC was 
> > by the smart folks of #clojure. There are some ideas at the bottom 
> of the 
> > wiki, but of course any extensions are encouraged. 
> > 
> > -Steven 
>  
>  -- 
>  -- 
>  You received this message because you are subscribed to the Google 

Re: Reflective method invocation

2013-06-11 Thread Gary Trakhman
The result can be JVM-dependent.  I've solved a bug in our codebase that
was due to JDK 7's reflection preferring a different constructor for an
object than 6, which was fixed by explicitly wrapping the ambiguous
argument in (boolean).  Whatever the behavior, it's best to not rely on a
specific brokenness.


On Tue, Jun 11, 2013 at 10:14 AM, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> Hi Nathan,
>
> I just had a quick look at the implementation: I think Clojure picks the
> first matching method if several are found.
>
>
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Reflector.java#L70
>
> It's probably worth testing this out though.
>
> Thanks,
> Ambrose
>
>
> On Tue, Jun 11, 2013 at 9:24 PM, N8Dawgrr wrote:
>
>> Hi All,
>>
>> I have a question regarding ambiguity in reflective dynamic invocation.
>>
>> In Clojure you can dynamically invoke a method on a Java class like so:
>>
>> (. some-instance bar arg)
>>
>> where bar is a method name.
>> If the type inferencer can't ascertain the type of some-instance a
>> runtime reflective path is used to perform the method invocation.
>> Lets suppose some-instance is of type Foo which has two overloads of
>> method bar:
>>
>> bar(Apple arg)
>>
>> and
>>
>> bar(Orange arg)
>>
>> Now lets suppose Apple is an interface which extends Fruit and so is
>> Orange.
>>
>> Now lastly lets suppose we have a class MutantFruit which implements BOTH
>> Apple and Orange.
>>
>> My question is what method is invoked at runtime for the following code:
>>
>>  (. some-instance bar mutant)
>>
>> where mutant is an instance of MutantFruit
>>
>> Regards,
>>
>> Nathan
>>
>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Jay Fields
On Tuesday, June 11, 2013 12:39:59 AM UTC-4, Steven Degutis wrote:

> It's pretty frustrating that I, a regular old Clojure user who likes 
> writing tests, can't mix and match tools from existing testing libraries. 
> Seriously, there's 4 major ones (clojure.test, speclj, midje, expectations) 
> and they each do mostly the same things but vary slightly in some areas. I 
> can't use speclj's around-all feature with expectations' (expect) function.
>

Unless I'm missing something, I don't see how expectations doesn't support 
around.

here's the speclj from the wiki: https://gist.github.com/jaycfields/5757320
here's the expectations equivalent: 
https://gist.github.com/jaycfields/5757387 

Maybe the issue is more around knowing the frameworks than lack of features 
- which could speak to a need for better documentation.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Reflective method invocation

2013-06-11 Thread Ambrose Bonnaire-Sergeant
Hi Nathan,

I just had a quick look at the implementation: I think Clojure picks the
first matching method if several are found.

https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Reflector.java#L70

It's probably worth testing this out though.

Thanks,
Ambrose


On Tue, Jun 11, 2013 at 9:24 PM, N8Dawgrr wrote:

> Hi All,
>
> I have a question regarding ambiguity in reflective dynamic invocation.
>
> In Clojure you can dynamically invoke a method on a Java class like so:
>
> (. some-instance bar arg)
>
> where bar is a method name.
> If the type inferencer can't ascertain the type of some-instance a runtime
> reflective path is used to perform the method invocation.
> Lets suppose some-instance is of type Foo which has two overloads of
> method bar:
>
> bar(Apple arg)
>
> and
>
> bar(Orange arg)
>
> Now lets suppose Apple is an interface which extends Fruit and so is
> Orange.
>
> Now lastly lets suppose we have a class MutantFruit which implements BOTH
> Apple and Orange.
>
> My question is what method is invoked at runtime for the following code:
>
> (. some-instance bar mutant)
>
> where mutant is an instance of MutantFruit
>
> Regards,
>
> Nathan
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: with-open and for

2013-06-11 Thread John D. Hume
On Jun 11, 2013 8:25 AM, "Meikel Brandmeyer (kotarak)"  wrote:
> Or another one:
>
> (defn filter-lines
>   [rdr]
>   (->> (line-seq rdr)
> (mapcat #(str/split % #"\s+"))
> (filter #(<= 4 (count %) 9))
> (into #{})))
>
> (defn filter-file
>   [filename]
>   (with-open [rdr (io/reader filename)]
> (filter-lines rdr)))

I like this split a lot, though I'd prefer to pass the line-seq to
filter-lines. Then you have an extremely simple impure fn and all your
logic in an easy-to-test, easy-to-reuse pure function.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: with-open and for

2013-06-11 Thread Meikel Brandmeyer (kotarak)
Or another one:

(defn filter-lines
  [rdr]
  (->> (line-seq rdr)
(mapcat #(str/split % #"\s+"))
(filter #(<= 4 (count %) 9))
(into #{})))

(defn filter-file
  [filename]
  (with-open [rdr (io/reader filename)]
(filter-lines rdr)))

Meikel

Am Dienstag, 11. Juni 2013 11:04:14 UTC+2 schrieb raym:
>
> The 'reduce' solution is very elegant, but you can simplify it further: 
>
> (defn filter-file [filename] 
>   (with-open [rdr (io/reader filename)] 
> (reduce (fn [words line] 
>   (into words (filter #(<= 4 (count %) 9) (str/split line 
> #"\s+" 
> #{} 
> (line-seq rdr 
>
> Ray. 
>
> On 10 June 2013 18:20, Thomas Heller > 
> wrote: 
> > Hey, 
> > 
> > I pasted the code into gist ( https://gist.github.com/thheller/5734642) and 
> > copy&pasted that into the post. 
> > 
> > Cheers, 
> > /thomas 
> > 
> > 
> > On Mon, Jun 10, 2013 at 6:01 PM, Alan Thompson 
> > > 
>
> > wrote: 
> >> 
> >> Hey Thomas - How'd you get the nice syntax highlighting in your post? 
> >> Alan 
> >> 
> >> 
> >> On Sat, Jun 8, 2013 at 7:16 PM, Steven D. Arnold 
> >> > wrote: 
> >>> 
> >>> Thanks for the responses!  As suggested, wrapping in 'doall' does 
> work. 
> >>> 
> >>> 
> >>> On Jun 8, 2013, at 3:28 AM, Thomas Heller 
> >>> > 
> wrote: 
> >>> 
> >>> (defn filter-file [filename] 
> >>>  (with-open [rdr (io/reader filename)] 
> >>>(reduce (fn [words line] 
> >>>  (->> (str/split line #"\s+") 
> >>>   (filter #(and (<= (count %) 9) 
> >>> (>= (count %) 4))) 
> >>>   (set) 
> >>>   (set/union words))) 
> >>>#{} 
> >>>(line-seq rdr 
> >>> 
> >>> 
> >>> That code is really graceful and clean.  I like it a lot.  But for 
> some 
> >>> reason I've never loved 'reduce' before, which probably means I've 
> never 
> >>> used it where it is called for.  Reduce just seems so generic... it's 
> what 
> >>> you say when you haven't got anything better to say, something like 
> "all 
> >>> right, do this." 
> >>> 
> >>> But, having said that, I'd pick your implementation over mine, because 
> I 
> >>> think it's conceptually cleaner (as recursive algorithms often are). 
>  Nice. 
> >>> Thanks! 
> >>> 
> >>> steven 
> >>> 
> >>> -- 
> >>> -- 
> >>> You received this message because you are subscribed to the Google 
> >>> Groups "Clojure" group. 
> >>> To post to this group, send email to clo...@googlegroups.com 
> >>> Note that posts from new members are moderated - please be patient 
> with 
> >>> your first post. 
> >>> To unsubscribe from this group, send email to 
> >>> clojure+u...@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 unsubscribe from this group and stop receiving emails from it, send 
> an 
> >>> email to clojure+u...@googlegroups.com . 
> >>> 
> >>> For more options, visit https://groups.google.com/groups/opt_out. 
> >>> 
> >>> 
> >> 
> >> 
> >> -- 
> >> -- 
> >> You received this message because you are subscribed to the Google 
> >> Groups "Clojure" group. 
> >> To post to this group, send email to clo...@googlegroups.com 
> >> Note that posts from new members are moderated - please be patient with 
> >> your first post. 
> >> To unsubscribe from this group, send email to 
> >> clojure+u...@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 a topic in the 
> >> Google Groups "Clojure" group. 
> >> To unsubscribe from this topic, visit 
> >> https://groups.google.com/d/topic/clojure/5o7iIrQQlR4/unsubscribe?hl=en. 
>
> >> To unsubscribe from this group and all its topics, send an email to 
> >> clojure+u...@googlegroups.com . 
> >> 
> >> For more options, visit https://groups.google.com/groups/opt_out. 
> >> 
> >> 
> > 
> > 
> > -- 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> > Note that posts from new members are moderated - please be patient with 
> your 
> > first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@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 unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to clojure+u...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, sen

Reflective method invocation

2013-06-11 Thread N8Dawgrr
Hi All, 

I have a question regarding ambiguity in reflective dynamic invocation.

In Clojure you can dynamically invoke a method on a Java class like so:

(. some-instance bar arg)

where bar is a method name.
If the type inferencer can't ascertain the type of some-instance a runtime 
reflective path is used to perform the method invocation.
Lets suppose some-instance is of type Foo which has two overloads of method 
bar:

bar(Apple arg) 

and 

bar(Orange arg)

Now lets suppose Apple is an interface which extends Fruit and so is Orange.

Now lastly lets suppose we have a class MutantFruit which implements BOTH 
Apple and Orange. 

My question is what method is invoked at runtime for the following code:

(. some-instance bar mutant) 

where mutant is an instance of MutantFruit

Regards,

Nathan

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




Re: ANN: Update to lein-localrepo, lein-servlet, lein-idefiles

2013-06-11 Thread Shantanu Kumar
Project URLs below.

lein-localrepo: https://github.com/kumarshantanu/lein-localrepo

lein-servlet: https://github.com/kumarshantanu/lein-servlet

lein-idefiles: https://github.com/kumarshantanu/lein-idefiles

Shantanu

On Tuesday, 11 June 2013 18:42:08 UTC+5:30, Shantanu Kumar wrote:
>
> Hi,
>
> I pushed new versions of three Leiningen plugins to Clojars recently:
>
> * lein-localrepo 0.5.0
>
> This plugins lets one manage the local Maven/Leiningen repository. The 
> 0.5.0 release fixes outstanding issues.
>
> * lein-servlet 0.3.0
>
> This plugin lets the user work with servlet-based Clojure apps. One can 
> potentially use this plugin to gradually migrate a Java project to Clojure, 
> or to develop using Clojure on the backend and PHP(Quercus)/CFML(Railo) on 
> the frontend. This plugin earlier had Jetty 7, Jetty 8 and Tomcat 7 
> adapters. This release adds the Jetty 9 adapter and includes some fixes to 
> the Railo template.
>
> * lein-idefiles 0.2.0
>
> This plugin helps one generate IDE files (Eclipse and IntelliJ IDEA) for a 
> Leiningen-managed project. Once the IDE files are generated you can 
> import/open the project in the IDE.
>
> Let me know your feedback.
>
> Shantanu
>

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




Re: ANN: Update to lein-localrepo, lein-servlet, lein-idefiles

2013-06-11 Thread Shantanu Kumar
Project URLs below.

lein-localrepo: https://github.com/kumarshantanu/lein-localrepo

lein-servlet: https://github.com/kumarshantanu/lein-servlet

lein-idefiles: https://github.com/kumarshantanu/lein-idefiles

Shantanu

On Tuesday, 11 June 2013 18:42:08 UTC+5:30, Shantanu Kumar wrote:
>
> Hi,
>
> I pushed new versions of three Leiningen plugins to Clojars recently:
>
> * lein-localrepo 0.5.0
>
> This plugins lets one manage the local Maven/Leiningen repository. The 
> 0.5.0 release fixes outstanding issues.
>
> * lein-servlet 0.3.0
>
> This plugin lets the user work with servlet-based Clojure apps. One can 
> potentially use this plugin to gradually migrate a Java project to Clojure, 
> or to develop using Clojure on the backend and PHP(Quercus)/CFML(Railo) on 
> the frontend. This plugin earlier had Jetty 7, Jetty 8 and Tomcat 7 
> adapters. This release adds the Jetty 9 adapter and includes some fixes to 
> the Railo template.
>
> * lein-idefiles 0.2.0
>
> This plugin helps one generate IDE files (Eclipse and IntelliJ IDEA) for a 
> Leiningen-managed project. Once the IDE files are generated you can 
> import/open the project in the IDE.
>
> Let me know your feedback.
>
> Shantanu
>

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




ANN: Update to lein-localrepo, lein-servlet, lein-idefiles

2013-06-11 Thread Shantanu Kumar
Hi,

I pushed new versions of three Leiningen plugins to Clojars recently:

* lein-localrepo 0.5.0

This plugins lets one manage the local Maven/Leiningen repository. The 
0.5.0 release fixes outstanding issues.

* lein-servlet 0.3.0

This plugin lets the user work with servlet-based Clojure apps. One can 
potentially use this plugin to gradually migrate a Java project to Clojure, 
or to develop using Clojure on the backend and PHP(Quercus)/CFML(Railo) on 
the frontend. This plugin earlier had Jetty 7, Jetty 8 and Tomcat 7 
adapters. This release adds the Jetty 9 adapter and includes some fixes to 
the Railo template.

* lein-idefiles 0.2.0

This plugin helps one generate IDE files (Eclipse and IntelliJ IDEA) for a 
Leiningen-managed project. Once the IDE files are generated you can 
import/open the project in the IDE.

Let me know your feedback.

Shantanu

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




Re: with-open and for

2013-06-11 Thread Jean Niklas L'orange
I haven't seen the use of multiple statements in the for comprehension 
here, so perhaps it's nice to elaborate that this exists?

(defn filter-file [filename]
  (with-open [rdr (io/reader filename)]
(set
 (for [line (line-seq rdr)
   word (str/split line #"\s+")
   :when (<= 4 (count word) 9)]
   word

I would believe that is one of the more evident ways of writing it. If you 
would like duplicates, replace set with doall.

 -- JN

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Laurent PETIT
You know, if some day all the test libs / frameworks can be run, test
results exploited, etc. through the same abstraction, this will
greatly ease the pain of tools developers !

I would better write once the integration between Eclipse way of
running and displaying tests, than once per library !

So ... looking forward to see this globally adopted :-)

2013/6/11 Steven Degutis :
> Timothy, Brandon, Cedric, et al.:
>
> Separating out the Discoverer from the Runner in the SPEC is a bad idea.
>
> The main benefit mentioned so far for such a separation is so we can have
> different definitions of what constitutes a test. For example,
> test.generative can generate multiple tests from just one block of code.
>
> But this creates the same incompatibility problem that we already have
> between existing test suites. Instead, if we have a single definition of a
> test, every definer is compatible with another.
>
> And the current definition is already flexible enough to let you generate
> multiple tests based on one block of code, like test.generative does.
>
>
> On Tue, Jun 11, 2013 at 1:57 AM, Cedric Greevey  wrote:
>>
>> You pass not the Discoverer's results to the Runner, but the Discoverer
>> itself, which the Runner then invokes at need, possibly more than once.
>>
>>
>> On Tue, Jun 11, 2013 at 1:35 AM, Steven Degutis 
>> wrote:
>>>
>>> Originally we had Runner split into Discoverer and Runner, but I had to
>>> combine them both in Runner again so that we can have an autorunner.
>>>
>>> Imagine that you've started your autorunner at the command line, and you
>>> create a new test in your existing file and save it. The discoverer has
>>> already done his role and found all existing tests and passed them to the
>>> runner, so the runner can't see your new test, he only re-runs the tests
>>> that existed when he first started.
>>>
>>> That's why I combined them again. So that he could re-discover all the
>>> tests "matching some criteria" and run them.
>>>
>>> So how do you solve this problem while separating Discoverer from Runner?
>>>
>>>
>>> On Mon, Jun 10, 2013 at 6:53 PM, Brandon Bloom
>>>  wrote:

 There are currently 4 roles defined: Definer, Asserter, Runner, and
 Reporter.

 It looks like the "Runner" does finding, filtering, and execution. I
 think you could further break the Runner down into Discoverer and Executor.
 I might want to just ask "What tests do I have?" without actually running
 anyway. I may also want a different Executor, like a distributed/parallel
 executor, while preserving the discovery logic.

 On Saturday, June 8, 2013 11:14:42 AM UTC-4, Steven Degutis wrote:
>
> Test2 is a new testing lib for Clojure, where the power is its
> simplicity, extensibility, and a SPEC much like Ring's.
>
> Github: https://github.com/evanescence/test2
>
> Some background: It came out of discussions with the smart folks in
> #clojure, who were frustrated with the inflexibility of existing libs, and
> intended this to be the spiritual successor to clojure.test. We wanted
> something that was still simple like clojure.test, but could be extended
> externally much more easily in case you wanted features found in
> clojure.test, Midje, Speclj, or Expectations, or whatever else.
>
> This is a pre-ANN because it's more of a call for extensions. I've
> written one last night, test2-autorunner, which took about an hour. This
> should give some idea of how easy it is and how well-designed the SPEC was
> by the smart folks of #clojure. There are some ideas at the bottom of the
> wiki, but of course any extensions are encouraged.
>
> -Steven

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


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

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Steven Degutis
Timothy, Brandon, Cedric, et al.:

Separating out the Discoverer from the Runner in the SPEC is a bad idea.

The main benefit mentioned so far for such a separation is so we can have
different definitions of what constitutes a test. For example,
test.generative can generate multiple tests from just one block of code.

But this creates the same incompatibility problem that we already have
between existing test suites. Instead, if we have a single definition of a
test, every definer is compatible with another.

And the current definition is already flexible enough to let you generate
multiple tests based on one block of code, like test.generative does.


On Tue, Jun 11, 2013 at 1:57 AM, Cedric Greevey  wrote:

> You pass not the Discoverer's results to the Runner, but the Discoverer
> itself, which the Runner then invokes at need, possibly more than once.
>
>
> On Tue, Jun 11, 2013 at 1:35 AM, Steven Degutis wrote:
>
>> Originally we had Runner split into Discoverer and Runner, but I had to
>> combine them both in Runner again so that we can have an autorunner.
>>
>> Imagine that you've started your autorunner at the command line, and you
>> create a new test in your existing file and save it. The discoverer has
>> already done his role and found all existing tests and passed them to the
>> runner, so the runner can't see your new test, he only re-runs the tests
>> that existed when he first started.
>>
>> That's why I combined them again. So that he could re-discover all the
>> tests "matching some criteria" and run them.
>>
>> So how do you solve this problem while separating Discoverer from Runner?
>>
>>
>> On Mon, Jun 10, 2013 at 6:53 PM, Brandon Bloom > > wrote:
>>
>>> There are currently 4 roles defined: Definer, Asserter, Runner, and
>>> Reporter.
>>>
>>> It looks like the "Runner" does finding, filtering, and execution. I
>>> think you could further break the Runner down into Discoverer and Executor.
>>> I might want to just ask "What tests do I have?" without actually running
>>> anyway. I may also want a different Executor, like a distributed/parallel
>>> executor, while preserving the discovery logic.
>>>
>>> On Saturday, June 8, 2013 11:14:42 AM UTC-4, Steven Degutis wrote:
>>>
 Test2 is a new testing lib for Clojure, where the power is its
 simplicity, extensibility, and a 
 SPEC much
 like Ring's.

 Github: 
 https://github.com/**evanescence/test2

 Some background: It came out of 
 discussions
  with
 the smart folks in #clojure, who were frustrated with the inflexibility of
 existing libs, and intended this to be the spiritual successor to
 clojure.test. We wanted something that was still simple like clojure.test,
 but could be extended externally much more easily in case you wanted
 features found in clojure.test, Midje, Speclj, or Expectations, or whatever
 else.

 This is a pre-ANN because it's more of a call for extensions. I've
 written one last night, 
 test2-autorunner,
 which took about an hour. This should give some idea of how easy it is and
 how well-designed the SPEC was by the smart folks of #clojure. There are
 some ideas at the bottom of the wiki, but of course any extensions are
 encouraged.

 -Steven

>>>  --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit 

what directs the program in my-website progream to execute the various files, welcome, users?

2013-06-11 Thread jayvandal
what statements makes the program execute.
The main statement tells the program to execute server file
what statements in the server file tell the program to run the welcome file 
? the user file

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Steven Degutis
Beautiful!


On Tue, Jun 11, 2013 at 1:57 AM, Cedric Greevey  wrote:

> You pass not the Discoverer's results to the Runner, but the Discoverer
> itself, which the Runner then invokes at need, possibly more than once.
>
>
> On Tue, Jun 11, 2013 at 1:35 AM, Steven Degutis wrote:
>
>> Originally we had Runner split into Discoverer and Runner, but I had to
>> combine them both in Runner again so that we can have an autorunner.
>>
>> Imagine that you've started your autorunner at the command line, and you
>> create a new test in your existing file and save it. The discoverer has
>> already done his role and found all existing tests and passed them to the
>> runner, so the runner can't see your new test, he only re-runs the tests
>> that existed when he first started.
>>
>> That's why I combined them again. So that he could re-discover all the
>> tests "matching some criteria" and run them.
>>
>> So how do you solve this problem while separating Discoverer from Runner?
>>
>>
>> On Mon, Jun 10, 2013 at 6:53 PM, Brandon Bloom > > wrote:
>>
>>> There are currently 4 roles defined: Definer, Asserter, Runner, and
>>> Reporter.
>>>
>>> It looks like the "Runner" does finding, filtering, and execution. I
>>> think you could further break the Runner down into Discoverer and Executor.
>>> I might want to just ask "What tests do I have?" without actually running
>>> anyway. I may also want a different Executor, like a distributed/parallel
>>> executor, while preserving the discovery logic.
>>>
>>> On Saturday, June 8, 2013 11:14:42 AM UTC-4, Steven Degutis wrote:
>>>
 Test2 is a new testing lib for Clojure, where the power is its
 simplicity, extensibility, and a 
 SPEC much
 like Ring's.

 Github: 
 https://github.com/**evanescence/test2

 Some background: It came out of 
 discussions
  with
 the smart folks in #clojure, who were frustrated with the inflexibility of
 existing libs, and intended this to be the spiritual successor to
 clojure.test. We wanted something that was still simple like clojure.test,
 but could be extended externally much more easily in case you wanted
 features found in clojure.test, Midje, Speclj, or Expectations, or whatever
 else.

 This is a pre-ANN because it's more of a call for extensions. I've
 written one last night, 
 test2-autorunner,
 which took about an hour. This should give some idea of how easy it is and
 how well-designed the SPEC was by the smart folks of #clojure. There are
 some ideas at the bottom of the wiki, but of course any extensions are
 encouraged.

 -Steven

>>>  --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving email

Re: Clojure in production

2013-06-11 Thread keeds
In the depths of ?Sunny? Suffolk... We use clojure and now clojurescript to 
build our internal systems with a very small team of developers (2). Cannot 
imagine getting the power, productivity or fun out of any other environment.

We are looking for another developer so if anyone knows anyone prepared to 
work in Needham Market with some clojure knowledge or transferable skills 
then let me know.
Remember this is not London so don't expect fantastic remuneration, but the 
opportunity to learn, develop and experiment is huge.

Andrew Keedle
Lead clojure developer (and IT Manager)
BTS Group

On Monday, 10 June 2013 22:47:25 UTC+1, Plinio Balduino wrote:
>
> Hi there 
>
> I'm writing a talk about Clojure in the real world and I would like to 
> know, if possible, which companies are using Clojure for production or 
> to make internal tools. 
>
> Thank you 
>
> Plínio Balduino 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure in production

2013-06-11 Thread Bruce Durling
Hey!

On Tue, Jun 11, 2013 at 10:36 AM, Simon Holgate  wrote:
> Bruce Durling's semi-irregular update for London Clojurians is here:

I'll have you know that I'm completely irregular. :-D

Oh, and we use clojure for all of our stuff at Mastodon C that isn't
html or javascript and I think the javascript's days are numbered.

cheers,
Bruce

--
@otfrom | CTO & co-founder @MastodonC | mastodonc.com
See recent coverage of us in the Economist http://econ.st/WeTd2i and
the Financial Times http://on.ft.com/T154BA

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure in production

2013-06-11 Thread Simon Holgate
Bruce Durling's semi-irregular update for London Clojurians is here:
https://groups.google.com/forum/?fromgroups#!searchin/london-clojurians/production/london-clojurians/ES8AuxXI0Nk/4xgY52znaUcJ

On Monday, 10 June 2013 22:47:25 UTC+1, Plinio Balduino wrote:
>
> Hi there 
>
> I'm writing a talk about Clojure in the real world and I would like to 
> know, if possible, which companies are using Clojure for production or 
> to make internal tools. 
>
> Thank you 
>
> Plínio Balduino 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: with-open and for

2013-06-11 Thread Ray Miller
The 'reduce' solution is very elegant, but you can simplify it further:

(defn filter-file [filename]
  (with-open [rdr (io/reader filename)]
(reduce (fn [words line]
  (into words (filter #(<= 4 (count %) 9) (str/split line #"\s+"
#{}
(line-seq rdr

Ray.

On 10 June 2013 18:20, Thomas Heller  wrote:
> Hey,
>
> I pasted the code into gist ( https://gist.github.com/thheller/5734642 ) and
> copy&pasted that into the post.
>
> Cheers,
> /thomas
>
>
> On Mon, Jun 10, 2013 at 6:01 PM, Alan Thompson 
> wrote:
>>
>> Hey Thomas - How'd you get the nice syntax highlighting in your post?
>> Alan
>>
>>
>> On Sat, Jun 8, 2013 at 7:16 PM, Steven D. Arnold
>>  wrote:
>>>
>>> Thanks for the responses!  As suggested, wrapping in 'doall' does work.
>>>
>>>
>>> On Jun 8, 2013, at 3:28 AM, Thomas Heller  wrote:
>>>
>>> (defn filter-file [filename]
>>>  (with-open [rdr (io/reader filename)]
>>>(reduce (fn [words line]
>>>  (->> (str/split line #"\s+")
>>>   (filter #(and (<= (count %) 9)
>>> (>= (count %) 4)))
>>>   (set)
>>>   (set/union words)))
>>>#{}
>>>(line-seq rdr
>>>
>>>
>>> That code is really graceful and clean.  I like it a lot.  But for some
>>> reason I've never loved 'reduce' before, which probably means I've never
>>> used it where it is called for.  Reduce just seems so generic... it's what
>>> you say when you haven't got anything better to say, something like "all
>>> right, do this."
>>>
>>> But, having said that, I'd pick your implementation over mine, because I
>>> think it's conceptually cleaner (as recursive algorithms often are).  Nice.
>>> Thanks!
>>>
>>> steven
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to clojure+unsubscr...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from 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 a topic in the
>> Google Groups "Clojure" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/clojure/5o7iIrQQlR4/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to
>> clojure+unsubscr...@googlegroups.com.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure in production

2013-06-11 Thread Robert Stuttaford
We use Clojure full-stack at www.cognician.com. Clojure, ClojureScript, 
Datomic. Still under 20k loc. Loving it!

On Monday, June 10, 2013 11:47:25 PM UTC+2, Plinio Balduino wrote:
>
> Hi there 
>
> I'm writing a talk about Clojure in the real world and I would like to 
> know, if possible, which companies are using Clojure for production or 
> to make internal tools. 
>
> Thank you 
>
> Plínio Balduino 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.