Re: Like "if", but it composes functions

2013-02-20 Thread Laurent PETIT
Hello,

Why the names fix / to-fix ?

2013/2/20 Alan Malloy :
> Useful has functions that do this and more: fix or to-fix, according to
> taste. Your iffn is just the three-argument case of to-fix: (def magnify
> (to-fix pos? inc dec)). But fix and to-fix accept more or fewer arguments as
> well, so that (fix x pos? inc) is like (if (pos? x) (inc x) x), and (to-fix
> tall? shorten thin? fatten) is (fn [x] (cond (tall? x) (shorten x) (thin? x)
> (fatten x) :else x)).
>
> Basically both of these functions look through their clause pairs and apply
> the first transform whose test matches. fix takes its "focus" argument
> immediately, while to-fix returns a lambda that performs the requested
> operation.
>
>
> On Tuesday, February 19, 2013 9:53:57 PM UTC-8, James MacAulay wrote:
>>
>> Sometimes I find myself writing code like this:
>>
>> (defn magnify [n] (if (pos? n) (inc n) (dec n)))
>>
>> ...and I want to get rid of all those "n"s. I've looked for a macro like
>> this, but couldn't find it, so I wrote it:
>>
>> https://gist.github.com/jamesmacaulay/4993062
>>
>> Using that, I could re-write the above like this:
>>
>> (def magnify (iffn pos? inc dec))
>>
>> I can imagine a condfn macro, too:
>>
>> (def magnify2 (condfn pos? inc
>>   neg? dec
>>   :else identity)
>>
>> Has this kind of conditional function composition been explored much? I
>> couldn't find anything like it in the standard library, but maybe I wasn't
>> looking hard enough.
>>
>> Cheers,
>> James
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from 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: Like "if", but it composes functions

2013-02-20 Thread Alan Malloy
You can use fix to take some data that might not be right (say, an integer 
that might actually be a string) and "fix" it by applying read-string: (fix 
"10" string? read-string). to-fix returns a function you can use to fix 
things.

On Wednesday, February 20, 2013 12:06:36 AM UTC-8, Laurent PETIT wrote:
>
> Hello, 
>
> Why the names fix / to-fix ? 
>
> 2013/2/20 Alan Malloy >: 
> > Useful has functions that do this and more: fix or to-fix, according to 
> > taste. Your iffn is just the three-argument case of to-fix: (def magnify 
> > (to-fix pos? inc dec)). But fix and to-fix accept more or fewer 
> arguments as 
> > well, so that (fix x pos? inc) is like (if (pos? x) (inc x) x), and 
> (to-fix 
> > tall? shorten thin? fatten) is (fn [x] (cond (tall? x) (shorten x) 
> (thin? x) 
> > (fatten x) :else x)). 
> > 
> > Basically both of these functions look through their clause pairs and 
> apply 
> > the first transform whose test matches. fix takes its "focus" argument 
> > immediately, while to-fix returns a lambda that performs the requested 
> > operation. 
> > 
> > 
> > On Tuesday, February 19, 2013 9:53:57 PM UTC-8, James MacAulay wrote: 
> >> 
> >> Sometimes I find myself writing code like this: 
> >> 
> >> (defn magnify [n] (if (pos? n) (inc n) (dec n))) 
> >> 
> >> ...and I want to get rid of all those "n"s. I've looked for a macro 
> like 
> >> this, but couldn't find it, so I wrote it: 
> >> 
> >> https://gist.github.com/jamesmacaulay/4993062 
> >> 
> >> Using that, I could re-write the above like this: 
> >> 
> >> (def magnify (iffn pos? inc dec)) 
> >> 
> >> I can imagine a condfn macro, too: 
> >> 
> >> (def magnify2 (condfn pos? inc 
> >>   neg? dec 
> >>   :else identity) 
> >> 
> >> Has this kind of conditional function composition been explored much? I 
> >> couldn't find anything like it in the standard library, but maybe I 
> wasn't 
> >> looking hard enough. 
> >> 
> >> Cheers, 
> >> James 
> > 
> > -- 
> > -- 
> > 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: Like "if", but it composes functions

2013-02-20 Thread Laurent PETIT
2013/2/20 Alan Malloy :
> You can use fix to take some data that might not be right (say, an integer
> that might actually be a string) and "fix" it by applying read-string: (fix
> "10" string? read-string). to-fix returns a function you can use to fix
> things.

OK, I thought there was some more generic meaning to it (for the OP's
initial need, I'm not sure the name fix would convey appropriate
semantics, for instance)

Cheers

>
>
> On Wednesday, February 20, 2013 12:06:36 AM UTC-8, Laurent PETIT wrote:
>>
>> Hello,
>>
>> Why the names fix / to-fix ?
>>
>> 2013/2/20 Alan Malloy :
>> > Useful has functions that do this and more: fix or to-fix, according to
>> > taste. Your iffn is just the three-argument case of to-fix: (def magnify
>> > (to-fix pos? inc dec)). But fix and to-fix accept more or fewer
>> > arguments as
>> > well, so that (fix x pos? inc) is like (if (pos? x) (inc x) x), and
>> > (to-fix
>> > tall? shorten thin? fatten) is (fn [x] (cond (tall? x) (shorten x)
>> > (thin? x)
>> > (fatten x) :else x)).
>> >
>> > Basically both of these functions look through their clause pairs and
>> > apply
>> > the first transform whose test matches. fix takes its "focus" argument
>> > immediately, while to-fix returns a lambda that performs the requested
>> > operation.
>> >
>> >
>> > On Tuesday, February 19, 2013 9:53:57 PM UTC-8, James MacAulay wrote:
>> >>
>> >> Sometimes I find myself writing code like this:
>> >>
>> >> (defn magnify [n] (if (pos? n) (inc n) (dec n)))
>> >>
>> >> ...and I want to get rid of all those "n"s. I've looked for a macro
>> >> like
>> >> this, but couldn't find it, so I wrote it:
>> >>
>> >> https://gist.github.com/jamesmacaulay/4993062
>> >>
>> >> Using that, I could re-write the above like this:
>> >>
>> >> (def magnify (iffn pos? inc dec))
>> >>
>> >> I can imagine a condfn macro, too:
>> >>
>> >> (def magnify2 (condfn pos? inc
>> >>   neg? dec
>> >>   :else identity)
>> >>
>> >> Has this kind of conditional function composition been explored much? I
>> >> couldn't find anything like it in the standard library, but maybe I
>> >> wasn't
>> >> looking hard enough.
>> >>
>> >> Cheers,
>> >> James
>> >
>> > --
>> > --
>> > 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.
>
>

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

2013-02-20 Thread Phillip Lord
Geo  writes:
> I am cross-posting my Clojure question from StackOverflow.  I am trying to 
> get an algorithm in Clojure to match Java speed and managed to get the 
> performance to within one order of magnitude and wondering if more is 
> possible. The full question is here:
>
> http://stackoverflow.com/questions/14949705/clojure-performance-for-expensive-algorithms


So, I was curious about this. So, you've done everything using java
arrays. What would happen if you used clojure data structures. 

So I tried this instead. 

(defn lcs-native
  [n1 n2]
  (let [n1-len (count n1)
n2-len (count n2)
prev {}
curr {}]
(loop [i 0 max-len 0 prev prev curr curr]
  (if (< i n1-len)
(recur (inc i)
   (loop [j 0 max-len max-len]
 (if (< j n2-len)
   (if (= (nth n1 i) (nth n2 j))
 (let [match-len (inc (get prev j 0))]
   (do
 (assoc curr (inc j) match-len)
 (recur (inc j) (max max-len match-len
 (do
   (assoc curr (inc j) 0)
   (recur (inc j) max-len)))
   max-len))
   curr
   prev)
max-len

This is slower, but interesting only by about 1/3 which is less than you
might have thought, assuming I have got the code correct. 

Perhaps, then, using transients would speed things up. 

(defn lcs-native-transient
  [n1 n2]
  (let [n1-len (count n1)
n2-len (count n2)
prev (transient {})
curr (transient {})]
(loop [i 0 max-len 0 prev prev curr curr]
  (if (< i n1-len)
(recur (inc i)
   (loop [j 0 max-len max-len]
 (if (< j n2-len)
   (if (= (nth n1 i) (nth n2 j))
 (let [match-len (inc (get prev j 0))]
   (do
 (assoc! curr (inc j) match-len)
 (recur (inc j) (max max-len match-len
 (do
   (assoc! curr (inc j) 0)
   (recur (inc j) max-len)))
   max-len))
   curr
   prev)
max-len


Curiously, this is a disaster, taking over about 10x longer. Not what I
was expecting at all. 

Guess this doesn't shed any light on your problem at all, but just
thought it would be good to share. 

Phil




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




Create map from vector of keywords and other items

2013-02-20 Thread Stefan Kamphausen
Hi,

given a vector of the form

 

 [:key1 1 2 3 :key2 4 :key3 5 6 7]

I wand to create a map collecting the items behind each keyword as a vector 
like this:

 {:key1 [1 2 3] 
  :key2 [4] 
  :key3 [5 6 7]}

I have already written two functions which achieve this, but neither of them 
"feels good" and I am interested in more elegant and idiomatic solutions.

(defn keycollect-partition [coll]
  (->> coll
   (partition-by keyword?)  ; bundle at key
   (partition 2); kw + its arg
   (map (fn [[[sec] arg]] [sec (vec arg)])) ; destruct the mess
   (into {}))) ; make it a map

(defn keycollect-reduce [coll]
  (apply zipmap
 (reduce 
  (fn [ac x] 
(if (keyword? x) 
  [(conj (first ac) x) (conj (second ac) [])]
  (update-in ac [1 (dec (count (first ac)))] conj x))) [[] []]
  coll)))

Added complexity: My original vector does not yet contain keywords, but I 
construct them in a map regexp-matching each item and creating a keyword from 
the first group of the match.

Any pointers or ideas appreciated.

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: Create map from vector of keywords and other items

2013-02-20 Thread Jim foo.bar
'keycollect-partition' looks sensible and idiomatic to me... perhaps 
juxt can come into play here? Of course, both versions will only work 
with keys as keywords and non-keys as non-keywords. If you use anything 
else other than a keyword for a key or a keyword for an item, both will 
break...


Jim


On 20/02/13 11:50, Stefan Kamphausen wrote:

Hi,

given a vector of the form


  [:key1 1 2 3 :key2 4 :key3 5 6 7]

I wand to create a map collecting the items behind each keyword as a vector 
like this:

  {:key1 [1 2 3]
   :key2 [4]
   :key3 [5 6 7]}

I have already written two functions which achieve this, but neither of them "feels 
good" and I am interested in more elegant and idiomatic solutions.

(defn keycollect-partition [coll]
   (->> coll
(partition-by keyword?)  ; bundle at key
(partition 2); kw + its arg
(map (fn [[[sec] arg]] [sec (vec arg)])) ; destruct the mess
(into {}))) ; make it a map

(defn keycollect-reduce [coll]
   (apply zipmap
  (reduce
   (fn [ac x]
 (if (keyword? x)
   [(conj (first ac) x) (conj (second ac) [])]
   (update-in ac [1 (dec (count (first ac)))] conj x))) [[] []]
   coll)))

Added complexity: My original vector does not yet contain keywords, but I 
construct them in amap  regexp-matching each item and creating a keyword from 
the first group of the match.

Any pointers or ideas appreciated.

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.




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

2013-02-20 Thread Jarod
It worked after I installed leinigen 2, then ran the same commands that I 
listed in my previous post.  Ben, I'm not sure why the "deploy" command 
gave the same error, but I appreciate your detailed response.  KK, if I 
have more problems in the future, I'll be sure to try your recommendation. 
 Thanks to Ben, KK and everyone else who responded.  I wouldn't have got it 
to work otherwise.

On Tuesday, February 19, 2013 8:54:37 AM UTC-5, Benjamin R. Haskell wrote:
>
> On Sun, 17 Feb 2013, Jarod wrote: 
>
> > James, Aaron and Jim: thanks for your help, but it still get the old 
> > error message and another: "Leiningen managed dependencies issue: 
> > problem resolving following dependencies: [jaad/jaad "0.8.4"]".  If 
> > anyone has time, my lein version is 1.7.1 and maven version is 2.2.1 
> > and I used the following steps: 
> > 1) I created a new Leningen project that I called "project1". 
> > 2) Within the project1 directory, I create sub-directory: 
> "maven_repository" 
> > 3) I place the jaad jar file into maven_repository, go to 
> maven_repository and run the following: 
> >  mvn install:install-file -Dfile=jaad-0.8.4.jar -DartifactId=jaad 
> -Dversion=0.8.4 -DgroupId=jaad -Dpackaging=jar -DlocalRepositoryPath=. 
>
> When trying to do this in the past, I used almost that command, but the 
> "deploy:deploy-file" task (instead of install:install-file).  And 
> instead of: 
>
> -DlocalRepositoryPath=. 
>
> I used: 
>
> -Durl=file:. 
>
> Additionally, it might(?) be better if you didn't start out with JAR 
> file in the same directory (You'll end up with two copies of the JAR in 
> the repo, one of which is unneeded). 
>
> So, the full replacement command: 
>
> mvn deploy:deploy-file -Dfile=/path/to/external/jaad-0.8.4.jar 
> -DartifactId=jaad -Dversion=0.8.4 -DgroupId=jaad -Dpackaging=jar 
> -Durl=file:. 
>
> In addition to installing the JAR file, the deploy:deploy-file task 
> creates a .pom file and updates the (initially non-existent) 
> maven-metadata.xml file. 
>
> Other than that, your steps looked the same as what has worked for me in 
> the past. 
>
> -- 
> Best, 
> Ben

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

2013-02-20 Thread larry google groups
> It was a bug in kerodon that happens when a ring response has a :body 
> that is a not a string (in this case a lazyseq). Reported and fixed by 
> Travis Vachon at https://github.com/xeqi/kerodon/pull/6, I just had 
> lost track of making a release for it. 
> Fixed as part of [kerodon "0.1.0"]. 

Fantastic! All the errors that I was struggling with last night are now 
gone! This is great!




On Tuesday, February 19, 2013 11:52:39 PM UTC-5, Nelson Morris wrote:
>
> It was a bug in kerodon that happens when a ring response has a :body 
> that is a not a string (in this case a lazyseq). Reported and fixed by 
> Travis Vachon at https://github.com/xeqi/kerodon/pull/6, I just had 
> lost track of making a release for it. 
>
> Fixed as part of [kerodon "0.1.0"]. 
>
>
> On Tue, Feb 19, 2013 at 4:37 PM, AtKaaZ > 
> wrote: 
> > oh sorry I meant: 
> > => (doall 1) 
> > IllegalArgumentException Don't know how to create ISeq from: 
> java.lang.Long 
> > clojure.lang.RT.seqFrom (RT.java:505) 
> > clojure.lang.RT.seq (RT.java:486) 
> > clojure.core/seq (core.clj:133) 
> > clojure.core/dorun (core.clj:2780) 
> > clojure.core/doall (core.clj:2796) 
> > 
> > 
> > On Tue, Feb 19, 2013 at 11:36 PM, AtKaaZ > 
> wrote: 
> >> 
> >> => (dorun 1) 
> >> IllegalArgumentException Don't know how to create ISeq from: 
> >> java.lang.Long  clojure.lang.RT.seqFrom (RT.java:505) 
> >> nil 
> >> IllegalArgumentException Don't know how to create ISeq from: 
> >> java.lang.Long 
> >> clojure.lang.RT.seqFrom (RT.java:505) 
> >> clojure.lang.RT.seq (RT.java:486) 
> >> clojure.core/seq (core.clj:133) 
> >> clojure.core/dorun (core.clj:2780) 
> >> random.learning.backtick.backtick1/eval2879 (NO_SOURCE_FILE:1) 
> >> 
> >> 
> >> On Tue, Feb 19, 2013 at 11:30 PM, larry google groups 
> >> > wrote: 
> >>> 
> >>> Hmm, even stranger. If I wrap "app" in doall in an attempt to make the 
> >>> lazyseq error go away, I get: 
> >>> 
> >>> ERROR in (anyone-can-view-frontpage) (RT.java:494) 
> >>> Uncaught exception, not in assertion. 
> >>> expected: nil 
> >>>   actual: java.lang.IllegalArgumentException: Don't know how to create 
> >>> ISeq from: ring.middleware.cookies$wrap_cookies$fn__1637 
> >>>  at clojure.lang.RT.seqFrom (RT.java:494) 
> >>> clojure.lang.RT.seq (RT.java:475) 
> >>> clojure.core$seq.invoke (core.clj:133) 
> >>> clojure.core$dorun.invoke (core.clj:2725) 
> >>> clojure.core$doall.invoke (core.clj:2741) 
> >>> mpdv_clojure.core_test/fn (core_test.clj:13) 
> >>> 
> >>> 
> >>> On Feb 19, 2:24 pm, larry google groups  
> >>> wrote: 
> >>> > I was trying to follow this video, which adds some nice tests for 
> >>> > Friend: 
> >>> > 
> >>> > http://www.clojurewebdevelopment.com/videos/friend-interactive-form 
> >>> > 
> >>> > But Kerodon gives me an error, and points to line 13 of my test 
> code: 
> >>> > 
> >>> > ERROR in (anyone-can-view-frontpage) (impl.clj:73) 
> >>> > Uncaught exception, not in assertion. 
> >>> > expected: nil 
> >>> >   actual: java.lang.ClassCastException: clojure.lang.LazySeq cannot 
> be 
> >>> > cast to java.lang.String 
> >>> >  at kerodon.impl$include_parse.invoke (impl.clj:73) 
> >>> > kerodon.core$visit.doInvoke (core.clj:8) 
> >>> > clojure.lang.RestFn.invoke (RestFn.java:423) 
> >>> > mpdv_clojure.core_test/fn (core_test.clj:13) 
> >>> > 
> >>> > But line 13 starts with the first inside line of this function: 
> >>> > 
> >>> > (deftest anyone-can-view-frontpage 
> >>> >   (-> (session app) 
> >>> >   (visit  "/") 
> >>> >   (has (text? "Hello World" 
> >>> > 
> >>> > And I think my definition of app is fairly straightforward: 
> >>> > 
> >>> > (defroutes app-routes 
> >>> >   (ANY "/" request (index request)) 
> >>> >   (GET "/section/" request (section request)) 
> >>> >   (GET "/admin" request (friend/authorize #{::admin} (admin 
> request))) 
> >>> >   (GET "/login" request (login request)) 
> >>> >   (friend/logout (GET "/logout" _ (ring.util.response/redirect 
> "/"))) 
> >>> >   (GET "/ok" request (ok request)) 
> >>> >   (route/resources "/") 
> >>> >   (route/not-found "Page not found")) 
> >>> > 
> >>> > (def app 
> >>> >   (-> app-routes 
> >>> >   (friend/authenticate 
> >>> >{:workflows [(workflows/interactive-form)] 
> >>> > :credential-fn (partial credentials/bcrypt-credential-fn 
> >>> > users)}) 
> >>> >   handler/site)) 
> >>> > 
> >>> > Can anyone tell me where I went wrong? 
> >>> > 
> >>> > Please note, Friend is working great for this app -- it correctly 
> >>> > protects a page until I supply the correct username/password. The 
> >>> > problem I have here is with Kerodon, not Friend. 
> >>> 
> >>> -- 
> >>> -- 
> >>> 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 firs

Re: Create map from vector of keywords and other items

2013-02-20 Thread Thomas Heller
Not sure if this is any more idiomatic, or feels any better, but I thought 
a loop would be appropriate here, plus I made key selection pluggable.

https://gist.github.com/thheller/4995766

(defn split-into-map [items key-fn] "see gist")

key-fn is a function which accepts one arg and should return true if the arg is 
supposed to be a key.


(prn (split-into-map [:key1 1 2 3 :key2 4 :key3 5 6 7] keyword?))
(prn (split-into-map ["y" 1 2 "x" 3 4 5] string?))

Requirement is that the first item is a key, since it would break otherwise.

Cheers,
/thomas

On Wednesday, February 20, 2013 12:50:42 PM UTC+1, Stefan Kamphausen wrote:

Hi,
>
> given a vector of the form
>
>  
>
>  [:key1 1 2 3 :key2 4 :key3 5 6 7]
>
> I wand to create a map collecting the items behind each keyword as a vector 
> like this:
>
>  {:key1 [1 2 3] 
>   :key2 [4] 
>   :key3 [5 6 7]}
>
> I have already written two functions which achieve this, but neither of them 
> "feels good" and I am interested in more elegant and idiomatic solutions.
>
> (defn keycollect-partition [coll]
>   (->> coll
>(partition-by keyword?)  ; bundle at key
>(partition 2); kw + its arg
>(map (fn [[[sec] arg]] [sec (vec arg)])) ; destruct the mess
>(into {}))) ; make it a map
>
> (defn keycollect-reduce [coll]
>   (apply zipmap
>  (reduce 
>   (fn [ac x] 
> (if (keyword? x) 
>   [(conj (first ac) x) (conj (second ac) [])]
>   (update-in ac [1 (dec (count (first ac)))] conj x))) [[] []]
>   coll)))
>
> Added complexity: My original vector does not yet contain keywords, but I 
> construct them in a map regexp-matching each item and creating a keyword from 
> the first group of the match.
>
> Any pointers or ideas appreciated.
>
> 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: kerodon tests explode on lazyseq (session app)

2013-02-20 Thread larry google groups

I would like to suggest that a future version of Kerodon have
something like text? but checking for a substring, rather than
equality. I have been running my tests against my real-world
templates, so I get failures for stuff like this:

FAIL in (anyone-can-view-frontpage) (core_test.clj:15)
expected: (text? "Hello World")
  actual: "\n  \nDiscovery Kids Camp Planner\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n  /* these are styles that the code will change on a per
page basis, such as \n  the background-image of the top banner.
This is changed by the code and frontenders\n  should  not touch
this block. */\n\n\n  \n  \n\nHello World\n\n\n\t\n
\n\n\n  \n\n\n\n\n"


But "Hello World" is there, so I wish I could make this test work.

I notice you have these macros to do look for the match:


(defmacro validate [comparator generator expected exp-msg]
  `(fn [state# msg#]
 (try (let [value# (~generator state#)]
(clojure.test/do-report {:actual value#
 :type (if (~comparator value#
~expected)
 :pass
 :fail)
 :message msg#
 :expected (quote ~exp-msg)}))
  (catch java.lang.Throwable t#
(clojure.test/do-report {:actual t#
 :type :error
 :message msg#
 :expected (quote ~exp-msg)})))
 state#))

(defmacro text? [expected]
  `(validate =
 #(apply str (enlive/texts (:enlive %)))
 ~expected
 (~'text? ~expected)))


But I think what is needed is a way to define a re-match and pass that
in and have something like re-find pull out a match, if any.

I could possibly write this myself and send you a pull request but I
am relatively new to Clojure and I worry that I will do a bad job of
it.








On Feb 20, 8:58 am, larry google groups 
wrote:
> > It was a bug in kerodon that happens when a ring response has a :body
> > that is a not a string (in this case a lazyseq). Reported and fixed by
> > Travis Vachon athttps://github.com/xeqi/kerodon/pull/6, I just had
> > lost track of making a release for it.
> > Fixed as part of [kerodon "0.1.0"].
>
> Fantastic! All the errors that I was struggling with last night are now
> gone! This is great!
>
>
>
>
>
>
>
> On Tuesday, February 19, 2013 11:52:39 PM UTC-5, Nelson Morris wrote:
>
> > It was a bug in kerodon that happens when a ring response has a :body
> > that is a not a string (in this case a lazyseq). Reported and fixed by
> > Travis Vachon athttps://github.com/xeqi/kerodon/pull/6, I just had
> > lost track of making a release for it.
>
> > Fixed as part of [kerodon "0.1.0"].
>
> > On Tue, Feb 19, 2013 at 4:37 PM, AtKaaZ >
> > wrote:
> > > oh sorry I meant:
> > > => (doall 1)
> > > IllegalArgumentException Don't know how to create ISeq from:
> > java.lang.Long
> > >     clojure.lang.RT.seqFrom (RT.java:505)
> > >     clojure.lang.RT.seq (RT.java:486)
> > >     clojure.core/seq (core.clj:133)
> > >     clojure.core/dorun (core.clj:2780)
> > >     clojure.core/doall (core.clj:2796)
>
> > > On Tue, Feb 19, 2013 at 11:36 PM, AtKaaZ >
> > wrote:
>
> > >> => (dorun 1)
> > >> IllegalArgumentException Don't know how to create ISeq from:
> > >> java.lang.Long  clojure.lang.RT.seqFrom (RT.java:505)
> > >> nil
> > >> IllegalArgumentException Don't know how to create ISeq from:
> > >> java.lang.Long
> > >>     clojure.lang.RT.seqFrom (RT.java:505)
> > >>     clojure.lang.RT.seq (RT.java:486)
> > >>     clojure.core/seq (core.clj:133)
> > >>     clojure.core/dorun (core.clj:2780)
> > >>     random.learning.backtick.backtick1/eval2879 (NO_SOURCE_FILE:1)
>
> > >> On Tue, Feb 19, 2013 at 11:30 PM, larry google groups
> > >> > wrote:
>
> > >>> Hmm, even stranger. If I wrap "app" in doall in an attempt to make the
> > >>> lazyseq error go away, I get:
>
> > >>> ERROR in (anyone-can-view-frontpage) (RT.java:494)
> > >>> Uncaught exception, not in assertion.
> > >>> expected: nil
> > >>>   actual: java.lang.IllegalArgumentException: Don't know how to create
> > >>> ISeq from: ring.middleware.cookies$wrap_cookies$fn__1637
> > >>>  at clojure.lang.RT.seqFrom (RT.java:494)
> > >>>     clojure.lang.RT.seq (RT.java:475)
> > >>>     clojure.core$seq.invoke (core.clj:133)
> > >>>     clojure.core$dorun.invoke (core.clj:2725)
> > >>>     clojure.core$doall.invoke (core.clj:2741)
> > >>>     mpdv_clojure.core_test/fn (core_test.clj:13)
>
> > >>> On Feb 19, 2:24 pm, larry google groups 
> > >>> wrote:
> > >>> > I was trying to follow this video, which adds some nice tests for
> > >>> > Friend:
>
> > >>> >http://www.clojurewebdevelopment.com/videos/friend-interactive-form
>
> > >>> > But Kerodon gives me an error, and points to line 13 of my test
> > co

how would you implement sending out a verification email?

2013-02-20 Thread Balint Erdi
Hey, 

So yesterday we discussed concurrency at our meetup 
(http://www.meetup.com/Budapest-Clojure-User-Group/) and a question occurred to 
me.

Suppose we have a classic web application. (I'm not currently building such a 
web app in Clojure, so that's a "theoretical" question).

When the user signs up, a verification email has to be sent and the database 
entry related to the user has to be updated (or a new datom created ;) ) to 
reflect the fact that we've sent out the email to the user.

First, we want this to be consistent so that the "verification_sent_out" db 
field reflects whether the email has really been sent out or not. Secondly, we 
also want the email to only be sent out once.

My first idea was to use a transaction but if the transaction retries, the 
email could be sent out several times. A fellow Clojurian advised the sending 
of the email to be performed by an agent. The agent is "transaction aware" so 
if the wrapping transaction is retried several times it only sends out the 
email when the transaction successfully runs.

Is this how this actually works? Is there another, simpler and/or more robust 
solution? In the languages I come from (e.g Ruby) I'd use a library that 
handles the queueing and consumption of tasks. Is this how you'd do it in 
Clojure or it's one of these cases where Clojure itself suffices where other 
languages are lacking? 

Thank you for your answer,-- 
Balint

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

2013-02-20 Thread James MacAulay
Ben: of course, haha...making it a macro seems rather silly now :P

Alan: I didn't know about useful before, thanks for the pointer! fix and 
to-fix look great.

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




Faster lein

2013-02-20 Thread Buck Golemon
I see that lein2 has factored out the 'interactive' command.

Can I use lein1 and expect the various clojure libraries and templates to 
work?

There's been several mentions of jark in relation to speeding up lein. From 
what I see, it doesn't seem battle tested. Do any of you use it on a daily 
basis?
Do you use something else?

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

2013-02-20 Thread Maik Schünemann
given the current position of core.logic and core.typed
I wonder if it would be in range of a gsoc project to implement something
similar to Qis type system for clojure
(here is a link to an example of using Qis type system
http://programmingkungfuqi.blogspot.de/2006/04/qi-and-magic-prime-type.html
and it is documented in detail in the official qi book
http://www.lambdassociates.org/Book/page000.htm)

If something like this is possible I'w be happy to give it a try


On Sat, Feb 16, 2013 at 2:43 PM, Daniel Solano Gómez wrote:

> These sound like some good ideas.  Feel free to add a core.matrix
> category to the project ideas page.
>
> Thanks,
>
> Daniel
>
> On Sat Feb 16 01:02 2013, Mikera wrote:
> > Awesome stuff!
> >
> > core.matrix has a lot of great opportunities to work on something
> > meaningful, and I'd be happy to mentor one or more students in this area.
> > Top of my list would be:
> >
> >  - Extending core.matrix support to Incanter (medium, needs collaboration
> > with Incanter team)
> >  - A full NumPy style NDArray implementation in Clojure (large, quite
> > advanced)
> >  - core.matrix support for data tables (e.g. database resultsets,
> > statistical datasets etc.) (medium)
> >
> > Will post a proposal along these lines.
> >
> > On Friday, 15 February 2013 02:03:58 UTC+8, Daniel Solano Gómez wrote:
> > >
> > > Hello, all,
> > >
> > > It's official:  Google Summer of Code 2013 is on.
> > >
> > > Last year, Clojure was able to get four students who worked on projects
> > > like Typed Clojure, Clojure on Android, Clojure and Lua, and Overtone,
> and
> > > I'd love to see Clojure be a mentoring organisation again this year.
> > >
> > > I have created a GSoC 2013 page on the Clojure community wiki <
> > > http://dev.clojure.org/display/community/Google+Summer+of+Code+2013>.
> > >  Here you will be able to find the latest information about what's
> going on
> > > with Clojure's GSoC 2013 effort and how to get involved.
> > >
> > > Here's some ways you can help:
> > >
> > > * Let people in your local user groups or university know about Clojure
> > > and GSoC.
> > > * If you're going to Clojure/West, attend the GSoC unsession.
> > >
> > > For students
> > >
> > > * Start researching project ideas and get involved with the relevant
> > > communities to find mentors.
> > >
> > > For developers:
> > >
> > > Does your open source project have a backlog of features to implement?
> > >  GSoC is a great way to draw new contributors to your project.
> > >
> > > * Post it to the project idea page and become a mentor.
> > > * Let people know about GSoC on your project mailing list.
> > >
> > > I'd like to thank everyone in advance for helping with our GSoC 2013
> > > project.
> > >
> > > Sincerely,
> > >
> > > Daniel
> > >
> >
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/clojure?hl=en
> > ---
> > 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: Faster lein

2013-02-20 Thread Ulises
I've been using drip with quite some success (with the exception of midje
tests which seem to launch their own jvm every time.)


On 20 February 2013 15:53, Buck Golemon  wrote:

> I see that lein2 has factored out the 'interactive' command.
>
> Can I use lein1 and expect the various clojure libraries and templates to
> work?
>
> There's been several mentions of jark in relation to speeding up lein.
> From what I see, it doesn't seem battle tested. Do any of you use it on a
> daily basis?
> Do you use something else?
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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: Google Summer of Code 2013

2013-02-20 Thread Ambrose Bonnaire-Sergeant
Interesting idea, but the specifics of the project are not clear to me.
Could you flesh out what
you're trying to achieve in particular?

Would you build on top of core.logic and core.typed?

Thanks,
Ambrose

On Thu, Feb 21, 2013 at 12:13 AM, Maik Schünemann  wrote:

> given the current position of core.logic and core.typed
> I wonder if it would be in range of a gsoc project to implement something
> similar to Qis type system for clojure
> (here is a link to an example of using Qis type system
> http://programmingkungfuqi.blogspot.de/2006/04/qi-and-magic-prime-type.html
>
> and it is documented in detail in the official qi book
> http://www.lambdassociates.org/Book/page000.htm)
>
> If something like this is possible I'w be happy to give it a try
>
>
> On Sat, Feb 16, 2013 at 2:43 PM, Daniel Solano Gómez 
> wrote:
>
>> These sound like some good ideas.  Feel free to add a core.matrix
>> category to the project ideas page.
>>
>> Thanks,
>>
>> Daniel
>>
>> On Sat Feb 16 01:02 2013, Mikera wrote:
>> > Awesome stuff!
>> >
>> > core.matrix has a lot of great opportunities to work on something
>> > meaningful, and I'd be happy to mentor one or more students in this
>> area.
>> > Top of my list would be:
>> >
>> >  - Extending core.matrix support to Incanter (medium, needs
>> collaboration
>> > with Incanter team)
>> >  - A full NumPy style NDArray implementation in Clojure (large, quite
>> > advanced)
>> >  - core.matrix support for data tables (e.g. database resultsets,
>> > statistical datasets etc.) (medium)
>> >
>> > Will post a proposal along these lines.
>> >
>> > On Friday, 15 February 2013 02:03:58 UTC+8, Daniel Solano Gómez wrote:
>> > >
>> > > Hello, all,
>> > >
>> > > It's official:  Google Summer of Code 2013 is on.
>> > >
>> > > Last year, Clojure was able to get four students who worked on
>> projects
>> > > like Typed Clojure, Clojure on Android, Clojure and Lua, and
>> Overtone, and
>> > > I'd love to see Clojure be a mentoring organisation again this year.
>> > >
>> > > I have created a GSoC 2013 page on the Clojure community wiki <
>> > > http://dev.clojure.org/display/community/Google+Summer+of+Code+2013>.
>> > >  Here you will be able to find the latest information about what's
>> going on
>> > > with Clojure's GSoC 2013 effort and how to get involved.
>> > >
>> > > Here's some ways you can help:
>> > >
>> > > * Let people in your local user groups or university know about
>> Clojure
>> > > and GSoC.
>> > > * If you're going to Clojure/West, attend the GSoC unsession.
>> > >
>> > > For students
>> > >
>> > > * Start researching project ideas and get involved with the relevant
>> > > communities to find mentors.
>> > >
>> > > For developers:
>> > >
>> > > Does your open source project have a backlog of features to implement?
>> > >  GSoC is a great way to draw new contributors to your project.
>> > >
>> > > * Post it to the project idea page and become a mentor.
>> > > * Let people know about GSoC on your project mailing list.
>> > >
>> > > I'd like to thank everyone in advance for helping with our GSoC 2013
>> > > project.
>> > >
>> > > Sincerely,
>> > >
>> > > Daniel
>> > >
>> >
>> > --
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clojure@googlegroups.com
>> > Note that posts from new members are moderated - please be patient with
>> your first post.
>> > To unsubscribe from this group, send email to
>> > clojure+unsubscr...@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/clojure?hl=en
>> > ---
>> > 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...@goo

Re: Faster lein

2013-02-20 Thread Softaddicts
SSD + fastest laptop in your price range ;)
lein2 help takes 12 seconds from start to back at command prompt...

We have a huge build here with 9 distinct projects, AOT, ...
lein is fired up maybe a dozen times and it takes a bit
above 3 mns elapsed time and 2mns of cpu time.

Quite happy to live in a io-less world..

As far as lein 1 versus lein 2, the plugin framework has changed so beware of
the plugin versions you may refer to. Not all plugins have been migrated to 
lein 2.

Any reason why you are moving to lein 2 ?

Luc P.
> I see that lein2 has factored out the 'interactive' command.
> 
> Can I use lein1 and expect the various clojure libraries and templates to 
> work?
> 
> There's been several mentions of jark in relation to speeding up lein. From 
> what I see, it doesn't seem battle tested. Do any of you use it on a daily 
> basis?
> Do you use something else?
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from 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.




Re: Google Summer of Code 2013

2013-02-20 Thread David Nolen
It's probably possible but too broad a scope for GSoC 2013. I think the
community would be better served by directly contributing to core.logic &
core.typed both of which could use lots of help :)


On Wed, Feb 20, 2013 at 11:13 AM, Maik Schünemann  wrote:

> given the current position of core.logic and core.typed
> I wonder if it would be in range of a gsoc project to implement something
> similar to Qis type system for clojure
> (here is a link to an example of using Qis type system
> http://programmingkungfuqi.blogspot.de/2006/04/qi-and-magic-prime-type.html
>
> and it is documented in detail in the official qi book
> http://www.lambdassociates.org/Book/page000.htm)
>
> If something like this is possible I'w be happy to give it a try
>
>
> On Sat, Feb 16, 2013 at 2:43 PM, Daniel Solano Gómez 
> wrote:
>
>> These sound like some good ideas.  Feel free to add a core.matrix
>> category to the project ideas page.
>>
>> Thanks,
>>
>> Daniel
>>
>> On Sat Feb 16 01:02 2013, Mikera wrote:
>> > Awesome stuff!
>> >
>> > core.matrix has a lot of great opportunities to work on something
>> > meaningful, and I'd be happy to mentor one or more students in this
>> area.
>> > Top of my list would be:
>> >
>> >  - Extending core.matrix support to Incanter (medium, needs
>> collaboration
>> > with Incanter team)
>> >  - A full NumPy style NDArray implementation in Clojure (large, quite
>> > advanced)
>> >  - core.matrix support for data tables (e.g. database resultsets,
>> > statistical datasets etc.) (medium)
>> >
>> > Will post a proposal along these lines.
>> >
>> > On Friday, 15 February 2013 02:03:58 UTC+8, Daniel Solano Gómez wrote:
>> > >
>> > > Hello, all,
>> > >
>> > > It's official:  Google Summer of Code 2013 is on.
>> > >
>> > > Last year, Clojure was able to get four students who worked on
>> projects
>> > > like Typed Clojure, Clojure on Android, Clojure and Lua, and
>> Overtone, and
>> > > I'd love to see Clojure be a mentoring organisation again this year.
>> > >
>> > > I have created a GSoC 2013 page on the Clojure community wiki <
>> > > http://dev.clojure.org/display/community/Google+Summer+of+Code+2013>.
>> > >  Here you will be able to find the latest information about what's
>> going on
>> > > with Clojure's GSoC 2013 effort and how to get involved.
>> > >
>> > > Here's some ways you can help:
>> > >
>> > > * Let people in your local user groups or university know about
>> Clojure
>> > > and GSoC.
>> > > * If you're going to Clojure/West, attend the GSoC unsession.
>> > >
>> > > For students
>> > >
>> > > * Start researching project ideas and get involved with the relevant
>> > > communities to find mentors.
>> > >
>> > > For developers:
>> > >
>> > > Does your open source project have a backlog of features to implement?
>> > >  GSoC is a great way to draw new contributors to your project.
>> > >
>> > > * Post it to the project idea page and become a mentor.
>> > > * Let people know about GSoC on your project mailing list.
>> > >
>> > > I'd like to thank everyone in advance for helping with our GSoC 2013
>> > > project.
>> > >
>> > > Sincerely,
>> > >
>> > > Daniel
>> > >
>> >
>> > --
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clojure@googlegroups.com
>> > Note that posts from new members are moderated - please be patient with
>> your first post.
>> > To unsubscribe from this group, send email to
>> > clojure+unsubscr...@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/clojure?hl=en
>> > ---
>> > 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.

Re: Faster lein

2013-02-20 Thread Softaddicts
Drip does not give me any significant advantage on my hardware...
I think that most of this 12 seconds is spent compiling and initializing all 
the plugins
on top of lein and clojure itself.

One day I will have some time to spit out a tool to create a local AOT version 
of
all these nice tools to at least skip the compilation phase.

Luc P.


> I've been using drip with quite some success (with the exception of midje
> tests which seem to launch their own jvm every time.)
> 
> 
> On 20 February 2013 15:53, Buck Golemon  wrote:
> 
> > I see that lein2 has factored out the 'interactive' command.
> >
> > Can I use lein1 and expect the various clojure libraries and templates to
> > work?
> >
> > There's been several mentions of jark in relation to speeding up lein.
> > From what I see, it doesn't seem battle tested. Do any of you use it on a
> > daily basis?
> > Do you use something else?
> >
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> > your first post.
> > To unsubscribe from 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.
> 
> 
> 
--
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.




Re: Faster lein

2013-02-20 Thread Phillip Lord

I've got very variable performance from drip. In some cases, it's
slower. 

My guess is that it runs the application in the last JVM, and spins up
the new one to replace it at the same time. On slow machines, this is
problematic. 

Personally, I use patience; I find this solves all my problems. 

Phil

Ulises  writes:

> I've been using drip with quite some success (with the exception of midje
> tests which seem to launch their own jvm every time.)
>
>
> On 20 February 2013 15:53, Buck Golemon  wrote:
>
>> I see that lein2 has factored out the 'interactive' command.
>>
>> Can I use lein1 and expect the various clojure libraries and templates to
>> work?
>>
>> There's been several mentions of jark in relation to speeding up lein.
>> From what I see, it doesn't seem battle tested. Do any of you use it on a
>> daily basis?
>> Do you use something else?
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from 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.
>>
>>
>>
>
> -- 

-- 
Phillip Lord,   Phone: +44 (0) 191 222 7827
Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk
School of Computing Science,
http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower,   skype: russet_apples
Newcastle University,   twitter: phillord
NE1 7RU 

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

2013-02-20 Thread Softaddicts
You should have worked on a vax-725 with a removable 10mb disk the size if a
large pizza 4 inches thick .

It would have torned your patience to snowflakes which are presently
falling on my head, almost as white as my hairs which have been whitening over
years of waiting after the then really too slow computers.

Technology helps, a lot, even if it cannot solve all the problems.

BTWY, out of 12 seconds elapsed time to start lein, it chews up nearly the same
amount of cpu time.

Aside of getting a marginal increase by over clocking the i7, there ain't much I
can do in terms of external optimizations... drip effectively slows down things
on my hardware having to spin up a replacement JVM.

Luc 


> 
> I've got very variable performance from drip. In some cases, it's
> slower. 
> 
> My guess is that it runs the application in the last JVM, and spins up
> the new one to replace it at the same time. On slow machines, this is
> problematic. 
> 
> Personally, I use patience; I find this solves all my problems. 
> 
> Phil
> 
> Ulises  writes:
> 
> > I've been using drip with quite some success (with the exception of midje
> > tests which seem to launch their own jvm every time.)
> >
> >
> > On 20 February 2013 15:53, Buck Golemon  wrote:
> >
> >> I see that lein2 has factored out the 'interactive' command.
> >>
> >> Can I use lein1 and expect the various clojure libraries and templates to
> >> work?
> >>
> >> There's been several mentions of jark in relation to speeding up lein.
> >> From what I see, it doesn't seem battle tested. Do any of you use it on a
> >> daily basis?
> >> Do you use something else?
> >>
> >> --
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Clojure" group.
> >> To post to this group, send email to clojure@googlegroups.com
> >> Note that posts from new members are moderated - please be patient with
> >> your first post.
> >> To unsubscribe from 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.
> >>
> >>
> >>
> >
> > -- 
> 
> -- 
> Phillip Lord,   Phone: +44 (0) 191 222 7827
> Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk
> School of Computing Science,
> http://homepages.cs.ncl.ac.uk/phillip.lord
> Room 914 Claremont Tower,   skype: russet_apples
> Newcastle University,   twitter: phillord
> NE1 7RU 
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from 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.




Re: Like "if", but it composes functions

2013-02-20 Thread Jonathan Fischer Friberg
Function composition similar to that has been explored a lot in the haskell
world. See:

http://www.haskell.org/haskellwiki/Arrow

I also made a small library to implement some of the operators:

https://github.com/odyssomay/clj-arrow

I think the reason arrows are so interesting in haskell is because they
generalize monads.
However, in clojure I have found them to make code harder to write/read
rather than easier,
so I kind of gave up the concept after a while (and haven't updated the
library). Although
it's possible that they are actually highly useful and I've just missed
something.

Jonathan


On Wed, Feb 20, 2013 at 3:55 PM, James MacAulay  wrote:

> Ben: of course, haha...making it a macro seems rather silly now :P
>
> Alan: I didn't know about useful before, thanks for the pointer! fix and
> to-fix look great.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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: Google Summer of Code 2013

2013-02-20 Thread Ambrose Bonnaire-Sergeant
I've added two projects related to core.typed.

FYI: I am technically qualified to participate as a student in GSoC 2013,
but I may participate as a mentor instead. I'm hoping to find out in the
next few weeks.

http://dev.clojure.org/display/community/Project+Ideas#ProjectIdeas-TypeSystems

On Thu, Feb 21, 2013 at 12:41 AM, David Nolen wrote:

> It's probably possible but too broad a scope for GSoC 2013. I think the
> community would be better served by directly contributing to core.logic &
> core.typed both of which could use lots of help :)
>
>
> On Wed, Feb 20, 2013 at 11:13 AM, Maik Schünemann <
> maikschuenem...@gmail.com> wrote:
>
>> given the current position of core.logic and core.typed
>> I wonder if it would be in range of a gsoc project to implement something
>> similar to Qis type system for clojure
>> (here is a link to an example of using Qis type system
>> http://programmingkungfuqi.blogspot.de/2006/04/qi-and-magic-prime-type.html
>>
>> and it is documented in detail in the official qi book
>> http://www.lambdassociates.org/Book/page000.htm)
>>
>> If something like this is possible I'w be happy to give it a try
>>
>>
>> On Sat, Feb 16, 2013 at 2:43 PM, Daniel Solano Gómez > > wrote:
>>
>>> These sound like some good ideas.  Feel free to add a core.matrix
>>> category to the project ideas page.
>>>
>>> Thanks,
>>>
>>> Daniel
>>>
>>> On Sat Feb 16 01:02 2013, Mikera wrote:
>>> > Awesome stuff!
>>> >
>>> > core.matrix has a lot of great opportunities to work on something
>>> > meaningful, and I'd be happy to mentor one or more students in this
>>> area.
>>> > Top of my list would be:
>>> >
>>> >  - Extending core.matrix support to Incanter (medium, needs
>>> collaboration
>>> > with Incanter team)
>>> >  - A full NumPy style NDArray implementation in Clojure (large, quite
>>> > advanced)
>>> >  - core.matrix support for data tables (e.g. database resultsets,
>>> > statistical datasets etc.) (medium)
>>> >
>>> > Will post a proposal along these lines.
>>> >
>>> > On Friday, 15 February 2013 02:03:58 UTC+8, Daniel Solano Gómez wrote:
>>> > >
>>> > > Hello, all,
>>> > >
>>> > > It's official:  Google Summer of Code 2013 is on.
>>> > >
>>> > > Last year, Clojure was able to get four students who worked on
>>> projects
>>> > > like Typed Clojure, Clojure on Android, Clojure and Lua, and
>>> Overtone, and
>>> > > I'd love to see Clojure be a mentoring organisation again this year.
>>> > >
>>> > > I have created a GSoC 2013 page on the Clojure community wiki <
>>> > > http://dev.clojure.org/display/community/Google+Summer+of+Code+2013
>>> >.
>>> > >  Here you will be able to find the latest information about what's
>>> going on
>>> > > with Clojure's GSoC 2013 effort and how to get involved.
>>> > >
>>> > > Here's some ways you can help:
>>> > >
>>> > > * Let people in your local user groups or university know about
>>> Clojure
>>> > > and GSoC.
>>> > > * If you're going to Clojure/West, attend the GSoC unsession.
>>> > >
>>> > > For students
>>> > >
>>> > > * Start researching project ideas and get involved with the relevant
>>> > > communities to find mentors.
>>> > >
>>> > > For developers:
>>> > >
>>> > > Does your open source project have a backlog of features to
>>> implement?
>>> > >  GSoC is a great way to draw new contributors to your project.
>>> > >
>>> > > * Post it to the project idea page and become a mentor.
>>> > > * Let people know about GSoC on your project mailing list.
>>> > >
>>> > > I'd like to thank everyone in advance for helping with our GSoC 2013
>>> > > project.
>>> > >
>>> > > Sincerely,
>>> > >
>>> > > Daniel
>>> > >
>>> >
>>> > --
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups "Clojure" group.
>>> > To post to this group, send email to clojure@googlegroups.com
>>> > Note that posts from new members are moderated - please be patient
>>> with your first post.
>>> > To unsubscribe from this group, send email to
>>> > clojure+unsubscr...@googlegroups.com
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/clojure?hl=en
>>> > ---
>>> > 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 unsubs

Re: Faster lein

2013-02-20 Thread Phil Hagelberg

Buck Golemon writes:

> Can I use lein1 and expect the various clojure libraries and templates to 
> work?

Not really. You could use it on your own projects if you stick to a
subset of project.clj that's supported on both, but you would be
hampered contributing to other projects.

Most templates should work with the lein-newnew plugin though.

> There's been several mentions of jark in relation to speeding up lein. From 
> what I see, it doesn't seem battle tested. Do any of you use it on a daily 
> basis?

>From what I can tell, Jark is not under active development. There are a
number of other efforts to address this problem, including a pure-elisp
replacement for `bin/lein` that communicates over nREPL. I've documented
them here:

https://github.com/technomancy/leiningen/wiki/Faster

Hope that helps.

-Phil

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

2013-02-20 Thread Phil Hagelberg

Softaddicts writes:

> SSD + fastest laptop in your price range ;)
> lein2 help takes 12 seconds from start to back at command prompt...

FWIW the help task is basically the worst case scenario for measuring
startup time since it has to load every single task in order to get
docstrings for them. If you just want to measure startup time, use `lein
version` for Leiningen itself and `lein run -m clojure.main -e nil` for
measuring Leiningen plus project boot.

I get about 1.5s for Leiningen alone and just under 4s with a simple
project on my 4-year-old laptop on Leiningen 2.0.0 with no additional
tweaks. Of course, larger projects will take longer, but at that point
it's orthogonal to Leiningen.

-Phil

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

2013-02-20 Thread David Nolen
I've added some projects I'm willing to mentor as well
http://dev.clojure.org/display/community/Project+Ideas


On Wed, Feb 20, 2013 at 1:10 PM, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> I've added two projects related to core.typed.
>
> FYI: I am technically qualified to participate as a student in GSoC 2013,
> but I may participate as a mentor instead. I'm hoping to find out in the
> next few weeks.
>
>
> http://dev.clojure.org/display/community/Project+Ideas#ProjectIdeas-TypeSystems
>
>
> On Thu, Feb 21, 2013 at 12:41 AM, David Nolen wrote:
>
>> It's probably possible but too broad a scope for GSoC 2013. I think the
>> community would be better served by directly contributing to core.logic &
>> core.typed both of which could use lots of help :)
>>
>>
>> On Wed, Feb 20, 2013 at 11:13 AM, Maik Schünemann <
>> maikschuenem...@gmail.com> wrote:
>>
>>> given the current position of core.logic and core.typed
>>> I wonder if it would be in range of a gsoc project to implement something
>>> similar to Qis type system for clojure
>>> (here is a link to an example of using Qis type system
>>> http://programmingkungfuqi.blogspot.de/2006/04/qi-and-magic-prime-type.html
>>>
>>> and it is documented in detail in the official qi book
>>> http://www.lambdassociates.org/Book/page000.htm)
>>>
>>> If something like this is possible I'w be happy to give it a try
>>>
>>>
>>> On Sat, Feb 16, 2013 at 2:43 PM, Daniel Solano Gómez <
>>> cloj...@sattvik.com> wrote:
>>>
 These sound like some good ideas.  Feel free to add a core.matrix
 category to the project ideas page.

 Thanks,

 Daniel

 On Sat Feb 16 01:02 2013, Mikera wrote:
 > Awesome stuff!
 >
 > core.matrix has a lot of great opportunities to work on something
 > meaningful, and I'd be happy to mentor one or more students in this
 area.
 > Top of my list would be:
 >
 >  - Extending core.matrix support to Incanter (medium, needs
 collaboration
 > with Incanter team)
 >  - A full NumPy style NDArray implementation in Clojure (large, quite
 > advanced)
 >  - core.matrix support for data tables (e.g. database resultsets,
 > statistical datasets etc.) (medium)
 >
 > Will post a proposal along these lines.
 >
 > On Friday, 15 February 2013 02:03:58 UTC+8, Daniel Solano Gómez wrote:
 > >
 > > Hello, all,
 > >
 > > It's official:  Google Summer of Code 2013 is on.
 > >
 > > Last year, Clojure was able to get four students who worked on
 projects
 > > like Typed Clojure, Clojure on Android, Clojure and Lua, and
 Overtone, and
 > > I'd love to see Clojure be a mentoring organisation again this year.
 > >
 > > I have created a GSoC 2013 page on the Clojure community wiki <
 > > http://dev.clojure.org/display/community/Google+Summer+of+Code+2013
 >.
 > >  Here you will be able to find the latest information about what's
 going on
 > > with Clojure's GSoC 2013 effort and how to get involved.
 > >
 > > Here's some ways you can help:
 > >
 > > * Let people in your local user groups or university know about
 Clojure
 > > and GSoC.
 > > * If you're going to Clojure/West, attend the GSoC unsession.
 > >
 > > For students
 > >
 > > * Start researching project ideas and get involved with the relevant
 > > communities to find mentors.
 > >
 > > For developers:
 > >
 > > Does your open source project have a backlog of features to
 implement?
 > >  GSoC is a great way to draw new contributors to your project.
 > >
 > > * Post it to the project idea page and become a mentor.
 > > * Let people know about GSoC on your project mailing list.
 > >
 > > I'd like to thank everyone in advance for helping with our GSoC 2013
 > > project.
 > >
 > > Sincerely,
 > >
 > > Daniel
 > >
 >
 > --
 > --
 > You received this message because you are subscribed to the Google
 > Groups "Clojure" group.
 > To post to this group, send email to clojure@googlegroups.com
 > Note that posts from new members are moderated - please be patient
 with your first post.
 > To unsubscribe from this group, send email to
 > clojure+unsubscr...@googlegroups.com
 > For more options, visit this group at
 > http://groups.google.com/group/clojure?hl=en
 > ---
 > 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 p

Re: Create map from vector of keywords and other items

2013-02-20 Thread Mauricio Aldazosa
Don't know if it's better, but:

(apply hash-map (map-indexed #(if (= 0 (mod %1 2)) (first %2) (vec %2))
  (partition-by keyword? [:key1 1 2 3 :key2 4
:key3 5 6 7])))

Seems to work.

Mauricio

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




Unable to Authenticate via Friend + Interactive Form Workflow

2013-02-20 Thread Ari
Hi,

I'm trying to incorporate authentication via the interactive form workflow; 
however, I'm currently unable to receive submitted credentials for 
verification. When I submit the sign-in form that has it's action bound to 
"/login", I get "Page not found" as per my default route below. I've 
included the relevant code below; does anyone see anything wrong? 

Note: For the first go-around I opted for a dummy in-memory user db. I'm 
also using compojure, ring-anti-forgery and shoreleave-remote.

(defroutes paths
  (GET "/home" [] (friend/authorize #{::user} views/home))
  (GET "/" [] (views/welcome))
  (friend/logout (ANY "/sign-out" request (ring.util.response/redirect 
"/")))
  (route/resources "/")
  (route/not-found "Page not found"))

(def app
  (-> paths
  (friend/authenticate {:credential-fn (partial 
credentials/bcrypt-credential-fn users)
:workflows [(workflows/interactive-form)]
:login-uri "/"})
  (wrap-anti-forgery)  
  (wrap-rpc)
  (handler/site)))

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




Clojure-CLR - Where to report issues?

2013-02-20 Thread Frank Hale
I wanted to report an issue with Clojure-CLR 1.4.1 that I am seeing but the
issues section on the Clojure-CLR Github must be disabled because the link
is not showing up.

When I run the REPL I get a lot of duplicated warnings. I've pasted the
warnings below.

C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1>Clojure.Main.exe
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Reflection warning,
C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
- call to aget can't be resolved.
Clojure 1.4.1
user=>

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

2013-02-20 Thread Nelson Morris
On Wed, Feb 20, 2013 at 2:48 PM, Ari  wrote:
> Hi,
>
> I'm trying to incorporate authentication via the interactive form workflow;
> however, I'm currently unable to receive submitted credentials for
> verification. When I submit the sign-in form that has it's action bound to
> "/login", I get "Page not found" as per my default route below. I've
> included the relevant code below; does anyone see anything wrong?
>
> Note: For the first go-around I opted for a dummy in-memory user db. I'm
> also using compojure, ring-anti-forgery and shoreleave-remote.
>
> (defroutes paths
>   (GET "/home" [] (friend/authorize #{::user} views/home))
>   (GET "/" [] (views/welcome))
>   (friend/logout (ANY "/sign-out" request (ring.util.response/redirect
> "/")))
>   (route/resources "/")
>   (route/not-found "Page not found"))
>
> (def app
>   (-> paths
>   (friend/authenticate {:credential-fn (partial
> credentials/bcrypt-credential-fn users)
> :workflows [(workflows/interactive-form)]
> :login-uri "/"})
>   (wrap-anti-forgery)
>   (wrap-rpc)
>   (handler/site)))

Passing a :login-uri causes workflows/interactive-from to change what
uri it checks for.  Given the setup above the login form needs to post
to "/".

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

2013-02-20 Thread Ilshad Khabibullin
Hi Ari,

you have to add wrappers:

ring.middleware.params/wrap-parms
ring.middleware.keyword-params/wrap-keyword-params


---
Ilshad Khabibullin
+7 981 688 26 35





On Feb 21, 2013, at 12:48 AM, Ari  wrote:

> Hi,
> 
> I'm trying to incorporate authentication via the interactive form workflow; 
> however, I'm currently unable to receive submitted credentials for 
> verification. When I submit the sign-in form that has it's action bound to 
> "/login", I get "Page not found" as per my default route below. I've included 
> the relevant code below; does anyone see anything wrong? 
> 
> Note: For the first go-around I opted for a dummy in-memory user db. I'm also 
> using compojure, ring-anti-forgery and shoreleave-remote.
> 
> (defroutes paths
>   (GET "/home" [] (friend/authorize #{::user} views/home))
>   (GET "/" [] (views/welcome))
>   (friend/logout (ANY "/sign-out" request (ring.util.response/redirect "/")))
>   (route/resources "/")
>   (route/not-found "Page not found"))
> 
> (def app
>   (-> paths
>   (friend/authenticate {:credential-fn (partial 
> credentials/bcrypt-credential-fn users)
> :workflows [(workflows/interactive-form)]
> :login-uri "/"})
>   (wrap-anti-forgery)  
>   (wrap-rpc)
>   (handler/site)))
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from 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-CLR - Where to report issues?

2013-02-20 Thread Andy Fingerhut
I believe anyone should be able to create an account at this web site and then 
create a ticket.  If you have any trouble doing so, let me know.

http://dev.clojure.org/jira/browse/CLJCLR

Andy

On Feb 20, 2013, at 12:58 PM, Frank Hale wrote:

> I wanted to report an issue with Clojure-CLR 1.4.1 that I am seeing but the 
> issues section on the Clojure-CLR Github must be disabled because the link is 
> not showing up. 
> 
> When I run the REPL I get a lot of duplicated warnings. I've pasted the 
> warnings below. 
> 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1>Clojure.Main.exe
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Reflection warning, 
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
> - call to aget can't be resolved.
> Clojure 1.4.1
> user=>

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

2013-02-20 Thread Frank Hale
Thank you. New ticket created.


On Wed, Feb 20, 2013 at 4:20 PM, Andy Fingerhut wrote:

> I believe anyone should be able to create an account at this web site and
> then create a ticket.  If you have any trouble doing so, let me know.
>
> http://dev.clojure.org/jira/browse/CLJCLR
>
> Andy
>
> On Feb 20, 2013, at 12:58 PM, Frank Hale wrote:
>
> > I wanted to report an issue with Clojure-CLR 1.4.1 that I am seeing but
> the issues section on the Clojure-CLR Github must be disabled because the
> link is not showing up.
> >
> > When I run the REPL I get a lot of duplicated warnings. I've pasted the
> warnings below.
> >
> > C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1>Clojure.Main.exe
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Reflection warning,
> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139
> - call to aget can't be resolved.
> > Clojure 1.4.1
> > user=>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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: Faster lein

2013-02-20 Thread AtKaaZ
on win7 64bit
Microsoft Windows [Version 6.1.7601]

C:\Users\user>cd \1

C:\1>powershell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\1> Measure-Command {*lein version*}


Days  : 0
Hours : 0
Minutes   : 0
Seconds   : 3
Milliseconds  : 562
Ticks : 35624113
TotalDays : 4.12316122685185E-05
TotalHours: 0.00098955869444
TotalMinutes  : 0.059373521667
TotalSeconds  : *3.56*24113
TotalMilliseconds : 3562.4113



PS C:\1> Measure-Command {*lein new someproj1*}


Days  : 0
Hours : 0
Minutes   : 0
Seconds   : 4
Milliseconds  : 362
Ticks : 43622473
TotalDays : 5.04889733796296E-05
TotalHours: 0.0012117353611
TotalMinutes  : 0.072704121667
TotalSeconds  : *4.36*22473
TotalMilliseconds : 4362.2473



PS C:\1> cd .\someproj1
PS C:\1\someproj1> Measure-Command {*lein uberjar*}


Days  : 0
Hours : 0
Minutes   : 0
Seconds   : 8
Milliseconds  : 461
Ticks : 84613500
TotalDays : 9.7932291667E-05
TotalHours: 0.002350375
TotalMinutes  : 0.1410225
TotalSeconds  : *8.4*6135
TotalMilliseconds : 8461.35



PS C:\1\someproj1> Measure-Command {*lein help*}


Days  : 0
Hours : 0
Minutes   : 0
Seconds   : 12
Milliseconds  : 220
Ticks : 122208485
TotalDays : 0.000141445005787037
TotalHours: 0.0033946801389
TotalMinutes  : 0.20368080833
TotalSeconds  : *12.22*08485
TotalMilliseconds : 12220.8485




On Wed, Feb 20, 2013 at 8:05 PM, Phil Hagelberg  wrote:

>
> Softaddicts writes:
>
> > SSD + fastest laptop in your price range ;)
> > lein2 help takes 12 seconds from start to back at command prompt...
>
> FWIW the help task is basically the worst case scenario for measuring
> startup time since it has to load every single task in order to get
> docstrings for them. If you just want to measure startup time, use `lein
> version` for Leiningen itself and `lein run -m clojure.main -e nil` for
> measuring Leiningen plus project boot.
>
> I get about 1.5s for Leiningen alone and just under 4s with a simple
> project on my 4-year-old laptop on Leiningen 2.0.0 with no additional
> tweaks. Of course, larger projects will take longer, but at that point
> it's orthogonal to Leiningen.
>
> -Phil
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> 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.
>
>
>


-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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: Faster lein

2013-02-20 Thread Softaddicts
I am around the same figures, mostly cpu time.

If I take our software which is AOT compiled, I can eval nil (or simple values)
through clojure.man in 0.9 seconds. I see this as a significant improvement,
we use about two dozen Clojure libs, most of which get at least partially 
compiled
prior to launch.

I still wonder how better lein would fare with an AOT version for my specific 
vm.

I leave for a business trip in a couple weeks. Looks like the kind of project
I could find sone time working on.

I understand not delivering AOT libs through maven not knowing the target
environment but having a tuning tool to speed up loading by avoiding compilation
would help with all the tooling starting to appear.

I suspect that most people are not switching JVMs every hour or so.

Thoughts ?

Luc

> 
> Softaddicts writes:
> 
> > SSD + fastest laptop in your price range ;)
> > lein2 help takes 12 seconds from start to back at command prompt...
> 
> FWIW the help task is basically the worst case scenario for measuring
> startup time since it has to load every single task in order to get
> docstrings for them. If you just want to measure startup time, use `lein
> version` for Leiningen itself and `lein run -m clojure.main -e nil` for
> measuring Leiningen plus project boot.
> 
> I get about 1.5s for Leiningen alone and just under 4s with a simple
> project on my 4-year-old laptop on Leiningen 2.0.0 with no additional
> tweaks. Of course, larger projects will take longer, but at that point
> it's orthogonal to Leiningen.
> 
> -Phil
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> 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.




Re: Unable to Authenticate via Friend + Interactive Form Workflow

2013-02-20 Thread larry google groups
> ring.middleware.params/wrap-parms
> ring.middleware.keyword-params/wrap-keyword-params

No, he already has: 

  (handler/site))

Which should add in the middleware that you mention. But in my app I have: 

handler/site)

instead of:

(handler/site))

I think it gets rolled up and called at the end, so I am not sure the 
parens are needed. 




On Wednesday, February 20, 2013 4:14:29 PM UTC-5, Ilshad Khabibullin wrote:
>
> Hi Ari,
>
> you have to add wrappers:
>
> ring.middleware.params/wrap-parms
> ring.middleware.keyword-params/wrap-keyword-params
>
>
> ---
> Ilshad Khabibullin
> +7 981 688 26 35
>
>
>
>
>  
> On Feb 21, 2013, at 12:48 AM, Ari > 
> wrote:
>
> Hi,
>
> I'm trying to incorporate authentication via the interactive form 
> workflow; however, I'm currently unable to receive submitted credentials 
> for verification. When I submit the sign-in form that has it's action bound 
> to "/login", I get "Page not found" as per my default route below. I've 
> included the relevant code below; does anyone see anything wrong? 
>
> Note: For the first go-around I opted for a dummy in-memory user db. I'm 
> also using compojure, ring-anti-forgery and shoreleave-remote.
>
> (defroutes paths
>   (GET "/home" [] (friend/authorize #{::user} views/home))
>   (GET "/" [] (views/welcome))
>   (friend/logout (ANY "/sign-out" request (ring.util.response/redirect 
> "/")))
>   (route/resources "/")
>   (route/not-found "Page not found"))
>
> (def app
>   (-> paths
>   (friend/authenticate {:credential-fn (partial 
> credentials/bcrypt-credential-fn users)
> :workflows [(workflows/interactive-form)]
> :login-uri "/"})
>   (wrap-anti-forgery)  
>   (wrap-rpc)
>   (handler/site)))
>
> -- 
> -- 
> 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: Clojure-CLR - Where to report issues?

2013-02-20 Thread dmiller
Judging from the transcript, there is something not right in your 
ClojureCLR setup.
protocols.clj should not be loading.  It should be AOT-compiled.
We can work from the JIRA ticket.

-David


On Wednesday, February 20, 2013 3:30:52 PM UTC-6, Frank Hale wrote:
>
> Thank you. New ticket created.
>
>
> On Wed, Feb 20, 2013 at 4:20 PM, Andy Fingerhut 
> 
> > wrote:
>
>> I believe anyone should be able to create an account at this web site and 
>> then create a ticket.  If you have any trouble doing so, let me know.
>>
>> http://dev.clojure.org/jira/browse/CLJCLR
>>
>> Andy
>>
>> On Feb 20, 2013, at 12:58 PM, Frank Hale wrote:
>>
>> > I wanted to report an issue with Clojure-CLR 1.4.1 that I am seeing but 
>> the issues section on the Clojure-CLR Github must be disabled because the 
>> link is not showing up.
>> >
>> > When I run the REPL I get a lot of duplicated warnings. I've pasted the 
>> warnings below.
>> >
>> > C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1>Clojure.Main.exe
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Reflection warning, 
>> C:\Users\Frank.Hale\Desktop\clojure-clr-1.4.1\clojure\core\protocols.clj:139 
>> - call to aget can't be resolved.
>> > Clojure 1.4.1
>> > user=>
>>
>> --
>> --
>> 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: Unable to Authenticate via Friend + Interactive Form Workflow

2013-02-20 Thread Ilshad Khabibullin
Ah, thanks.

On Feb 21, 2013, at 1:42 AM, larry google groups  
wrote:

> > ring.middleware.params/wrap-parms
> > ring.middleware.keyword-params/wrap-keyword-params
> 
> No, he already has: 
> 
>   (handler/site))
> 
> Which should add in the middleware that you mention. But in my app I have: 
> 
> handler/site)
> 
> instead of:
> 
> (handler/site))
> 
> I think it gets rolled up and called at the end, so I am not sure the parens 
> are needed. 
> 
> 
> 
> 
> On Wednesday, February 20, 2013 4:14:29 PM UTC-5, Ilshad Khabibullin wrote:
> Hi Ari,
> 
> you have to add wrappers:
> 
> ring.middleware.params/wrap-parms
> ring.middleware.keyword-params/wrap-keyword-params
> 
> 
> ---
> Ilshad Khabibullin
> +7 981 688 26 35
> 
> 
> 
> 
> 
> On Feb 21, 2013, at 12:48 AM, Ari  wrote:
> 
>> Hi,
>> 
>> I'm trying to incorporate authentication via the interactive form workflow; 
>> however, I'm currently unable to receive submitted credentials for 
>> verification. When I submit the sign-in form that has it's action bound to 
>> "/login", I get "Page not found" as per my default route below. I've 
>> included the relevant code below; does anyone see anything wrong? 
>> 
>> Note: For the first go-around I opted for a dummy in-memory user db. I'm 
>> also using compojure, ring-anti-forgery and shoreleave-remote.
>> 
>> (defroutes paths
>>   (GET "/home" [] (friend/authorize #{::user} views/home))
>>   (GET "/" [] (views/welcome))
>>   (friend/logout (ANY "/sign-out" request (ring.util.response/redirect "/")))
>>   (route/resources "/")
>>   (route/not-found "Page not found"))
>> 
>> (def app
>>   (-> paths
>>   (friend/authenticate {:credential-fn (partial 
>> credentials/bcrypt-credential-fn users)
>> :workflows [(workflows/interactive-form)]
>> :login-uri "/"})
>>   (wrap-anti-forgery)  
>>   (wrap-rpc)
>>   (handler/site)))
>> 
>> -- 
>> -- 
>> 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.
>  
>  

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

2013-02-20 Thread Frank Hale
okay, I just compiled from the Clojure-CLR 1.4.1 branch in 'Release' mode
and then copied the binaries out to a directory and opened a terminal there
to run the REPL.


On Wed, Feb 20, 2013 at 4:42 PM, dmiller  wrote:

> Judging from the transcript, there is something not right in your
> ClojureCLR setup.
> protocols.clj should not be loading.  It should be AOT-compiled.
> We can work from the JIRA ticket.
>
> -David
>
>
> On Wednesday, February 20, 2013 3:30:52 PM UTC-6, Frank Hale wrote:
>
>> Thank you. New ticket created.
>>
>>
>> On Wed, Feb 20, 2013 at 4:20 PM, Andy Fingerhut wrote:
>>
>>> I believe anyone should be able to create an account at this web site
>>> and then create a ticket.  If you have any trouble doing so, let me know.
>>>
>>> 
>>> http://dev.clojure.org/jira/**browse/CLJCLR
>>>
>>> Andy
>>>
>>> On Feb 20, 2013, at 12:58 PM, Frank Hale wrote:
>>>
>>> > I wanted to report an issue with Clojure-CLR 1.4.1 that I am seeing
>>> but the issues section on the Clojure-CLR Github must be disabled because
>>> the link is not showing up.
>>> >
>>> > When I run the REPL I get a lot of duplicated warnings. I've pasted
>>> the warnings below.
>>> >
>>> > C:\Users\Frank.Hale\Desktop\**clojure-clr-1.4.1>Clojure.**Main.exe
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Reflection warning, C:\Users\Frank.Hale\Desktop\**
>>> clojure-clr-1.4.1\clojure\**core\protocols.clj:139 - call to aget can't
>>> be resolved.
>>> > Clojure 1.4.1
>>> > user=>
>>>
>>> --
>>> --
>>> 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.
>
>
>

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

Re: Unable to Authenticate via Friend + Interactive Form Workflow

2013-02-20 Thread Ari


> Passing a :login-uri causes workflows/interactive-from to change what 
> uri it checks for.  Given the setup above the login form needs to post 
> to "/". 
>

I was under the impression that the :login-uri was on for only getting the 
form. Do you know if the GET and POST uris can be separated via 
configuration?

Also, if the username is an email address authentication, in spite of 
correct credentials, fails. Anyone know why that is? Thanks.

-Ari

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




a bit mystified by unchecked-multiply

2013-02-20 Thread John Lawrence Aspden
Hi, I'm getting an unexpected exception trying to do unchecked
arithmetic:

user=> (def seed1 25214903917)
#'user/seed1
user=> (type seed1)
java.lang.Long
user=> (type 25214903917)
java.lang.Long
user=> (unchecked-multiply seed1 0x5DEECE66D)
ArithmeticException integer overflow
clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388)

user=> (unchecked-multiply 25214903917 0x5DEECE66D)
8602081037417187945

Could someone explain what's going on for 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: a bit mystified by unchecked-multiply

2013-02-20 Thread AtKaaZ
looks like different methods are called:

for: user=> (unchecked-multiply 25214903917 0x5DEECE66D)
this method: static public long unchecked_multiply(long x, long y){return x
* y;}


for: (unchecked-multiply seed1 0x5DEECE66D)
this method: static public Number unchecked_multiply(long x, Object
y){return multiply(x,y);}

long story short this gets called:
static public long multiply(long x, long y){
long ret = x * y;
if (y != 0 && ret/y != x)
return throwIntOverflow();
return ret;
}


On Wed, Feb 20, 2013 at 11:25 PM, John Lawrence Aspden <
aspd...@googlemail.com> wrote:

> Hi, I'm getting an unexpected exception trying to do unchecked
> arithmetic:
>
> user=> (def seed1 25214903917)
> #'user/seed1
> user=> (type seed1)
> java.lang.Long
> user=> (type 25214903917)
> java.lang.Long
> user=> (unchecked-multiply seed1 0x5DEECE66D)
> ArithmeticException integer overflow
> clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388)
>
> user=> (unchecked-multiply 25214903917 0x5DEECE66D)
> 8602081037417187945
>
> Could someone explain what's going on for 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.
>
>
>


-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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: a bit mystified by unchecked-multiply

2013-02-20 Thread AtKaaZ
looks like if you make any(or both) to double it works as expected due to
these being called:

static public double multiply(double x, double y){
return x * y;
}

static public double multiply(double x, long y){
return x * y;
}

static public double multiply(long x, double y){
return x * y;
}

=> (unchecked-multiply (double 25214903917) 25214903917)
6.35791379543542E20
=> (unchecked-multiply (double 25214903917) (double 25214903917))
6.35791379543542E20
=> (unchecked-multiply 25214903917 (double 25214903917))
6.35791379543542E20

but it didn't overflow:
=> (= 25214903917.0 (/
  (unchecked-multiply 25214903917 (double 25214903917))
  25214903917))
true

but this did:
=> (= 123E300
 (/
 (unchecked-multiply
 123E300
 (double
 123E300))
 123E300))
false
=> 123E300
1.23E302
=> *clojure-version*
{:major 1, :minor 5, :incremental 0, :qualifier "RC16"}

So, given my prev. post, it's apparently a bug in clojure? with the
unchecked-multiply if any of the params(or both) is "object" when compared
to when they're both "primitive" aka Long.



On Wed, Feb 20, 2013 at 11:40 PM, AtKaaZ  wrote:

>
> looks like different methods are called:
>
> for: user=> (unchecked-multiply 25214903917 0x5DEECE66D)
> this method: static public long unchecked_multiply(long x, long y){return
> x * y;}
>
>
> for: (unchecked-multiply seed1 0x5DEECE66D)
> this method: static public Number unchecked_multiply(long x, Object
> y){return multiply(x,y);}
>
> long story short this gets called:
> static public long multiply(long x, long y){
> long ret = x * y;
> if (y != 0 && ret/y != x)
> return throwIntOverflow();
> return ret;
> }
>
>
> On Wed, Feb 20, 2013 at 11:25 PM, John Lawrence Aspden <
> aspd...@googlemail.com> wrote:
>
>> Hi, I'm getting an unexpected exception trying to do unchecked
>> arithmetic:
>>
>> user=> (def seed1 25214903917)
>> #'user/seed1
>> user=> (type seed1)
>> java.lang.Long
>> user=> (type 25214903917)
>> java.lang.Long
>> user=> (unchecked-multiply seed1 0x5DEECE66D)
>> ArithmeticException integer overflow
>> clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388)
>>
>> user=> (unchecked-multiply 25214903917 0x5DEECE66D)
>> 8602081037417187945
>>
>> Could someone explain what's going on for 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.
>>
>>
>>
>
>
> --
> Please correct me if I'm wrong or incomplete,
> even if you think I'll subconsciously hate it.
>
>


-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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: a bit mystified by unchecked-multiply

2013-02-20 Thread Herwig Hochleitner
I agree that unchecked-multiply should do an unchecked multiply, even when
faced with objects. Going to bring that up on clojure-dev.

A workaround: (unchecked-multiply (long seed1) 0x5DEECE66D)

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

2013-02-20 Thread Phil Hagelberg

Herwig Hochleitner writes:

>> I understand not delivering AOT libs through maven not knowing the target
>> environment but having a tuning tool to speed up loading by avoiding
> compilation
>> would help with all the tooling starting to appear.
>
> How about a lein-bytecache plugin, that can AOT compile and manage the
> .class files of released jars in the ~/.cache directory.
> When that's up and running, leiningen could make use of it for the
> leiningen jar itself.

Unless you want to clear the cache manually every time your dependencies
change, you'd have to make a parallel tree of jars for each version of
Clojure you plan on using.

I think the simplest way to do this would be with a proxying repository
that also cross-compiled jars to new artifacts with added classifiers as
they came through. You'd also need a bit of magic on the Leiningen side
with some middleware in a plugin to add classifiers to every Clojure
dependency. But I have no idea how you would easily tell apart Clojure
jars from Java jars without opening them up to inspect their contents,
which could add a startup time penalty.

Anyway, it can certainly be done. I suspect you'd get more bang for your
buck by just compiling it once and not doing a clean, but protocols kind
of throw a wrench in that plan when it comes to AOT.

-Phil

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

2013-02-20 Thread Stephen Compall
On Feb 20, 2013 5:55 AM, "Phillip Lord" 
wrote:
>  (do
>(assoc curr (inc j) 0)
>(recur (inc j) max-len)))

Here you're discarding the result of assoc, a pure function, which changes
the code's nature significantly.

>  (do
>(assoc! curr (inc j) 0)
>(recur (inc j) max-len)))

Nor is it safe to discard the result of calling assoc!; see how assoc! is
used in other online examples.

--
Stephen Compall
If anyone in the MSA is online, you should watch this flythrough.

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

2013-02-20 Thread Devin Walters
Surprised this hasn't gotten more attention. Well done. Looking forward to 
using this on future projects.

'(Devin Walters)

On Feb 20, 2013, at 1:33 AM, Alan Dipert  wrote:

> Hi all,
> We recently released a ClojureScript library for FRP called Javelin.  Links 
> of interest: 
> 
> * Release announcement: 
> http://tailrecursion.com/blog/2013/02/15/introducing-javelin-an-frp-library-for-clojurescript/
> * Demos (more on the way): http://tailrecursion.com/~alan/javelin-demos/
> * GitHub project: https://github.com/tailrecursion/javelin
> 
> In a nutshell, Javelin is an abstract spreadsheet that encourages working 
> with concrete values instead of abstract event streams a la FRP.  It supports 
> "discrete propagation", which most FRP implementations provide as the event 
> stream, via the ability to toggle cells between discrete/continuous 
> propagation modes.  Cell mutation semantics are those of ClojureScript atoms.
> 
> We have ported Javelin's core to a ref-based Clojure implementation capable 
> of parallel propagation and hope to release it soon.  Among other things, our 
> hope is to use it to process Prismatic graph [1] -compatible workflows 
> reactively.  If you are using graph or flow [2] and are interested in 
> reactive processing, and wouldn't mind helping us with performance testing, 
> drop me a line. 
> 
> Thanks for giving Javelin a look! I look forward to your feedback and 
> collaboration.
> 
> Alan
> 
> 1. https://github.com/Prismatic/plumbing
> 2. https://github.com/stuartsierra/flow
> 
> 
> 
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from 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] Javelin, spreadsheet-like FRP for ClojureScript

2013-02-20 Thread Rich Morin
On Feb 20, 2013, at 1:33 AM, Alan Dipert wrote:
>> We recently released a ClojureScript library for FRP ...


On Feb 20, 2013, at 17:02, Devin Walters wrote:
> Surprised this hasn't gotten more attention.  Well done.
> Looking forward to using this on future projects.

Indeed.  I'm a big fan of FRP:

  Fibre-reinforced plastic (FRP) (also fibre-reinforced polymer)
  is a composite material made of a polymer matrix reinforced with
  fibres.  The fibres are usually glass, carbon, basalt or aramid,
  although other fibres such as paper or wood or asbestos have
  been sometimes used.  The polymer is usually an epoxy, vinylester
  or polyester thermosetting plastic, and phenol formaldehyde
  resins are still in use. FRPs are commonly used in the aerospace,
  automotive, marine, and construction industries.

  -- http://en.wikipedia.org/wiki/Fibre-reinforced_plastic

Knowing that I can use it from Clojure will certainly influence
my design plans for upcoming projects.  Seriously, folks, please
add a (brief) explanation of TLAs and such in your announcements.

-r

 -- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume r...@cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Software system design, development, and 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: how would you implement sending out a verification email?

2013-02-20 Thread Matching Socks
By the way, in a speech at November's Clojure/conj, some guy remarked that 
queues are good, and the mere fact that he hadn't found it necessary for 
Clojure to wrap them shouldn't signal that there's something wrong with 
them.  When a queue would help, use a queue.  

In your application... well, suppose that as a hedge against being enlisted 
to spam innocent victims, you wanted to rate-limit the email transmission.  
You might use the agent send-off in the transaction, not to send email 
directly, but rather to enqueue a reminder to send email eventually, and 
meanwhile a single rate-limited loop would work the queue.

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

2013-02-20 Thread James Reichley
Here's my take:

(defn partition' [coll]
  (let [coll' (partition-by keyword? coll)]
(reduce merge {}
(map vector (flatten (take-nth 2 coll')) (take-nth 2 (rest 
coll'))

Note that this breaks if some keys point to empty sets

On Wednesday, February 20, 2013 6:50:42 AM UTC-5, Stefan Kamphausen wrote:
>
> Hi,
>
> given a vector of the form
>
>  
>
>  [:key1 1 2 3 :key2 4 :key3 5 6 7]
>
> I wand to create a map collecting the items behind each keyword as a vector 
> like this:
>
>  {:key1 [1 2 3] 
>   :key2 [4] 
>   :key3 [5 6 7]}
>
> I have already written two functions which achieve this, but neither of them 
> "feels good" and I am interested in more elegant and idiomatic solutions.
>
> (defn keycollect-partition [coll]
>   (->> coll
>(partition-by keyword?)  ; bundle at key
>(partition 2); kw + its arg
>(map (fn [[[sec] arg]] [sec (vec arg)])) ; destruct the mess
>(into {}))) ; make it a map
>
> (defn keycollect-reduce [coll]
>   (apply zipmap
>  (reduce 
>   (fn [ac x] 
> (if (keyword? x) 
>   [(conj (first ac) x) (conj (second ac) [])]
>   (update-in ac [1 (dec (count (first ac)))] conj x))) [[] []]
>   coll)))
>
> Added complexity: My original vector does not yet contain keywords, but I 
> construct them in a map regexp-matching each item and creating a keyword from 
> the first group of the match.
>
> Any pointers or ideas appreciated.
>
> 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: how would you implement sending out a verification email?

2013-02-20 Thread James Reichley
I can't find the reference now, but either in a screencast or a discussion 
I read it was mentioned that if you have a single thing that performs 
side-effects, you can perform this function last in the transaction without 
worrying about any issues. The reasoning here is that if anything before it 
fails, the side-effect action was never attempted and if the side-effect 
action itself fails then the transaction rolls back like always.

On Wednesday, February 20, 2013 9:32:14 AM UTC-5, Balint Erdi wrote:
>
>  Hey, 
>
> So yesterday we discussed concurrency at our meetup (
> http://www.meetup.com/Budapest-Clojure-User-Group/) and a question 
> occurred to me.
>
> Suppose we have a classic web application. (I'm not currently building 
> such a web app in Clojure, so that's a "theoretical" question).
>
> When the user signs up, a verification email has to be sent and the 
> database entry related to the user has to be updated (or a new datom 
> created ;) ) to reflect the fact that we've sent out the email to the user.
>
> First, we want this to be consistent so that the "verification_sent_out" 
> db field reflects whether the email has really been sent out or not. 
> Secondly, we also want the email to only be sent out once.
>
> My first idea was to use a transaction but if the transaction retries, the 
> email could be sent out several times. A fellow Clojurian advised the 
> sending of the email to be performed by an agent. The agent is "transaction 
> aware" so if the wrapping transaction is retried several times it only 
> sends out the email when the transaction successfully runs.
>
> Is this how this actually works? Is there another, simpler and/or more 
> robust solution? In the languages I come from (e.g Ruby) I'd use a library 
> that handles the queueing and consumption of tasks. Is this how you'd do it 
> in Clojure or it's one of these cases where Clojure itself suffices where 
> other languages are lacking?
>
> Thank you for your answer,
> -- 
> Balint
>
>

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

2013-02-20 Thread Devin Walters
I think Alan provided more than enough info in his announcement. FRP 
(Functional Reactive Programming) is a pretty well-known acronym 'round these 
parts, and the links he provides go a long way toward giving context to FRP 
beginners. 

In any event, I'm going to go ahead and assume TLA refers to the Textile Labour 
Association.


On Wednesday, February 20, 2013 at 7:17 PM, Rich Morin wrote:

> On Feb 20, 2013, at 1:33 AM, Alan Dipert wrote:
> > > We recently released a ClojureScript library for FRP ...
> > 
> 
> 
> 
> On Feb 20, 2013, at 17:02, Devin Walters wrote:
> > Surprised this hasn't gotten more attention. Well done.
> > Looking forward to using this on future projects.
> > 
> 
> 
> Indeed. I'm a big fan of FRP:
> 
> Fibre-reinforced plastic (FRP) (also fibre-reinforced polymer)
> is a composite material made of a polymer matrix reinforced with
> fibres. The fibres are usually glass, carbon, basalt or aramid,
> although other fibres such as paper or wood or asbestos have
> been sometimes used. The polymer is usually an epoxy, vinylester
> or polyester thermosetting plastic, and phenol formaldehyde
> resins are still in use. FRPs are commonly used in the aerospace,
> automotive, marine, and construction industries.
> 
> -- http://en.wikipedia.org/wiki/Fibre-reinforced_plastic
> 
> Knowing that I can use it from Clojure will certainly influence
> my design plans for upcoming projects. Seriously, folks, please
> add a (brief) explanation of TLAs and such in your announcements.
> 
> -r
> 
> -- 
> http://www.cfcl.com/rdm Rich Morin
> http://www.cfcl.com/rdm/resume r...@cfcl.com (mailto:r...@cfcl.com)
> http://www.cfcl.com/rdm/weblog +1 650-873-7841
> 
> Software system design, development, and 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 
> (mailto:clojure@googlegroups.com)
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com 
> (mailto: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 
> (mailto: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: how would you implement sending out a verification email?

2013-02-20 Thread AtKaaZ
James, I remember something similar to that from this thread:
https://groups.google.com/d/msg/datomic/uzmt03egSHI/ThCLFK2iIaMJ


On Thu, Feb 21, 2013 at 3:46 AM, James Reichley wrote:

> I can't find the reference now, but either in a screencast or a discussion
> I read it was mentioned that if you have a single thing that performs
> side-effects, you can perform this function last in the transaction without
> worrying about any issues. The reasoning here is that if anything before it
> fails, the side-effect action was never attempted and if the side-effect
> action itself fails then the transaction rolls back like always.
>
>
> On Wednesday, February 20, 2013 9:32:14 AM UTC-5, Balint Erdi wrote:
>>
>>  Hey,
>>
>> So yesterday we discussed concurrency at our meetup (
>> http://www.meetup.com/**Budapest-Clojure-User-Group/)
>> and a question occurred to me.
>>
>> Suppose we have a classic web application. (I'm not currently building
>> such a web app in Clojure, so that's a "theoretical" question).
>>
>> When the user signs up, a verification email has to be sent and the
>> database entry related to the user has to be updated (or a new datom
>> created ;) ) to reflect the fact that we've sent out the email to the user.
>>
>> First, we want this to be consistent so that the "verification_sent_out"
>> db field reflects whether the email has really been sent out or not.
>> Secondly, we also want the email to only be sent out once.
>>
>> My first idea was to use a transaction but if the transaction retries,
>> the email could be sent out several times. A fellow Clojurian advised the
>> sending of the email to be performed by an agent. The agent is "transaction
>> aware" so if the wrapping transaction is retried several times it only
>> sends out the email when the transaction successfully runs.
>>
>> Is this how this actually works? Is there another, simpler and/or more
>> robust solution? In the languages I come from (e.g Ruby) I'd use a library
>> that handles the queueing and consumption of tasks. Is this how you'd do it
>> in Clojure or it's one of these cases where Clojure itself suffices where
>> other languages are lacking?
>>
>> Thank you for your answer,
>> --
>> Balint
>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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.
>
>
>



-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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: Create map from vector of keywords and other items

2013-02-20 Thread Elias Zaretsky
And this is mine

(defn keycollect-too [key-fn coll]
  (let [not-key (complement key-fn)]
(loop [[k & more] coll, res (transient {})]
  (let [[vv rr] (split-with not-key more)]
(if-not k
  (persistent! res)
  (recur rr (assoc! res k (vec vv

(keycollect-too keyword? [:key1 1 2 3 :key2 4 :key3 5 6 7]) => {:key1 [1 2 
3], :key2 [4], :key3 [5 6 7]}

Thanks.

On Wednesday, February 20, 2013 6:50:42 AM UTC-5, Stefan Kamphausen wrote:
>
> Hi,
>
> given a vector of the form
>
>  
>
>  [:key1 1 2 3 :key2 4 :key3 5 6 7]
>
> I wand to create a map collecting the items behind each keyword as a vector 
> like this:
>
>  {:key1 [1 2 3] 
>   :key2 [4] 
>   :key3 [5 6 7]}
>
> I have already written two functions which achieve this, but neither of them 
> "feels good" and I am interested in more elegant and idiomatic solutions.
>
> (defn keycollect-partition [coll]
>   (->> coll
>(partition-by keyword?)  ; bundle at key
>(partition 2); kw + its arg
>(map (fn [[[sec] arg]] [sec (vec arg)])) ; destruct the mess
>(into {}))) ; make it a map
>
> (defn keycollect-reduce [coll]
>   (apply zipmap
>  (reduce 
>   (fn [ac x] 
> (if (keyword? x) 
>   [(conj (first ac) x) (conj (second ac) [])]
>   (update-in ac [1 (dec (count (first ac)))] conj x))) [[] []]
>   coll)))
>
> Added complexity: My original vector does not yet contain keywords, but I 
> construct them in a map regexp-matching each item and creating a keyword from 
> the first group of the match.
>
> Any pointers or ideas appreciated.
>
> 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: Create map from vector of keywords and other items

2013-02-20 Thread AtKaaZ
whatever the implementation I would include some example in the doc, like:

(defn keycollect-*fnnamehere**
"
**input:
 [:key1 1 2 3
  :key2 4
  :key3 5 6 7]

output:
 {:key1 [1 2 3]
  :key2 [4]
  :key3 [5 6 7]}
"*
  [coll]

  ;... implementation here
)

wish clojure has this kind of doc(s) instead, or at least this if not
+ some words to explain




On Wed, Feb 20, 2013 at 12:50 PM, Stefan Kamphausen wrote:

> Hi,
>
> given a vector of the form
>
>
>
>  [:key1 1 2 3 :key2 4 :key3 5 6 7]
>
> I wand to create a map collecting the items behind each keyword as a vector 
> like this:
>
>  {:key1 [1 2 3]
>   :key2 [4]
>   :key3 [5 6 7]}
>
> I have already written two functions which achieve this, but neither of them 
> "feels good" and I am interested in more elegant and idiomatic solutions.
>
> (defn keycollect-partition [coll]
>   (->> coll
>(partition-by keyword?)  ; bundle at key
>(partition 2); kw + its arg
>(map (fn [[[sec] arg]] [sec (vec arg)])) ; destruct the mess
>(into {}))) ; make it a map
>
> (defn keycollect-reduce [coll]
>   (apply zipmap
>  (reduce
>   (fn [ac x]
> (if (keyword? x)
>   [(conj (first ac) x) (conj (second ac) [])]
>   (update-in ac [1 (dec (count (first ac)))] conj x))) [[] []]
>   coll)))
>
> Added complexity: My original vector does not yet contain keywords, but I 
> construct them in a map regexp-matching each item and creating a keyword from 
> the first group of the match.
>
> Any pointers or ideas appreciated.
>
> 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.
>
>
>



-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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.




does lein2 use repositories defined in ~/.m2/settings.xml?

2013-02-20 Thread James Xu
I have a lein project, if using lein2(lein2 deps), it gives me the 
following errors:

james:alitoolkit(git:master)$ lein deps
Could not find metadata 
com.alibaba.platform.shared:dubbo.rpc/maven-metadata.xml in local 
(/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.remoting/maven-metadata.xml in local 
(/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo/maven-metadata.xml in local 
(/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.core.api/maven-metadata.xml in local 
(/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.core.common/maven-metadata.xml in local 
(/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.core.registry.default/maven-metadata.xml 
in local (/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.core.rpc/maven-metadata.xml in local 
(/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.core.rpc.dbo/maven-metadata.xml in local 
(/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.core.rpc.http/maven-metadata.xml in local 
(/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.core.service/maven-metadata.xml in local 
(/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.core.service.server/maven-metadata.xml in 
local (/home/james/.m2/repository)
Could not find metadata 
com.alibaba.platform.shared:dubbo.registry.client/maven-metadata.xml in 
local (/home/james/.m2/repository)
This could be due to a typo in :dependencies or network issues.
Could not resolve dependencies

but If I use lein1, it can resolve all the dependencies successfuly, 
com.alibaba.platform.shared:dubbo.* can only be found in the repositories 
specified in ~/.m2/settings.xml, so it seems that lein2 does not use 
~/.m2/settings.xml?

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: does lein2 use repositories defined in ~/.m2/settings.xml?

2013-02-20 Thread James Xu
Thanks! But it sounds odd to me that lein does not use ~/.m2/settings.xml,
why this decision?

From:  Michael Klishin 
Reply-To:  
Date:  Thu, 21 Feb 2013 11:45:51 +0400
To:  
Subject:  Re: does lein2 use repositories defined in ~/.m2/settings.xml?

2013/2/21 James Xu 
> so it seems that lein2 does not use ~/.m2/settings.xml

Correct. Specify them in project.clj.
-- 
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.
 
 


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