Re: [ANN] stories - bdd lib for clojure

2013-05-03 Thread Steven Degutis
The repo has moved. There are two locations (so far):

https://github.com/otfrom/stories
https://github.com/meteorfox/stories

On Thu, May 2, 2013 at 5:50 PM, Steven Degutis sbdegu...@gmail.com wrote:
 Here, it's back up for a while: https://github.com/sdegutis/stories

 Please fork it.

 -Steven

 On Thu, May 2, 2013 at 5:36 PM, Paulo Suzart paulosuz...@gmail.com wrote:
 Wow.

 Got surprised with 404! Sad.


 On Thursday, May 2, 2013 6:58:57 PM UTC-3, Steven Degutis wrote:

 Yeah I deleted it. Realized it's not worth anyone's time.

 On Thu, May 2, 2013 at 4:44 PM, Jeroen van Dijk
 jeroentj...@gmail.com wrote:
  Sounds interesting. The repo seems to be unavailable on Github, is that
  correct?
 
  Jeroen
 
 
  On Sun, Apr 28, 2013 at 3:52 PM, Steven Degutis sbde...@gmail.com
  wrote:
 
  Great, thanks.
 
  Now it's at https://clojars.org/stories
 
  -Steven
 
 
  On Sun, Apr 28, 2013 at 1:25 AM, Michael Klishin
  michael@gmail.com wrote:
 
  2013/4/28 Steven Degutis sbde...@gmail.com
 
  I'd put it on Clojars but I can't really figure out how to deal with
  this gpg stuff. Seems way more complicated. Wish clojure had
  something
  easier, like homebrew and melpa. But whatever.
 
 
  GPG signint is currently optional.
 
  lein do pom, jar
  scp pom.xml target/[library]-[version].jar clo...@clojars.org:
 
 
  --
  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 clo...@googlegroups.com
  Note that posts from new members are moderated - please be patient
  with
  your first post.
  To unsubscribe from this group, send email to
  clojure+u...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
  Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+u...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clo...@googlegroups.com
  Note that posts from new members are moderated - please be patient with
  your first post.
  To unsubscribe from this group, send email to
  clojure+u...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
  Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+u...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clo...@googlegroups.com
  Note that posts from new members are moderated - please be patient with
  your
  first post.
  To unsubscribe from this group, send email to
  clojure+u...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to 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: More idiomatic way to use map like this?

2013-05-03 Thread Jim - FooBar();

On 02/05/13 22:21, Steven Degutis wrote:

Given pseudo-code (Ruby-ish):

due = 100
cards = cards.map do |card|
 card.applied_balance = max(0, due - card.balance)
 due -= card.applied_balance

Notice how due changes at each turn, and each successive item in
cards sees the change.

What's an idiomatic way to do this in Clojure without using refs?

-Steven



Not a Ruby expert here, but I think 'reduce' is your friend :)
loop/recur is also an option ...

the problem is not really how to loop, but how to replace all this 
mutation...I'm saying this because you specifically asked not to use any 
reference types.



Jim

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




[GSoC] Update: student proposal deadline; mentors, please sign up

2013-05-03 Thread Daniel Solano Gómez
Hello, all,

Here's a quick update on what's going on with Clojure's participation in
this year's Google Summer of Code.  We have already received a number of
strong proposals, and I can only hope we will be able to accept them
all.

What's going on?


The student application period closes today at 19:00 UTC.  Over the
weekend, I will request a number of student allocations based on the
applications we received.  On Wednesday evening, Google will let me know
how many students we will get.  If we want more students, there is an
opportunity to get on a waiting list for more allocations.

From now until 22 May, mentors will be able to volunteer to mentor
specific proposals and to review and rate student applications.  There
will be a short period where there will be deduplication checks (finding
out if a student has been accepted by more than one organisation).
Finally, on 27 May, Google will announce all students who have been
accepted.


Students


Today at 19:00 UTC the student application will close, and no new
applications will be accepted.  Remember to follow the application
guidelines we have set out [1].

[1]: http://dev.clojure.org/display/community/Student+application+guidelines


Mentors
---

Please sign up on Melange [2] to be a mentor for our organisation.
Additionally, if you are interested in mentoring a specific student's
proposal, please indicate that on the student's application.  You can do
this as follows:

1. Log in to Melange with your credentials.
2. Click on the 'My Dashboard' link on the left sidebar.
3. Click on the dashboard page, click on 'Proposals submitted to my
organizations'.
4. Click on the the proposal you are interested in.
5. On the left hand side, you will see a 'Wish to Mentor' toggle.  You
should set this to 'Yes'.

This is very important.  I need to know how many mentors are interested
in each proposal.  We have a lot of very good student proposals, but I
can only accept those for which we also have mentors.  So, please do
this as soon as possible.  Please do this even if you are only
interested in being a secondary mentor.

[2]: https://google-melange.appspot.com/gsoc/org/google/gsoc2013/clojure_dev


Thanks to everyone for your help with GSoC.  I think it's going to be a
great summer.

Sincerely,

Daniel


signature.asc
Description: Digital signature


Re: More idiomatic way to use map like this?

2013-05-03 Thread Jim - FooBar();

something like this perhaps?

(loop [[c  more]] cards
  res []
  due 100]
(if-not c  res
(recur more
(conj res (doto c (.setAppliedBalance  (max 0 (- due )
(- due (.getBalance c )

Jim

ps: haven't got a clue what objects you're working with  so I'm 
purposefully using setters which is close to what you showed in your 
Ruby example




On 03/05/13 14:28, Jim - FooBar(); wrote:

On 02/05/13 22:21, Steven Degutis wrote:

Given pseudo-code (Ruby-ish):

due = 100
cards = cards.map do |card|
 card.applied_balance = max(0, due - card.balance)
 due -= card.applied_balance

Notice how due changes at each turn, and each successive item in
cards sees the change.

What's an idiomatic way to do this in Clojure without using refs?

-Steven



Not a Ruby expert here, but I think 'reduce' is your friend :)
loop/recur is also an option ...

the problem is not really how to loop, but how to replace all this 
mutation...I'm saying this because you specifically asked not to use 
any reference types.



Jim


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

2013-05-03 Thread Jim - FooBar();

oops there is a typo!

line 6 should be:
(conj res (doto c (.setAppliedBalance  (max 0 (- due (.getBalance c))


On 03/05/13 15:22, Jim - FooBar(); wrote:

something like this perhaps?

(loop [[c  more]] cards
  res []
  due 100]
(if-not c  res
(recur more
(conj res (doto c (.setAppliedBalance  (max 0 (- due )
(- c .getBalance (- due )

Jim

ps: haven't got a clue what objects you're working with  so I'm 
purposefully using setters which is close to what you showed in your 
Ruby example




On 03/05/13 14:28, Jim - FooBar(); wrote:

On 02/05/13 22:21, Steven Degutis wrote:

Given pseudo-code (Ruby-ish):

due = 100
cards = cards.map do |card|
 card.applied_balance = max(0, due - card.balance)
 due -= card.applied_balance

Notice how due changes at each turn, and each successive item in
cards sees the change.

What's an idiomatic way to do this in Clojure without using refs?

-Steven



Not a Ruby expert here, but I think 'reduce' is your friend :)
loop/recur is also an option ...

the problem is not really how to loop, but how to replace all this 
mutation...I'm saying this because you specifically asked not to use 
any reference types.



Jim




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

2013-05-03 Thread Jim - FooBar();
I Just realised you've many responses and that you've already solved 
your problem...sorry for the noise people.


Jim


On 03/05/13 15:38, Jim - FooBar(); wrote:

oops there is a typo!

line 6 should be:
(conj res (doto c (.setAppliedBalance  (max 0 (- due (.getBalance c))


On 03/05/13 15:22, Jim - FooBar(); wrote:

something like this perhaps?

(loop [[c  more]] cards
  res []
  due 100]
(if-not c  res
(recur more
(conj res (doto c (.setAppliedBalance  (max 0 (- due )
(- c .getBalance (- due )

Jim

ps: haven't got a clue what objects you're working with  so I'm 
purposefully using setters which is close to what you showed in your 
Ruby example




On 03/05/13 14:28, Jim - FooBar(); wrote:

On 02/05/13 22:21, Steven Degutis wrote:

Given pseudo-code (Ruby-ish):

due = 100
cards = cards.map do |card|
 card.applied_balance = max(0, due - card.balance)
 due -= card.applied_balance

Notice how due changes at each turn, and each successive item in
cards sees the change.

What's an idiomatic way to do this in Clojure without using refs?

-Steven



Not a Ruby expert here, but I think 'reduce' is your friend :)
loop/recur is also an option ...

the problem is not really how to loop, but how to replace all this 
mutation...I'm saying this because you specifically asked not to use 
any reference types.



Jim






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

2013-05-03 Thread Feng Shen
Hi,  

just released 2.1.0.

[http-kit 2.1.0] ; Add to your project.clj.


Compare to 2.0.0, noticeable changes: 

   1. Much faster: about 30%~80% faster. 
   2. The client support HTTPS now
   3. :as option to do client output coercion

Not that noticeable changes:

   1. few minor bugs fixes
   2. less RAM usage

The full update log: 
https://github.com/http-kit/http-kit/blob/master/history.md

Updated client documentation: http://http-kit.org/client.html


On Friday, March 29, 2013 2:03:38 PM UTC+8, Feng Shen wrote:

 Hello folks. 

 I just released version 2.0.0 of http-kit. 


 *2.0.0 (2013/3/29)*

1. Unify WebSocket and HTTP long polling/streaming with Channel 
protocol and with-channel (API breaks with the RC)
2. WebSocket support sending and receiving binary frame with byte[] 
3. Support HTTP streaming
4. WebSocket message ordering is guaranteed by server


 Updated documentation: http://http-kit.org/server.html

 Let's build amazing realtime applications with Clojure, using http-kit.

 The with-channel API is not compatible with the RC releases. The new is 
 better and much easier to understand and use. The old's documentation can 
 be found here http://http-kit.org/server_old.html

 - feng


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: [GSoC] Update: student proposal deadline; mentors, please sign up

2013-05-03 Thread Paul deGrandis
I'm a little behind the ball on my GSoC effort, but if you approve my 
mentor request, I'll happily go through the projects.

Once I was interested in mentoring, I had to Start a connection with the 
Clojure organization.

Regards
Paul // ohpauleez


On Friday, May 3, 2013 7:20:47 AM UTC-7, Daniel Solano Gómez wrote:

 Hello, all, 

 Here's a quick update on what's going on with Clojure's participation in 
 this year's Google Summer of Code.  We have already received a number of 
 strong proposals, and I can only hope we will be able to accept them 
 all. 

 What's going on? 
  

 The student application period closes today at 19:00 UTC.  Over the 
 weekend, I will request a number of student allocations based on the 
 applications we received.  On Wednesday evening, Google will let me know 
 how many students we will get.  If we want more students, there is an 
 opportunity to get on a waiting list for more allocations. 

 From now until 22 May, mentors will be able to volunteer to mentor 
 specific proposals and to review and rate student applications.  There 
 will be a short period where there will be deduplication checks (finding 
 out if a student has been accepted by more than one organisation). 
 Finally, on 27 May, Google will announce all students who have been 
 accepted. 


 Students 
  

 Today at 19:00 UTC the student application will close, and no new 
 applications will be accepted.  Remember to follow the application 
 guidelines we have set out [1]. 

 [1]: 
 http://dev.clojure.org/display/community/Student+application+guidelines 


 Mentors 
 --- 

 Please sign up on Melange [2] to be a mentor for our organisation. 
 Additionally, if you are interested in mentoring a specific student's 
 proposal, please indicate that on the student's application.  You can do 
 this as follows: 

 1. Log in to Melange with your credentials. 
 2. Click on the 'My Dashboard' link on the left sidebar. 
 3. Click on the dashboard page, click on 'Proposals submitted to my 
 organizations'. 
 4. Click on the the proposal you are interested in. 
 5. On the left hand side, you will see a 'Wish to Mentor' toggle.  You 
 should set this to 'Yes'. 

 This is very important.  I need to know how many mentors are interested 
 in each proposal.  We have a lot of very good student proposals, but I 
 can only accept those for which we also have mentors.  So, please do 
 this as soon as possible.  Please do this even if you are only 
 interested in being a secondary mentor. 

 [2]: 
 https://google-melange.appspot.com/gsoc/org/google/gsoc2013/clojure_dev 


 Thanks to everyone for your help with GSoC.  I think it's going to be a 
 great summer. 

 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.




Re: Clojurians in Austria

2013-05-03 Thread Carlos Fontes
Hi!

Such a beautiful and romantic city, Vienna is. This clojure developer must 
be really lucky.

On Thursday, May 2, 2013 10:42:55 AM UTC+1, Haymo Meran wrote:

 Hey Jozef and others,

 I am looking for a clojure developer for a project or even employment. The 
 company is a well funded startup located in the center of vienna and we 
 have built a collaborative editing web app (similar to google docs - but 
 for plain html) fully based on clojure.

 Anyone interessted, please contact me. 

 haymo dot meran at girigiri.io

 Thanks.

 Cheers
 Haymo

 On Tuesday, May 29, 2012 4:27:18 PM UTC+2, Jozef Wagner wrote:

 Hi,

 Are there some Clojurians from Austria or is there an Austria Clojure 
 group? 

 I'm looking for a Clojure related job in Austria, and so far I haven't 
 found any Austrian group on meetup.com nor on the google groups :(

 Best,
 Jozef



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

2013-05-03 Thread Robert Louis McIntyre
I've written some JME3 wrapper code for my thesis project -- it's not
ready for prime time, but it's got some nice ideas.

The design goal is to try and make my thesis code concise instead of
being a general purpose library, but one idea I like it to build a
world out of clojure functions that do the updating, etc.

relevant pages for this project (with code) include: 

http://aurellem.org/cortex/html/world.html
http://aurellem.org/cortex/html/util.html

and some more at http://aurellem.org

This is for a slightly older version of JME3, but things should mostly
still work for the latest version.

sincerely,
--Robert McIntyre

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

2013-05-03 Thread Alan Thompson
Hey Armando - How did you get the nice syntax highlighting into your
post??? Enquiring minds wanna know.
Alan

On Fri, May 3, 2013 at 7:41 AM, Jim - FooBar(); jimpil1...@gmail.com wrote:
 I Just realised you've many responses and that you've already solved your
 problem...sorry for the noise people.

 Jim



 On 03/05/13 15:38, Jim - FooBar(); wrote:

 oops there is a typo!

 line 6 should be:
 (conj res (doto c (.setAppliedBalance  (max 0 (- due (.getBalance c))


 On 03/05/13 15:22, Jim - FooBar(); wrote:

 something like this perhaps?

 (loop [[c  more]] cards
   res []
   due 100]
 (if-not c  res
 (recur more
 (conj res (doto c (.setAppliedBalance  (max 0 (- due )
 (- c .getBalance (- due )

 Jim

 ps: haven't got a clue what objects you're working with  so I'm
 purposefully using setters which is close to what you showed in your Ruby
 example



 On 03/05/13 14:28, Jim - FooBar(); wrote:

 On 02/05/13 22:21, Steven Degutis wrote:

 Given pseudo-code (Ruby-ish):

 due = 100
 cards = cards.map do |card|
  card.applied_balance = max(0, due - card.balance)
  due -= card.applied_balance

 Notice how due changes at each turn, and each successive item in
 cards sees the change.

 What's an idiomatic way to do this in Clojure without using refs?

 -Steven


 Not a Ruby expert here, but I think 'reduce' is your friend :)
 loop/recur is also an option ...

 the problem is not really how to loop, but how to replace all this
 mutation...I'm saying this because you specifically asked not to use any
 reference types.


 Jim




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




Question about destructuring with :keys :or and :as

2013-05-03 Thread Ryan
Hello all,

I have a question regarding the default values when destructuring with :keys

Let's assume that we have the following function:

*(defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
   (str my-key value is  (:my-key params)))*


A few test runs:
 

 *user= (my-function {:my-key 1})
 my-key value is 1*


Works as expected.

*user= (my-function {:another-key hello})
 **my-key value is *


As you can see here, *my-key* value is nil even thought I have a default 
value of 5. 
From the above observation, it seems that *:as* will not fill in the 
missing keys with the default values if those are provided as in my case.

Does anyone have a solution for this? 

Thank you for your time

Ryan

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

2013-05-03 Thread Anthony Rosequist
The value of :my-key (or the default, if :my-key doesn't exist) is being 
bound to the symbol my-key, so all you need to do is this:

(defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
 *  (str my-key value is  my-key))*


On Friday, May 3, 2013 1:52:46 PM UTC-5, Ryan wrote:

 Hello all,

 I have a question regarding the default values when destructuring with 
 :keys

 Let's assume that we have the following function:

 *(defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
   (str my-key value is  (:my-key params)))*


 A few test runs:
  

 *user= (my-function {:my-key 1})
 my-key value is 1*


 Works as expected.

 *user= (my-function {:another-key hello})
 **my-key value is *


 As you can see here, *my-key* value is nil even thought I have a default 
 value of 5. 
 From the above observation, it seems that *:as* will not fill in the 
 missing keys with the default values if those are provided as in my case.

 Does anyone have a solution for this? 

 Thank you for your time

 Ryan


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

2013-05-03 Thread Ryan
Thanks Anthony for your reply but I was already aware of that. I was hoping 
for some solution which would took care of the binding if *:as* was 
provided and would append the key-value to the *:as* parameter.

I probably need to do that myselfbut you never know, someone else might 
have done it and has an elegant proposal :)

Ryan

On Friday, May 3, 2013 10:04:41 PM UTC+3, Anthony Rosequist wrote:

 The value of :my-key (or the default, if :my-key doesn't exist) is being 
 bound to the symbol my-key, so all you need to do is this:

 (defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
 *  (str my-key value is  my-key))*


 On Friday, May 3, 2013 1:52:46 PM UTC-5, Ryan wrote:

 Hello all,

 I have a question regarding the default values when destructuring with 
 :keys

 Let's assume that we have the following function:

 *(defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
   (str my-key value is  (:my-key params)))*


 A few test runs:
  

 *user= (my-function {:my-key 1})
 my-key value is 1*


 Works as expected.

 *user= (my-function {:another-key hello})
 **my-key value is *


 As you can see here, *my-key* value is nil even thought I have a default 
 value of 5. 
 From the above observation, it seems that *:as* will not fill in the 
 missing keys with the default values if those are provided as in my case.

 Does anyone have a solution for this? 

 Thank you for your time

 Ryan



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




[OT] Re: More idiomatic way to use map like this?

2013-05-03 Thread Cedric Greevey
On Fri, May 3, 2013 at 2:32 PM, Alan Thompson thompson2...@gmail.comwrote:

 Hey Armando - How did you get the nice syntax highlighting into your
 post??? Enquiring minds wanna know.
 Alan


If the OP's problem is solved anyway, I suppose we can go OT a bit with
this thread now.

AFAIK, it's done by sending the list an HTML email. I'm not sure what tools
are used to generate the formatting, though, or of the netiquette of
posting in HTML. Those posts render well in the Groups interface and in
gmail, but for anyone using other mail clients to use the list, their
mileage will vary. It probably looks like a horrendous mess to anyone using
mutt, elm, or XFMail, for example. Are the majority of readers here using
gmail or Groups, then?

(On a related note, there are a lot of top-posted replies and I'm probably
guilty of a few of them myself. The gmail web interface makes it
significantly more effort to bottom-post, whereas Google Groups makes it
more effort to top-post, last time I checked out its interface. I haven't
seen complaints here about either type of post, though, or about HTML mail
to the list, so it seems as if all three are generally accepted here.)

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

2013-05-03 Thread Sean Corfield
The :as key binds the entire _original_ map.

The :or defaults apply only to the bound variables extracted from the map.

It caught me out when I first used map destructuring but I soon got used to it.


On Fri, May 3, 2013 at 12:08 PM, Ryan arekand...@gmail.com wrote:
 Thanks Anthony for your reply but I was already aware of that. I was hoping
 for some solution which would took care of the binding if :as was provided
 and would append the key-value to the :as parameter.

 I probably need to do that myselfbut you never know, someone else might
 have done it and has an elegant proposal :)

 Ryan


 On Friday, May 3, 2013 10:04:41 PM UTC+3, Anthony Rosequist wrote:

 The value of :my-key (or the default, if :my-key doesn't exist) is being
 bound to the symbol my-key, so all you need to do is this:

 (defn my-function [{:keys [my-key] :or {my-key 5} :as params}]
   (str my-key value is  my-key))


 On Friday, May 3, 2013 1:52:46 PM UTC-5, Ryan wrote:

 Hello all,

 I have a question regarding the default values when destructuring with
 :keys

 Let's assume that we have the following function:

 (defn my-function [{:keys [my-key] :or {my-key 5} :as params}]
   (str my-key value is  (:my-key params)))


 A few test runs:


 user= (my-function {:my-key 1})
 my-key value is 1


 Works as expected.

 user= (my-function {:another-key hello})
 my-key value is 


 As you can see here, my-key value is nil even thought I have a default
 value of 5.
 From the above observation, it seems that :as will not fill in the
 missing keys with the default values if those are provided as in my case.

 Does anyone have a solution for this?

 Thank you for your time

 Ryan

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





-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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




Re: Question about destructuring with :keys :or and :as

2013-05-03 Thread Ryan
Well, I need to do something more clever because I am passing the whole 
map to another function which does validation on the key-value pairs.
Soi guess I need to append those default associations to the original 
map myself...

Something like...

*(defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
 **  (let [params (if (nil? (:my-key params)) (assoc params :my-key 
 my-key) params)
 **(str my-key value is  (:my-key params)))*

*
*
*...but it's too damn ugly, need to think about it a bit more.*

On Friday, May 3, 2013 10:22:59 PM UTC+3, Sean Corfield wrote:

 The :as key binds the entire _original_ map. 

 The :or defaults apply only to the bound variables extracted from the map. 

 It caught me out when I first used map destructuring but I soon got used 
 to it. 


 On Fri, May 3, 2013 at 12:08 PM, Ryan areka...@gmail.com javascript: 
 wrote: 
  Thanks Anthony for your reply but I was already aware of that. I was 
 hoping 
  for some solution which would took care of the binding if :as was 
 provided 
  and would append the key-value to the :as parameter. 
  
  I probably need to do that myselfbut you never know, someone else 
 might 
  have done it and has an elegant proposal :) 
  
  Ryan 
  
  
  On Friday, May 3, 2013 10:04:41 PM UTC+3, Anthony Rosequist wrote: 
  
  The value of :my-key (or the default, if :my-key doesn't exist) is 
 being 
  bound to the symbol my-key, so all you need to do is this: 
  
  (defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
(str my-key value is  my-key)) 
  
  
  On Friday, May 3, 2013 1:52:46 PM UTC-5, Ryan wrote: 
  
  Hello all, 
  
  I have a question regarding the default values when destructuring with 
  :keys 
  
  Let's assume that we have the following function: 
  
  (defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
(str my-key value is  (:my-key params))) 
  
  
  A few test runs: 
  
  
  user= (my-function {:my-key 1}) 
  my-key value is 1 
  
  
  Works as expected. 
  
  user= (my-function {:another-key hello}) 
  my-key value is  
  
  
  As you can see here, my-key value is nil even thought I have a default 
  value of 5. 
  From the above observation, it seems that :as will not fill in the 
  missing keys with the default values if those are provided as in my 
 case. 
  
  Does anyone have a solution for this? 
  
  Thank you for your time 
  
  Ryan 
  
  -- 
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  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 javascript: 
  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 javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  



 -- 
 Sean A Corfield -- (904) 302-SEAN 
 An Architect's View -- http://corfield.org/ 
 World Singles, LLC. -- http://worldsingles.com/ 

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


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




Re: Iota, reducers, word counting

2013-05-03 Thread Catonano
Well I reply to myself:

with pmap there´s no need to explicitly calculate the batches

The final version of the code is:

(defn parallel-count [iota-file]
  (reduce (partial merge-with +)
  (pmap (fn [a-subcollection]
  (frequencies (words a-subcollection)))
iota-file)))

which is not that dramatically far from the the vanilla version.

Right ?






2013/5/1 Catonano caton...@gmail.com

 Meikel,

 thank you for your reply


 2013/4/30 Meikel Brandmeyer (kotarak) m...@kotka.de

 Hello,

 your function does not follow the contract of fold. What you provided is
 basically the reduce function, but it doesn't work together with fold. For
 fold you need to merge the different maps you created in the subtasks. So
 the combine function must look different.


 Admittedly I had missed the fact that fold expects a reducing function AND
 a combining function.

 But the worst thing is that I modified my-frequencies so that it could be
 called with no arguments, but who was going to call i like that ? Not my
 code and not anyone else !!

 What was I thinking ?

 I´m sorry for the silly question, I was just confused.

 Thanks for your help

 Additionally you cannot use transients at the moment with fold.


 That´s a pity. I suppose I could explicitly split the input vector in
 parts and then call pvalues with a function implementing my word counting
 on each subpart. And then merging the results from each subpart

 But the reducers idiom is more beautiful because the modifications to the
 traditional map reduce version would be smaller, with that you haven´t got
 to explicitly split the input and call a specielized version of map.

 Oh well...

 It was just an exercise after all...

 Thanks again Meikel !


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




Re: http-kit 2.0.0 released

2013-05-03 Thread Shantanu Kumar
Congratulations on the release! Could you please let me know whether
HTTP-Kit has built-in support for applying backpressure, and if it
does then how to configure the same?

Shantanu

On May 3, 9:05 pm, Feng Shen shen...@gmail.com wrote:
 Hi,

 just released 2.1.0.

 [http-kit 2.1.0] ; Add to your project.clj.

 Compare to 2.0.0, noticeable changes:

    1. Much faster: about 30%~80% faster.
    2. The client support HTTPS now
    3. :as option to do client output coercion

 Not that noticeable changes:

    1. few minor bugs fixes
    2. less RAM usage

 The full update 
 log:https://github.com/http-kit/http-kit/blob/master/history.md

 Updated client documentation:http://http-kit.org/client.html







 On Friday, March 29, 2013 2:03:38 PM UTC+8, Feng Shen wrote:

  Hello folks.

  I just released version 2.0.0 of http-kit.

  *2.0.0 (2013/3/29)*

     1. Unify WebSocket and HTTP long polling/streaming with Channel
     protocol and with-channel (API breaks with the RC)
     2. WebSocket support sending and receiving binary frame with byte[]
     3. Support HTTP streaming
     4. WebSocket message ordering is guaranteed by server

  Updated documentation:http://http-kit.org/server.html

  Let's build amazing realtime applications with Clojure, using http-kit.

  The with-channel API is not compatible with the RC releases. The new is
  better and much easier to understand and use. The old's documentation can
  be found here http://http-kit.org/server_old.html

  - feng

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: [OT] Re: More idiomatic way to use map like this?

2013-05-03 Thread Robert Pitts
Armando was a good citizen and sent along a plain-text version as well 
– 
https://groups.google.com/group/clojure/msg/6aae8287bc55d436?dmode=sourceoutput=gplainnoredirect

Would still be nifty to know if there's an easy way to do this, Armando :)

On Friday, May 3, 2013 3:19:48 PM UTC-4, Cedric Greevey wrote:

 On Fri, May 3, 2013 at 2:32 PM, Alan Thompson 
 thomps...@gmail.comjavascript:
  wrote:

 Hey Armando - How did you get the nice syntax highlighting into your
 post??? Enquiring minds wanna know.
 Alan


 If the OP's problem is solved anyway, I suppose we can go OT a bit with 
 this thread now.

 AFAIK, it's done by sending the list an HTML email. I'm not sure what 
 tools are used to generate the formatting, though, or of the netiquette of 
 posting in HTML. Those posts render well in the Groups interface and in 
 gmail, but for anyone using other mail clients to use the list, their 
 mileage will vary. It probably looks like a horrendous mess to anyone using 
 mutt, elm, or XFMail, for example. Are the majority of readers here using 
 gmail or Groups, then?

 (On a related note, there are a lot of top-posted replies and I'm probably 
 guilty of a few of them myself. The gmail web interface makes it 
 significantly more effort to bottom-post, whereas Google Groups makes it 
 more effort to top-post, last time I checked out its interface. I haven't 
 seen complaints here about either type of post, though, or about HTML mail 
 to the list, so it seems as if all three are generally accepted here.)



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

2013-05-03 Thread Michael Klishin
2013/5/3 Feng Shen shen...@gmail.com

 Compare to 2.0.0, noticeable changes:

1. Much faster: about 30%~80% faster.
2. The client support HTTPS now
3. :as option to do client output coercion

 Not that noticeable changes:

1. few minor bugs fixes
2. less RAM usage

 The full update log:
 https://github.com/http-kit/http-kit/blob/master/history.md


I'd highly recommend starting a new thread for each new version.
Also, your change log is in chronological order. Keeping it in
reverse chronological order (2.1.0 first) would make it much easier
to quickly discover recent changes.

Good job on the performance improvements!
-- 
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.




[ANN] Pedestal 0.1.6 released

2013-05-03 Thread Ryan Neufeld
Hey Folks,

We've just released the 0.1.6 versions of the Pedestal libraries.

This release brings the ability to match port numbers in service routes as 
well as further compatibility for JBoss.

You'll find the full changelog for this and other changes 
here: http://git.io/dHCnJQ.

- Ryan and the rest of the Pedestal team

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

2013-05-03 Thread Stanislas Nanchen
What about merging with a default map?

(defn my-function [params] 
  (let [params (merge {:my-key 5} params)]
(str my-key value is  (:my-key params


Well, I need to do something more clever because I am passing the whole 
 map to another function which does validation on the key-value pairs.
 Soi guess I need to append those default associations to the original 
 map myself...

 Something like...

 *(defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
 **  (let [params (if (nil? (:my-key params)) (assoc params :my-key 
 my-key) params)
 **(str my-key value is  (:my-key params)))*

 *
 *
 *...but it's too damn ugly, need to think about it a bit more.*

 On Friday, May 3, 2013 10:22:59 PM UTC+3, Sean Corfield wrote:

 The :as key binds the entire _original_ map. 

 The :or defaults apply only to the bound variables extracted from the 
 map. 

 It caught me out when I first used map destructuring but I soon got used 
 to it. 


 On Fri, May 3, 2013 at 12:08 PM, Ryan areka...@gmail.com wrote: 
  Thanks Anthony for your reply but I was already aware of that. I was 
 hoping 
  for some solution which would took care of the binding if :as was 
 provided 
  and would append the key-value to the :as parameter. 
  
  I probably need to do that myselfbut you never know, someone else 
 might 
  have done it and has an elegant proposal :) 
  
  Ryan 
  
  
  On Friday, May 3, 2013 10:04:41 PM UTC+3, Anthony Rosequist wrote: 
  
  The value of :my-key (or the default, if :my-key doesn't exist) is 
 being 
  bound to the symbol my-key, so all you need to do is this: 
  
  (defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
(str my-key value is  my-key)) 
  
  
  On Friday, May 3, 2013 1:52:46 PM UTC-5, Ryan wrote: 
  
  Hello all, 
  
  I have a question regarding the default values when destructuring 
 with 
  :keys 
  
  Let's assume that we have the following function: 
  
  (defn my-function [{:keys [my-key] :or {my-key 5} :as params}] 
(str my-key value is  (:my-key params))) 
  
  
  A few test runs: 
  
  
  user= (my-function {:my-key 1}) 
  my-key value is 1 
  
  
  Works as expected. 
  
  user= (my-function {:another-key hello}) 
  my-key value is  
  
  
  As you can see here, my-key value is nil even thought I have a 
 default 
  value of 5. 
  From the above observation, it seems that :as will not fill in the 
  missing keys with the default values if those are provided as in my 
 case. 
  
  Does anyone have a solution for this? 
  
  Thank you for your time 
  
  Ryan 
  
  -- 
  -- 
  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. 
  
  



 -- 
 Sean A Corfield -- (904) 302-SEAN 
 An Architect's View -- http://corfield.org/ 
 World Singles, LLC. -- http://worldsingles.com/ 

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



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




Re: More idiomatic way to use map like this?

2013-05-03 Thread Armando Blancas
Having failed many attempts, I asked Feng Shen and he kindly told me how: 
copy some formatted text off a browser and simply paste it on this editor 
box. So I made a gist and instead of putting this link 
https://gist.github.com/blancas/5507033 I just pasted the text.

On Friday, May 3, 2013 11:32:55 AM UTC-7, Alan Thompson wrote:

 Hey Armando - How did you get the nice syntax highlighting into your 
 post??? Enquiring minds wanna know. 
 Alan 

 On Fri, May 3, 2013 at 7:41 AM, Jim - FooBar(); 
 jimpi...@gmail.comjavascript: 
 wrote: 
  I Just realised you've many responses and that you've already solved 
 your 
  problem...sorry for the noise people. 
  
  Jim 
  
  
  
  On 03/05/13 15:38, Jim - FooBar(); wrote: 
  
  oops there is a typo! 
  
  line 6 should be: 
  (conj res (doto c (.setAppliedBalance  (max 0 (- due (.getBalance 
 c)) 
  
  
  On 03/05/13 15:22, Jim - FooBar(); wrote: 
  
  something like this perhaps? 
  
  (loop [[c  more]] cards 
res [] 
due 100] 
  (if-not c  res 
  (recur more 
  (conj res (doto c (.setAppliedBalance  (max 0 (- due ) 
  (- c .getBalance (- due ) 
  
  Jim 
  
  ps: haven't got a clue what objects you're working with  so I'm 
  purposefully using setters which is close to what you showed in your 
 Ruby 
  example 
  
  
  
  On 03/05/13 14:28, Jim - FooBar(); wrote: 
  
  On 02/05/13 22:21, Steven Degutis wrote: 
  
  Given pseudo-code (Ruby-ish): 
  
  due = 100 
  cards = cards.map do |card| 
   card.applied_balance = max(0, due - card.balance) 
   due -= card.applied_balance 
  
  Notice how due changes at each turn, and each successive item in 
  cards sees the change. 
  
  What's an idiomatic way to do this in Clojure without using refs? 
  
  -Steven 
  
  
  Not a Ruby expert here, but I think 'reduce' is your friend :) 
  loop/recur is also an option ... 
  
  the problem is not really how to loop, but how to replace all this 
  mutation...I'm saying this because you specifically asked not to use 
 any 
  reference types. 
  
  
  Jim 
  
  
  
  
  -- 
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  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 javascript: 
  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 javascript:. 
  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: [OT] Re: More idiomatic way to use map like this?

2013-05-03 Thread Armando Blancas
On Friday, May 3, 2013 1:15:24 PM UTC-7, Robert Pitts wrote:

 Armando was a good citizen and sent along a plain-text version as well – 
 https://groups.google.com/group/clojure/msg/6aae8287bc55d436?dmode=sourceoutput=gplainnoredirect


That must have been Google Groups doing the right thing... nice feature.

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

2013-05-03 Thread Ryan
Ah, the default nap is a nice idea :)

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




ANN: ClojureScript release 0.0-1798

2013-05-03 Thread David Nolen
artifact:
http://search.maven.org/#artifactdetails%7Corg.clojure%7Cclojurescript%7C0.0-1798%7Cjar

Git log: https://github.com/clojure/clojurescript/compare/r1586...r1798

Enhancements


* Code size improvements, (.log js/console Hello world!) now
  generates ~100 LOC of pretty printed advanced compiled JavaScript
* Source map merging, can produce composition source map, source map
* Optimize PersistentArrayMaps

Changes
---

* Symbols are no longer JavaScript strings, support metadata

Fixes
-

* CLJS-367: chunked seq support in for and doseq, comprehension benchmarks
* CLJS-496: better implementation of `char`
* CLJS-495: add exists? macro
* CLJS-493: get should accept any type
* CLJS-492: avoid producing unnecessary calls to next in emit-apply-to
* CLJS-491: avoid layered subvecs
* CLJS-488: resolve aliased keywords properly
* CLJS-438: import new threading macros from 1.5
* CLJS-482: bind *out* as the target of Rhino REPL env printing
* CLJS-484: Throw exception instead of trying to throw string in defmulti
compiler macro
* CLJS-468: Implement IKVReduce for nil, Test reduce-kv and fold with nil
* CLJS-477: Vararg fns break when first vararg is undefined.
* CLJS-473: cljs.closure/add-dep-string calls wrong munge

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




[ANN] rhizome - simple graph and tree visualizations

2013-05-03 Thread Zach Tellman
I've had Graphviz integration in Lamina for a while [1], and have generally 
found it to be fun and useful.  To let everyone join in the fun, I've 
extracted that functionality into its own library, Rhizome [2].  Feedback 
is welcome.

Zach

[1] https://github.com/ztellman/lamina/wiki/Channels
[2] https://github.com/ztellman/rhizome

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

2013-05-03 Thread László Török
Hi,

regarding the perf. improvements, is it client or server?

Thx

Las


2013/5/3 Michael Klishin michael.s.klis...@gmail.com


 2013/5/3 Feng Shen shen...@gmail.com

 Compare to 2.0.0, noticeable changes:

1. Much faster: about 30%~80% faster.
2. The client support HTTPS now
3. :as option to do client output coercion

 Not that noticeable changes:

1. few minor bugs fixes
2. less RAM usage

 The full update log:
 https://github.com/http-kit/http-kit/blob/master/history.md


 I'd highly recommend starting a new thread for each new version.
 Also, your change log is in chronological order. Keeping it in
 reverse chronological order (2.1.0 first) would make it much easier
 to quickly discover recent changes.

 Good job on the performance improvements!
 --
 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.






-- 
László Török

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

2013-05-03 Thread David Nolen
Forgot to add CLJS now depends on Clojure 1.5.1 and data.json 0.2.2.

On Friday, May 3, 2013, David Nolen wrote:

 artifact:
 http://search.maven.org/#artifactdetails%7Corg.clojure%7Cclojurescript%7C0.0-1798%7Cjar

 Git log: https://github.com/clojure/clojurescript/compare/r1586...r1798

 Enhancements
 

 * Code size improvements, (.log js/console Hello world!) now
   generates ~100 LOC of pretty printed advanced compiled JavaScript
 * Source map merging, can produce composition source map, source map
 * Optimize PersistentArrayMaps

 Changes
 ---

 * Symbols are no longer JavaScript strings, support metadata

 Fixes
 -

 * CLJS-367: chunked seq support in for and doseq, comprehension benchmarks
 * CLJS-496: better implementation of `char`
 * CLJS-495: add exists? macro
 * CLJS-493: get should accept any type
 * CLJS-492: avoid producing unnecessary calls to next in emit-apply-to
 * CLJS-491: avoid layered subvecs
 * CLJS-488: resolve aliased keywords properly
 * CLJS-438: import new threading macros from 1.5
 * CLJS-482: bind *out* as the target of Rhino REPL env printing
 * CLJS-484: Throw exception instead of trying to throw string in defmulti
 compiler macro
 * CLJS-468: Implement IKVReduce for nil, Test reduce-kv and fold with nil
 * CLJS-477: Vararg fns break when first vararg is undefined.
 * CLJS-473: cljs.closure/add-dep-string calls wrong munge


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

2013-05-03 Thread Sean Corfield
Just merge the new, known values back in since they've already been
bound to their (possibly defaulted) values:

(let [params (assoc params :my-key my-key)] ...)

Sean

On Fri, May 3, 2013 at 12:38 PM, Ryan arekand...@gmail.com wrote:
 Well, I need to do something more clever because I am passing the whole
 map to another function which does validation on the key-value pairs.
 Soi guess I need to append those default associations to the original
 map myself...

 Something like...

 (defn my-function [{:keys [my-key] :or {my-key 5} :as params}]
   (let [params (if (nil? (:my-key params)) (assoc params :my-key my-key)
 params)
 (str my-key value is  (:my-key params)))


 ...but it's too damn ugly, need to think about it a bit more.

 On Friday, May 3, 2013 10:22:59 PM UTC+3, Sean Corfield wrote:

 The :as key binds the entire _original_ map.

 The :or defaults apply only to the bound variables extracted from the map.

 It caught me out when I first used map destructuring but I soon got used
 to it.


 On Fri, May 3, 2013 at 12:08 PM, Ryan areka...@gmail.com wrote:
  Thanks Anthony for your reply but I was already aware of that. I was
  hoping
  for some solution which would took care of the binding if :as was
  provided
  and would append the key-value to the :as parameter.
 
  I probably need to do that myselfbut you never know, someone else
  might
  have done it and has an elegant proposal :)
 
  Ryan
 
 
  On Friday, May 3, 2013 10:04:41 PM UTC+3, Anthony Rosequist wrote:
 
  The value of :my-key (or the default, if :my-key doesn't exist) is
  being
  bound to the symbol my-key, so all you need to do is this:
 
  (defn my-function [{:keys [my-key] :or {my-key 5} :as params}]
(str my-key value is  my-key))
 
 
  On Friday, May 3, 2013 1:52:46 PM UTC-5, Ryan wrote:
 
  Hello all,
 
  I have a question regarding the default values when destructuring with
  :keys
 
  Let's assume that we have the following function:
 
  (defn my-function [{:keys [my-key] :or {my-key 5} :as params}]
(str my-key value is  (:my-key params)))
 
 
  A few test runs:
 
 
  user= (my-function {:my-key 1})
  my-key value is 1
 
 
  Works as expected.
 
  user= (my-function {:another-key hello})
  my-key value is 
 
 
  As you can see here, my-key value is nil even thought I have a default
  value of 5.
  From the above observation, it seems that :as will not fill in the
  missing keys with the default values if those are provided as in my
  case.
 
  Does anyone have a solution for this?
 
  Thank you for your time
 
  Ryan
 
  --
  --
  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.
 
 



 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/

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

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





-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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

[ANN] java.jdbc 0.3.0-alpha2

2013-05-03 Thread Sean Corfield
Another step toward the 0.3.0 release for Clojure's JDBC wrapper. A
very minor update, mostly bug fixes and consistency issues. Based on
feedback from some users, the new boolean transaction? argument in
some of the new API functions will probably change in alpha3 although
that's not fully decided yet. Watch this space.

Release 0.3.0-alpha2 on 2013-05-03

Address JDBC-51 by declaring get-connection returns java.sql.Connection
Add IResultSetReadColumn protocol extension point for custom read
conversions JDBC-46
Add :multi? to execute! so it can be used for repeated operations JDBC-52
Reverted specialized handling of NULL values (reopens JDBC-40)
Rename :as-arrays to :as-arrays? since it is boolean
Add curried version of clojure.java.jdbc.sql/as-quoted-str
Officially deprecate resultset-seq

For more details about past releases: https://github.com/clojure/java.jdbc
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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




Re: ANN: vim-redl -- advanced fuzzy omnicompletion and VimClojure-style repl with enhanced debugging features

2013-05-03 Thread Paulo Suzart
Now it is perferct! Great tool.


On 2 May 2013 22:04, Ryan Stradling ryanstradl...@gmail.com wrote:

 Make sure to have vimfireplace installed and a repl up and going for the
 project.

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





-- 
Paulo Suzart
@paulosuzart

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

2013-05-03 Thread Shen, Feng
 regarding the perf. improvements, is it client or server?

It's the server.  Due to IO model change: One IO thread (reading and
writing) = One thread reading, decoding + many threads writing

沈锋



On Sat, May 4, 2013 at 7:54 AM, László Török ltoro...@gmail.com wrote:

 Hi,

 regarding the perf. improvements, is it client or server?

 Thx

 Las


 2013/5/3 Michael Klishin michael.s.klis...@gmail.com


 2013/5/3 Feng Shen shen...@gmail.com

 Compare to 2.0.0, noticeable changes:

1. Much faster: about 30%~80% faster.
2. The client support HTTPS now
3. :as option to do client output coercion

 Not that noticeable changes:

1. few minor bugs fixes
2. less RAM usage

 The full update log:
 https://github.com/http-kit/http-kit/blob/master/history.md


 I'd highly recommend starting a new thread for each new version.
 Also, your change log is in chronological order. Keeping it in
 reverse chronological order (2.1.0 first) would make it much easier
 to quickly discover recent changes.

 Good job on the performance improvements!
 --
 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.






 --
 László Török

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




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




Re: http-kit 2.0.0 released

2013-05-03 Thread Shen, Feng
 Could you please let me know whether HTTP-Kit has built-in support for
applying backpressure, and if it
does then how to configure the same

If the backpressure is something like this:
http://mechanical-sympathy.blogspot.jp/2012/05/apply-back-pressure-when-overloaded.html

Then yes.  http-kit uses a bounded queue for accepting request, when too
many request coming, they get queued, if the queue exceeds a certain
size(control by :queue-size option), request get rejected, client will get
503.
And, there is another option :thread controls how many worker threads to
compute HTTP response from request.

There is another possible problem: many requests come in short time, server
compute the response (which is large) very fast(so the request did not get
rejected), and the output link is slow(like low bandwidth network
connection). In this scenario, the HTTP response get queued, wait for TCP
buffer to flush.


沈锋



On Sat, May 4, 2013 at 3:58 AM, Shantanu Kumar kumar.shant...@gmail.comwrote:

 Congratulations on the release! Could you please let me know whether
 HTTP-Kit has built-in support for applying backpressure, and if it
 does then how to configure the same?

 Shantanu

 On May 3, 9:05 pm, Feng Shen shen...@gmail.com wrote:
  Hi,
 
  just released 2.1.0.
 
  [http-kit 2.1.0] ; Add to your project.clj.
 
  Compare to 2.0.0, noticeable changes:
 
 1. Much faster: about 30%~80% faster.
 2. The client support HTTPS now
 3. :as option to do client output coercion
 
  Not that noticeable changes:
 
 1. few minor bugs fixes
 2. less RAM usage
 
  The full update log:
 https://github.com/http-kit/http-kit/blob/master/history.md
 
  Updated client documentation:http://http-kit.org/client.html
 
 
 
 
 
 
 
  On Friday, March 29, 2013 2:03:38 PM UTC+8, Feng Shen wrote:
 
   Hello folks.
 
   I just released version 2.0.0 of http-kit.
 
   *2.0.0 (2013/3/29)*
 
  1. Unify WebSocket and HTTP long polling/streaming with Channel
  protocol and with-channel (API breaks with the RC)
  2. WebSocket support sending and receiving binary frame with byte[]
  3. Support HTTP streaming
  4. WebSocket message ordering is guaranteed by server
 
   Updated documentation:http://http-kit.org/server.html
 
   Let's build amazing realtime applications with Clojure, using http-kit.
 
   The with-channel API is not compatible with the RC releases. The new is
   better and much easier to understand and use. The old's documentation
 can
   be found here http://http-kit.org/server_old.html
 
   - feng

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




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




[ANN] lein-clique - Function dependency graph generator

2013-05-03 Thread Matthew
This is a tool for generating dependency graphs of functions used by 
functions. It goes through the source of functions and resolves any symbols 
in external namespaces, collecting a graph of which functions use which 
other functions. The result is a dotviz file to be layed-out and analyzed 
in a suitable program like Gephi. This allows you to see the in-degree, 
out-degree, betweenness-centrality and whatnot of your functions.

lein-clique https://github.com/Hendekagon/lein-clique

I haven't published a jar to any repo yet so you'll have to clone it  lein 
install.
Apologies if this is duplicate work, but I couldn't find a lib that did 
this so I wrote it. Also apologies for the code as I am new to Clojure.

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: [OT] Re: More idiomatic way to use map like this?

2013-05-03 Thread Timothy Baldridge
In general, loop/recur shouldn't be considered idiomatic, IMO. Instead, try
for a more functional style:

due = 100
cards = cards.map do |card|
card.applied_balance = max(0, due - card.balance)
due -= card.applied_balance

becomes (untested):

(defn apply-balance-1 [{:keys [due] :as accum} [card-id balance]]
  (let [applied (max (- due balance))]
(- accum
 (assoc-in [:applied card-id] applied)
 (assoc-in [:due] due


(reduce apply-balance-1
{:due 100}
{:card-id-1 4404.00
 :card-id-2 3020.00
 etc})

Often I have found that using reduce forces me to break functions into
several parts. If I used loop/recur, normally the function prelude,
postlude and loop block are all smashed into a single function. With reduce
+ a do-step-1 function (as seen above) we can more easily reason about what
is happening. The code is then easier to test as well, as we can test the
calculations apart from the loop logic.

When I'm performing Clojure code reviews, I often consider loop/recur to be
a code smell.

Timothy



On Fri, May 3, 2013 at 3:53 PM, Armando Blancas abm221...@gmail.com wrote:

 On Friday, May 3, 2013 1:15:24 PM UTC-7, Robert Pitts wrote:

 Armando was a good citizen and sent along a plain-text version as well –
 https://groups.google.com/**group/clojure/msg/**
 6aae8287bc55d436?dmode=source**output=gplainnoredirecthttps://groups.google.com/group/clojure/msg/6aae8287bc55d436?dmode=sourceoutput=gplainnoredirect


 That must have been Google Groups doing the right thing... nice feature.

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






-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

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




Re: [OT] Re: More idiomatic way to use map like this?

2013-05-03 Thread Alex Baranosky
I concur with Timothy's assessment.  Really well stated and illustrated use
of reduce with a named reduce function.


On Fri, May 3, 2013 at 10:52 PM, Timothy Baldridge tbaldri...@gmail.comwrote:

 In general, loop/recur shouldn't be considered idiomatic, IMO. Instead,
 try for a more functional style:


 due = 100
 cards = cards.map do |card|
 card.applied_balance = max(0, due - card.balance)
 due -= card.applied_balance

 becomes (untested):

 (defn apply-balance-1 [{:keys [due] :as accum} [card-id balance]]
   (let [applied (max (- due balance))]
 (- accum
  (assoc-in [:applied card-id] applied)
  (assoc-in [:due] due


 (reduce apply-balance-1
 {:due 100}
 {:card-id-1 4404.00
  :card-id-2 3020.00
  etc})

 Often I have found that using reduce forces me to break functions into
 several parts. If I used loop/recur, normally the function prelude,
 postlude and loop block are all smashed into a single function. With reduce
 + a do-step-1 function (as seen above) we can more easily reason about what
 is happening. The code is then easier to test as well, as we can test the
 calculations apart from the loop logic.

 When I'm performing Clojure code reviews, I often consider loop/recur to
 be a code smell.

 Timothy



 On Fri, May 3, 2013 at 3:53 PM, Armando Blancas abm221...@gmail.comwrote:

 On Friday, May 3, 2013 1:15:24 PM UTC-7, Robert Pitts wrote:

 Armando was a good citizen and sent along a plain-text version as well –
 https://groups.google.com/**group/clojure/msg/**
 6aae8287bc55d436?dmode=source**output=gplainnoredirecthttps://groups.google.com/group/clojure/msg/6aae8287bc55d436?dmode=sourceoutput=gplainnoredirect


 That must have been Google Groups doing the right thing... nice feature.

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






 --
 “One of the main causes of the fall of the Roman Empire was that–lacking
 zero–they had no way to indicate successful termination of their C
 programs.”
 (Robert Firth)

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