Re: How did you learn Clojure?

2014-03-21 Thread Sean Corfield
On Mar 20, 2014, at 6:08 PM, Marcus Blankenship mar...@creoagency.com wrote:
 So I'm curious: how did you learn Clojure well enough to be proficient with 
 it, or how are you working on learning it?

Initial dabbling: The Joy of Clojure and a REPL. Caveat: it's not really an 
introductory Clojure book but I had past FP experience so I felt I could jump 
in.

Initial serious learning: Attended Amit Rathore's Clojure Bootcamp - one day 
course for about $300 (if I remember correctly?).

Follow-on: 4clojure.com, worked through Clojure in Action as well.

Then I picked a handful of small-ish problems we'd already solved at work in 
other languages and re-coded them in Clojure.

Since then it's been a steady stream of tackling increasingly larger problems 
at work, over a period of about three years.

 Anyone else facing the focus + fear dilemma?

There's a lot less fear if you're used to learning new languages. I try to pick 
up a new language every year or two: Groovy in 2008/2009, Scala in 2009/2010, 
Clojure in 2010/2011 (and onward). Dabbled in Ruby, Python, Haskell since then 
but nothing serious. Very interested in Elm right now.

As for focus, yes, you really do need a project. Either pick things you've 
done before in other languages, or figure out something that would scratch an 
itch (a small web app, perhaps?) and tackle that.

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

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





signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: How did you learn Clojure?

2014-03-21 Thread Marcus Blankenship
Cool, thanks to all who've replied thus far. 

Question: is there any value in traditional lisp / scheme texts, like SICP, or 
Little Schemer (etc) or other books like that?  I've spent quite a bit of time 
with them, imagining they would pay off, but I'm not sure that's a normal 
route to Clojure proficiency. 

Sent from my iPhone

 On Mar 20, 2014, at 11:12 PM, Sean Corfield s...@corfield.org wrote:
 
 On Mar 20, 2014, at 6:08 PM, Marcus Blankenship mar...@creoagency.com 
 wrote:
 So I'm curious: how did you learn Clojure well enough to be proficient with 
 it, or how are you working on learning it?
 
 Initial dabbling: The Joy of Clojure and a REPL. Caveat: it's not really an 
 introductory Clojure book but I had past FP experience so I felt I could 
 jump in.
 
 Initial serious learning: Attended Amit Rathore's Clojure Bootcamp - one day 
 course for about $300 (if I remember correctly?).
 
 Follow-on: 4clojure.com, worked through Clojure in Action as well.
 
 Then I picked a handful of small-ish problems we'd already solved at work in 
 other languages and re-coded them in Clojure.
 
 Since then it's been a steady stream of tackling increasingly larger problems 
 at work, over a period of about three years.
 
 Anyone else facing the focus + fear dilemma?
 
 There's a lot less fear if you're used to learning new languages. I try to 
 pick up a new language every year or two: Groovy in 2008/2009, Scala in 
 2009/2010, Clojure in 2010/2011 (and onward). Dabbled in Ruby, Python, 
 Haskell since then but nothing serious. Very interested in Elm right now.
 
 As for focus, yes, you really do need a project. Either pick things you've 
 done before in other languages, or figure out something that would scratch an 
 itch (a small web app, perhaps?) and tackle that.
 
 Sean Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 
 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/d/optout.


Re: How did you learn Clojure?

2014-03-21 Thread Marcus Blankenship
Thanks, I'll check it out!

Sent from my iPhone

 On Mar 20, 2014, at 10:54 PM, Devin Walters dev...@gmail.com wrote:
 
 Shameless self-promotion: http://GetClojure.com is something I wrote to 
 hopefully help people learn Clojure. One of the primary methods I used for 
 learning Clojure was to do problems, like the ones Alex mentioned, read 
 source, and ask questions in irc. The last one is important IMO and it's the 
 reason why I wanted to make something like GetClojure. The expressions you 
 search for are all taken from the irc channel and run through a sandbox so 
 you can see what the value and output is. This lets you investigate 
 interesting ways other people have chosen to use the language, and saves you 
 some of the back and forth you might encounter on irc.
 
 All of that being said, you still need to be able to reason about what you're 
 doing, so in general I recommend it as a get unstuck sometimes tool. There 
 are some hidden gems in there though, if you go to the last page of results 
 for a search term and work backwards. (hint: search for map, go to the last 
 page, and work backwards from there for a bit) You can also find interesting 
 destructuring examples by searching for 'let AND :or', and so on.
 
 Anyway, hope it's of use to you or anyone else dropping in on this thread.
 
 Happy Clojuring,
 '(Devin Walters)
 
 On Mar 20, 2014, at 22:23, Marcus Blankenship mar...@creoagency.com wrote:
 
 Thanks, Alex!  Is it kosher to post questions about 4Clojure here?  I'm 
 stumped on a few, and simply looking up the answer often isn't helpful...  
 Is there a clojure-noobs list?
 
 Sent from my iPhone
 
 On Mar 20, 2014, at 8:11 PM, Alex Miller a...@puredanger.com wrote:
 
 Hi Marcus, 
 
 Some great problem sites that can provide opportunities for practice:
 - http://clojurescriptkoans.com/ (I think everything here is actually 
 Clojure)
 - http://4clojure.com - make sure to turn on code golf mode and look at 
 others' solutions too
 - http://exercism.io - get feedback from others on your solutions
 - https://projecteuler.net/
 - http://codingforinterviews.com/ - great email series with practice 
 problems
 
 Clojure for Web Development from Pragmatic Press is a new Clojure book 
 that is a little more focused on a problem domain and build a web app.
 
 Hope that helps...
 Alex Miller
 
 On Thursday, March 20, 2014 8:08:41 PM UTC-5, Marcus Blankenship wrote:
 Hi Folks, 
 
 I'm a post technical PM who's fascinated by Clojure, and want to learn it, 
 but am having a hard time without a real project to work on. It's 
 actually excited me so much I'm considering hanging up my PM hat and 
 diving back in the programmer pool again! 
 
 My problem appears to be 1) focus, and 2) fear. Focus because I can't 
 (yet) earn a living on a clojure project, so it must be done during off 
 hours. Fear because it's harder and more different than the old OO 
 languages I've used in the past. 
 
 So I'm curious: how did you learn Clojure well enough to be proficient 
 with it, or how are you working on learning it? 
 
 Anyone else facing the focus + fear dilemma? 
 
 Sent from my iPhone
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from 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/d/optout.
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from 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/d/optout.
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from 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 

Re: How did you learn Clojure?

2014-03-21 Thread Alex Baranosky
Just take it one step at a time.  Learning Clojure likely involves more
paradigm changes than learning languages in the past, which is why learning
those languages seemed easier. I don't think Clojure is inherently harder
than regular OO... in fact I think it is a simpler approach, but one that
requires you to retrain yourself a little.

The way I learned Clojure personally was like this:
1) read some books
2) port a tiny program of mine to Clojure
3) port a slightly bigger one to Clojure
4) get involved in open source and cleanup code and generally do Clojure
coding
5) get a job doing 95% Clojure to learn the nitty gritty stuff.
6) keep doing more open source and learning more from the community as I go

Have fun with it :)


On Thu, Mar 20, 2014 at 11:12 PM, Sean Corfield s...@corfield.org wrote:

 On Mar 20, 2014, at 6:08 PM, Marcus Blankenship mar...@creoagency.com
 wrote:
  So I'm curious: how did you learn Clojure well enough to be proficient
 with it, or how are you working on learning it?

 Initial dabbling: The Joy of Clojure and a REPL. Caveat: it's not really
 an introductory Clojure book but I had past FP experience so I felt I could
 jump in.

 Initial serious learning: Attended Amit Rathore's Clojure Bootcamp - one
 day course for about $300 (if I remember correctly?).

 Follow-on: 4clojure.com, worked through Clojure in Action as well.

 Then I picked a handful of small-ish problems we'd already solved at work
 in other languages and re-coded them in Clojure.

 Since then it's been a steady stream of tackling increasingly larger
 problems at work, over a period of about three years.

  Anyone else facing the focus + fear dilemma?

 There's a lot less fear if you're used to learning new languages. I try to
 pick up a new language every year or two: Groovy in 2008/2009, Scala in
 2009/2010, Clojure in 2010/2011 (and onward). Dabbled in Ruby, Python,
 Haskell since then but nothing serious. Very interested in Elm right now.

 As for focus, yes, you really do need a project. Either pick things
 you've done before in other languages, or figure out something that would
 scratch an itch (a small web app, perhaps?) and tackle that.

 Sean Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/

 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/d/optout.


Re: Spawn external process and read from output

2014-03-21 Thread Sean Corfield
On Mar 20, 2014, at 9:41 PM, gvim gvi...@gmail.com wrote:
 I'm not familiar with the Java standard library and didn't find anything 
 matching my question on Google so here goes. From my Clojure app I need to 
 call an executable written in C and parse the text output within my Clojure 
 app. What's the standard way to call an external process and read its output? 
 In Ruby I use:
 
 ext = IO.popen '/path/to/file'
 ext.readlines.each {|line| process line}
 ext.close

(- (clojure.java.shell/sh /path/to/file)
:out
(clojure.string/split #\n))

See:

http://clojure.github.io/clojure/clojure.java.shell-api.html#clojure.java.shell/sh
and:

http://clojure.github.io/clojure/clojure.string-api.html#clojure.string/split

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

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





signature.asc
Description: Message signed with OpenPGP using GPGMail


rant / cljs in cljs ? :-)

2014-03-21 Thread t x
Hi,

*  I'm already using:

  :incremental true
  :compiler { :optimizations :none }

* I'm also aware of cljs brepl


However:

1) the cljs compiler is still too slow for my liking (even though it's
not calling closure)

2) I don't like the cljs repl nearly as much as I like the clj repl


Now, my dumb/stupid question:

  Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
with an interpreter that runs 10x slower, if, in exchange, I get to
hit refresh and my new code starts running.

  Furthermore, I'm _okay_ with their being a big delay every time I
introduce a new macro from clj land.


  I realize this sounds spoiled -- but -- the cljs compiler delays are
really really breaking my flow.


Thanks!

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


Re: How did you learn Clojure?

2014-03-21 Thread blake . watson
Some Lisp books have been translated to Clojure. 

http://juliangamble.com/blog/2012/07/13/amazing-lisp-books-living-again-in-clojure/

On Thursday, March 20, 2014 11:23:10 PM UTC-7, Marcus Blankenship wrote:

 Cool, thanks to all who've replied thus far. 

 Question: is there any value in traditional lisp / scheme texts, like 
 SICP, or Little Schemer (etc) or other books like that?  I've spent quite a 
 bit of time with them, imagining they would pay off, but I'm not sure 
 that's a normal route to Clojure proficiency. 

 Sent from my iPhone 

  On Mar 20, 2014, at 11:12 PM, Sean Corfield 
  se...@corfield.orgjavascript: 
 wrote: 
  
  On Mar 20, 2014, at 6:08 PM, Marcus Blankenship 
  mar...@creoagency.comjavascript: 
 wrote: 
  So I'm curious: how did you learn Clojure well enough to be proficient 
 with it, or how are you working on learning it? 
  
  Initial dabbling: The Joy of Clojure and a REPL. Caveat: it's not really 
 an introductory Clojure book but I had past FP experience so I felt I could 
 jump in. 
  
  Initial serious learning: Attended Amit Rathore's Clojure Bootcamp - one 
 day course for about $300 (if I remember correctly?). 
  
  Follow-on: 4clojure.com, worked through Clojure in Action as well. 
  
  Then I picked a handful of small-ish problems we'd already solved at 
 work in other languages and re-coded them in Clojure. 
  
  Since then it's been a steady stream of tackling increasingly larger 
 problems at work, over a period of about three years. 
  
  Anyone else facing the focus + fear dilemma? 
  
  There's a lot less fear if you're used to learning new languages. I try 
 to pick up a new language every year or two: Groovy in 2008/2009, Scala in 
 2009/2010, Clojure in 2010/2011 (and onward). Dabbled in Ruby, Python, 
 Haskell since then but nothing serious. Very interested in Elm right now. 
  
  As for focus, yes, you really do need a project. Either pick things 
 you've done before in other languages, or figure out something that would 
 scratch an itch (a small web app, perhaps?) and tackle that. 
  
  Sean Corfield -- (904) 302-SEAN 
  An Architect's View -- http://corfield.org/ 
  
  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/d/optout.


Re: Perfect Functional Shuffle in Clojure

2014-03-21 Thread Peter Brachwitz
Thank you, Andy! Both for spotting my mistake  and for your comments on 
style. 

On Thursday, March 20, 2014 11:34:00 PM UTC+1, Andy Fingerhut wrote:

 I haven't read all of your code, but note that the Haskell algorithm says 
 it takes a sequence of random values where the first is in the range 
 [0,n-1], the second in the range [0,n-2], third in [0,n-3], etc.  Your 
 repeatedly call here:

 
 https://github.com/pebrc/ninety-nine-clojure/blob/master/src/ninety_nine_clojure/lists.clj#L273

 Is generating a sequence of random values that are all in the range 
 [0,n-1].

 A couple of style comments on your function perfect-functional-shuffle:

 I find it easier to read when a let or loop has multiple bindings on one 
 line if it has commas between the symbol value pairs, e.g.:

 (loop [bst bst, rnds rnds, acc []]

 Clojure treats commas in source code as white space.

 The default case in a cond is most often written :else rather than 
 :otherwise, but both are clear in their meaning and have the same behavior 
 (i.e. any value there other than nil or false will be treated as true).

 I prefer to write two-branch cond statements using if rather than cond.

 Andy


 On Thu, Mar 20, 2014 at 1:59 PM, Peter Brachwitz 
 peter.b...@gmail.comjavascript:
  wrote:

 I tried to implement perfect functional shuffle in Clojure as outlined in 
 http://okmij.org/ftp/Haskell/perfect-shuffle.txt

 This is purely for educational purposes as I am learning Clojure (so 
 please don't be too hard on me if I did something silly)

 The code:

 https://github.com/pebrc/ninety-nine-clojure/blob/master/src/ninety_nine_clojure/lists.clj#L267

 A related blog post:

 http://pbrc.blogspot.com/2014/03/99-clojure-problems-25-generate-random.html

 I would be very happy about any feedback/review. If you have a look at 
 the blog post you will find a histogram that seems to indicate that my 
 perfect functional shuffle is not quite perfect because it is not a uniform 
 distribution. That is almost certainly a mistake on my part, again, I would 
 be very grateful for any hints.

 Cheers,
 Peter

 -- 
 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/d/optout.




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


Re: How did you learn Clojure?

2014-03-21 Thread JPH
The example I use for starting a new language is talking to a remote
JSON API. Plenty to choose from, lets you experiment with libraries
(http, json), and work with data structures.

Also having lein new myapp speeds things along, since you're not
paralyzed on how to begin.

JPH

On 03/21/2014 09:08 AM, Marcus Blankenship wrote:
 Hi Folks,

 I'm a post technical PM who's fascinated by Clojure, and want to learn it, 
 but am having a hard time without a real project to work on. It's actually 
 excited me so much I'm considering hanging up my PM hat and diving back in 
 the programmer pool again!

 My problem appears to be 1) focus, and 2) fear. Focus because I can't (yet) 
 earn a living on a clojure project, so it must be done during off hours. 
 Fear because it's harder and more different than the old OO languages I've 
 used in the past. 

 So I'm curious: how did you learn Clojure well enough to be proficient with 
 it, or how are you working on learning it?

 Anyone else facing the focus + fear dilemma?

 Sent from my iPhone


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


Re: [GSoC] Mentor for self-hosting ClojureScript compiler project?

2014-03-21 Thread Max Kreminski
Thanks to everyone for the guidance. I've submitted my proposal, basically 
using this as a high-level overview of the work that would have to be done.

Looking forward to hearing back about the project :)

Max

On Tuesday, March 18, 2014 9:16:25 AM UTC-7, David Nolen wrote:

 Max,

 Just a fair bit of warning that such a project should probably only happen 
 under GSoC only if it actually pushes along *official* support for 
 bootstrapping ClojureScript in ClojureScript. Just forking the compiler and 
 making changes until it works just isn't going to fly and I do not think 
 it's a good use of anyone's time. Such a project has already been attempted 
 in the past and it's now effectively abandon-ware. So working on a separate 
 compiler is not something I think should be under consideration at all for 
 GSoC.

 The remaining work for CLJS-in-CLJS is actually *not* very ambitious and 
 can likely be completed in the GSoC period:

 * convert AST manipulation to tools.analyzer
 * native *compiler* macros (no runtime macro support will be considered 
 for this project)
 * CLJS port of tools.reader
 * multimethod perf enhancement

 This is really all that remains to be done, everything else is really 
 papering over platform details (I/O, symbol translation).

 If this sounds fun/exciting to you should apply. If it doesn't, I 
 recommend directing your energies elsewhere. I'm more than happy to mentor 
 this, but in order for this to succeed I would like to see work done along 
 these lines from interested parties long before the GSoC period begins.

 David


 On Tue, Mar 18, 2014 at 2:42 AM, Max Kreminski 
 maxkre...@gmail.comjavascript:
  wrote:

 Hello all,

 I'm applying to GSoC this year, and I'm interested in taking the 
 opportunity to go full-speed on a project I've been toying with on the side 
 for the last month or so now.

 Specifically, I'm interested in writing a self-hosting ClojureScript 
 compiler – either by forking the current ClojureScript codebase and making 
 whatever changes are necessary to get it to compile itself, or by putting 
 way more time and energy into the toy CLJS compiler I've been writing from 
 the ground up in my spare time. It's an ambitious project either way, but 
 I've been pleasantly surprised enough by my progress so far that it seems 
 to be within reach.

 You can see the progress I've made lately on Ceci, the aforementioned toy 
 CLJS compiler, at http://github.com/mkremins/ceci. Fair warning: it's 
 pretty rusty, and a lot of functionality is just plain missing or 
 unsupported at the moment – patching up some of these holes could be part 
 of my summer work if my application gets accepted :)

 Is anyone interested in mentoring this or a similar project? I'd love to 
 chat.

 Thanks,
 Max

 -- 
 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/d/optout.




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


Does lib-nor has function which support https server?

2014-03-21 Thread ljcppunix
Hi, 
  noir.util.middleware.war-
handler startup a http server,  then which function support https server?
Does lib-nor has function which support https server? thank you.

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


namespace dependency

2014-03-21 Thread Dave Sann
Assuming a set of directories/classpath, is there a simple way to determine 
the set of namespaces that are dependent on another namespace?

in this case, by dependent I mean (for example):

A refers B
B refers C D

dependents of B are A
dependents of C are B and A
dependents of D are B and A
dependents of A are nothing.

I had a look at tools.namespace but I didn't see an easy way to do this. 
Maybe I missed it.

Thanks

Dave

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


threading operators

2014-03-21 Thread Andy Smith
I have a chain of operations where i want to use a mixture of - and - 
(i.e. some functions expect the previous result to be fed into the second 
item in its sexpr and some expecting it as the last item of its sexpr. What 
is the neatest way to chain such functions together. perhaps I should write 
a macro to swap the second and last items of a form?

Andy

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


Re: local mutable state

2014-03-21 Thread Andy Smith
Im also interested as to why the mutable state approach would be less 
performant? In the single thread case the locks would be optimized out 
right? 

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


Re: local mutable state

2014-03-21 Thread Andy Smith
Excellent point... thanks for the insight

On Thursday, 20 March 2014 20:34:47 UTC, tbc++ wrote:

 Not to mention that this isn't local mutation. You are handing the atom to 
 a closure that then gets wrapped by lazy-seq and returned. So the atom may 
 actually sit around for some time.
  

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


Re: threading operators

2014-03-21 Thread Jim Crossley
Seen 
this? 
http://blog.jayfields.com/2012/09/clojure-refactoring-from-thread-last-to.html

On Friday, March 21, 2014 7:42:34 AM UTC-4, Andy Smith wrote:

 I have a chain of operations where i want to use a mixture of - and - 
 (i.e. some functions expect the previous result to be fed into the second 
 item in its sexpr and some expecting it as the last item of its sexpr. What 
 is the neatest way to chain such functions together. perhaps I should write 
 a macro to swap the second and last items of a form?

 Andy


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


Re: How did you learn Clojure?

2014-03-21 Thread Alex Miller
It's totally fine to ask here (or on #clojure on IRC). noobs fully welcome. 
:) 

On Thursday, March 20, 2014 10:23:42 PM UTC-5, Marcus Blankenship wrote:

 Thanks, Alex!  Is it kosher to post questions about 4Clojure here?  I'm 
 stumped on a few, and simply looking up the answer often isn't helpful... 
  Is there a clojure-noobs list?

 Sent from my iPhone

 On Mar 20, 2014, at 8:11 PM, Alex Miller al...@puredanger.comjavascript: 
 wrote:

 Hi Marcus, 

 Some great problem sites that can provide opportunities for practice:
 - http://clojurescriptkoans.com/ (I think everything here is actually 
 Clojure)
 - http://4clojure.com - make sure to turn on code golf mode and look at 
 others' solutions too
 - http://exercism.io - get feedback from others on your solutions
 - https://projecteuler.net/
 - http://codingforinterviews.com/ - great email series with practice 
 problems

 Clojure for Web Development from Pragmatic Press is a new Clojure book 
 that is a little more focused on a problem domain and build a web app.

 Hope that helps...
 Alex Miller

 On Thursday, March 20, 2014 8:08:41 PM UTC-5, Marcus Blankenship wrote:

 Hi Folks, 

 I'm a post technical PM who's fascinated by Clojure, and want to learn 
 it, but am having a hard time without a real project to work on. It's 
 actually excited me so much I'm considering hanging up my PM hat and diving 
 back in the programmer pool again! 

 My problem appears to be 1) focus, and 2) fear. Focus because I can't 
 (yet) earn a living on a clojure project, so it must be done during off 
 hours. Fear because it's harder and more different than the old OO 
 languages I've used in the past. 

 So I'm curious: how did you learn Clojure well enough to be proficient 
 with it, or how are you working on learning it? 

 Anyone else facing the focus + fear dilemma? 

 Sent from my iPhone

  -- 
 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 javascript:
 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/d/optout.



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


Re: How did you learn Clojure?

2014-03-21 Thread Ulises
When I started learning clojure back in 2010 I decided to give a
presentation about it at work. That set a deadline (about 3 months) in
which I had to learn the language. Having said that, I learnt /the
language/ however wroting code (toy or not) reading other people's code,
getting code reviews (asking for reviews of short snippets in IRC has been
great) has been invaluable.

Again, you could say the same thing about any other language :)


On 21 March 2014 12:31, Alex Miller a...@puredanger.com wrote:

 It's totally fine to ask here (or on #clojure on IRC). noobs fully
 welcome. :)


 On Thursday, March 20, 2014 10:23:42 PM UTC-5, Marcus Blankenship wrote:

 Thanks, Alex!  Is it kosher to post questions about 4Clojure here?  I'm
 stumped on a few, and simply looking up the answer often isn't helpful...
  Is there a clojure-noobs list?

 Sent from my iPhone

 On Mar 20, 2014, at 8:11 PM, Alex Miller al...@puredanger.com wrote:

 Hi Marcus,

 Some great problem sites that can provide opportunities for practice:
 - http://clojurescriptkoans.com/ (I think everything here is actually
 Clojure)
 - http://4clojure.com - make sure to turn on code golf mode and look at
 others' solutions too
 - http://exercism.io - get feedback from others on your solutions
 - https://projecteuler.net/
 - http://codingforinterviews.com/ - great email series with practice
 problems

 Clojure for Web Development from Pragmatic Press is a new Clojure book
 that is a little more focused on a problem domain and build a web app.

 Hope that helps...
 Alex Miller

 On Thursday, March 20, 2014 8:08:41 PM UTC-5, Marcus Blankenship wrote:

 Hi Folks,

 I'm a post technical PM who's fascinated by Clojure, and want to learn
 it, but am having a hard time without a real project to work on. It's
 actually excited me so much I'm considering hanging up my PM hat and diving
 back in the programmer pool again!

 My problem appears to be 1) focus, and 2) fear. Focus because I can't
 (yet) earn a living on a clojure project, so it must be done during off
 hours. Fear because it's harder and more different than the old OO
 languages I've used in the past.

 So I'm curious: how did you learn Clojure well enough to be proficient
 with it, or how are you working on learning it?

 Anyone else facing the focus + fear dilemma?

 Sent from my iPhone

  --
 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/d/optout.

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


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


Re: Clojure Cookbook is out

2014-03-21 Thread Ryan Neufeld
Thanks everyone, it was a blast working on the book.

Until next Thursday, you can get 50% off the digital version of the book 
with the coupon *WKCLJUR http://bit.ly/cc-wkcljr*

-Ryan
On Thursday, March 20, 2014 10:23:36 AM UTC-4, Thomas wrote:

 woooh

 More good books is good for Clojure. Going to order mine today. And a BIG 
 BIG BIG thank you for everyone who has contributed, that is what I love 
 about Clojure (almost ;) ) most, the community!!!

 Thomas

 On Thursday, March 20, 2014 1:15:57 PM UTC, Nando Breiter wrote:

 I got an email from O'Reilly this morning saying that the Clojure 
 Cookbook had been released, and bought it immediately. Thanks to everyone 
 who contributed! It's very helpful.

 http://shop.oreilly.com/product/0636920029786.do

 Nando


 Aria Media Sagl
 Via Rompada 40
 6987 Caslano
 Switzerland

 +41 (0)91 600 9601
 +41 (0)76 303 4477 cell
 skype: ariamedia
  


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


Re: threading operators

2014-03-21 Thread Andy Smith
yes I saw that, but it only works from thread-first to thread-last?

i.e. this works

(- x (- f g h))

but I think the following would fail :

(- x (- f g h))

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


Re: threading operators

2014-03-21 Thread Andy Smith
Im wondering if it is worthwhile to create a macro to thread together 
arbitrary forms (x, f, g, h) injecting the result into different positions 
into the list as required?

(thread-together (- x f - g - h))




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


Re: How did you learn Clojure?

2014-03-21 Thread Andy Smith
Im in the process of learning, and I found that the clojuretv talks and 
presentations on youtube were useful.

Also the video and sample code for Rich Hickey's Ants demo is an excellent 
intro to how concurrency works in clojure :

https://www.youtube.com/watch?v=dGVqrGmwOAw
https://gist.github.com/spacemanaki/1093917

ALso Alex Yakushev's Tetris is worth working though :

http://codethat.wordpress.com/2011/09/10/writing-tetris-in-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/d/optout.


Re: namespace dependency

2014-03-21 Thread Chris Jeris
You might take a look at Tim McCormack's Nephila visualizer:

https://github.com/timmc/nephila


On Fri, Mar 21, 2014 at 6:33 AM, Dave Sann daves...@gmail.com wrote:

 Assuming a set of directories/classpath, is there a simple way to
 determine the set of namespaces that are dependent on another namespace?

 in this case, by dependent I mean (for example):

 A refers B
 B refers C D

 dependents of B are A
 dependents of C are B and A
 dependents of D are B and A
 dependents of A are nothing.

 I had a look at tools.namespace but I didn't see an easy way to do this.
 Maybe I missed it.

 Thanks

 Dave

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




-- 
Chris Jeris
cje...@brightcove.com
freenode/twitter/github: ystael

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


Re: threading operators

2014-03-21 Thread Paul L. Snyder

On Fri, 21 Mar 2014, Andy Smith wrote:

 Im wondering if it is worthwhile to create a macro to thread together
 arbitrary forms (x, f, g, h) injecting the result into different positions
 into the list as required?

 (thread-together (- x f - g - h))

Maybe swiss-arrows has what you are looking for?

  (- x
   f
   (g 1 2 )
   (h 3 4)
   (i 5  6))

  https://github.com/rplevy/swiss-arrows

Paul

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


Re: How did you learn Clojure?

2014-03-21 Thread Lee Spector

A little thing but I use it in when teaching Clojure to newbies and maybe it'll 
be useful for others:

https://github.com/lspector/clojinc/blob/master/src/clojinc/core.clj

 -Lee

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


Re: rant / cljs in cljs ? :-)

2014-03-21 Thread Timothy Baldridge
are you using lein cljsbuild auto ? That's what I use, and I get about
1-3 sec recompile times for stuff that uses core.async.

Timothy


On Fri, Mar 21, 2014 at 12:48 AM, t x txrev...@gmail.com wrote:

 Hi,

 *  I'm already using:

   :incremental true
   :compiler { :optimizations :none }

 * I'm also aware of cljs brepl


 However:

 1) the cljs compiler is still too slow for my liking (even though it's
 not calling closure)

 2) I don't like the cljs repl nearly as much as I like the clj repl


 Now, my dumb/stupid question:

   Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
 with an interpreter that runs 10x slower, if, in exchange, I get to
 hit refresh and my new code starts running.

   Furthermore, I'm _okay_ with their being a big delay every time I
 introduce a new macro from clj land.


   I realize this sounds spoiled -- but -- the cljs compiler delays are
 really really breaking my flow.


 Thanks!

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




-- 
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/d/optout.


Re: threading operators

2014-03-21 Thread John Wiseman
A generalized threading macro, as-, is built into clojure as of 1.5 (I
wonder if clojuredocs.org having so much googlejuice while also being so
out of date makes this sort of thing harder to find):

(as- /tmp x
  (foo x)
  (bar 1 2 x)
  (baz x 3 4)
  (quux 5 x 6))



On Fri, Mar 21, 2014 at 7:08 AM, Paul L. Snyder p...@pataprogramming.comwrote:


 On Fri, 21 Mar 2014, Andy Smith wrote:

  Im wondering if it is worthwhile to create a macro to thread together
  arbitrary forms (x, f, g, h) injecting the result into different
 positions
  into the list as required?
 
  (thread-together (- x f - g - h))

 Maybe swiss-arrows has what you are looking for?

   (- x
f
(g 1 2 )
(h 3 4)
(i 5  6))

   https://github.com/rplevy/swiss-arrows

 Paul

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


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


Re: rant / cljs in cljs ? :-)

2014-03-21 Thread David Nolen
Unless you're compiling a very large file - with auto :optimizations :none
you should always get sub-second compile times under auto.

David


On Fri, Mar 21, 2014 at 10:55 AM, Timothy Baldridge tbaldri...@gmail.comwrote:

 are you using lein cljsbuild auto ? That's what I use, and I get about
 1-3 sec recompile times for stuff that uses core.async.

 Timothy


 On Fri, Mar 21, 2014 at 12:48 AM, t x txrev...@gmail.com wrote:

 Hi,

 *  I'm already using:

   :incremental true
   :compiler { :optimizations :none }

 * I'm also aware of cljs brepl


 However:

 1) the cljs compiler is still too slow for my liking (even though it's
 not calling closure)

 2) I don't like the cljs repl nearly as much as I like the clj repl


 Now, my dumb/stupid question:

   Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
 with an interpreter that runs 10x slower, if, in exchange, I get to
 hit refresh and my new code starts running.

   Furthermore, I'm _okay_ with their being a big delay every time I
 introduce a new macro from clj land.


   I realize this sounds spoiled -- but -- the cljs compiler delays are
 really really breaking my flow.


 Thanks!

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




 --
 “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/d/optout.


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


Re: om component state

2014-03-21 Thread Adrian Miron


On Thursday, March 20, 2014 10:58:08 PM UTC+2, David Nolen wrote:


 If you don't pass app state data to this component then you don't need to 
 bother with build at all. If you need a component that doesn't need app 
 state but does need component local state you need to use om.core/graft. 
 Refer to the documentation on om.core/graft and look at the examples in the 
 repo.

 Channels could work. However :shared was also designed with this scenario 
 in mind, you could use an atom with the message in it and placed it in 
 :shared if the message is not an important piece of state for the rest of 
 your application. There are also examples of :shared in the repo as well.

 HTH,
 David 


Thank you for your reply. I've used graft and it works fine with channels. 
I will also try :shared, but I guess I will have to call refresh! after I 
swap the shared atom?

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


Re: ANN: Om 0.5.2, Regeant, Quiescent, React interop more

2014-03-21 Thread Si
Love it thus far. Big thanks!

On Sunday, 9 March 2014 00:39:35 UTC, David Nolen wrote:

 While I think Om's approach to application state management delivers 
 considerable benefit, I think it would be unfortunate if all the labor put 
 into reusable Om components was confined to Om users. With the latest 
 release I've included examples demonstrating how two important things are 
 now possible:

 1) Because of the cursor abstraction you can reinterpret the meaning of 
 transact! For example here is an Om component that can be used from a plain 
 React component 
 http://github.com/swannodette/om/blob/master/examples/stateful/src/core.cljs. 
 No Om requestAnimationFrame render loop or batched updates to be found.

 2) Because Om components are one step removed from React components, you 
 can back an Om component with an alternate implementation. For example here 
 is an Om component that has been forced to write its local state into the 
 global application state. 
 http://github.com/swannodette/om/blob/master/examples/harmful/src/core.cljs#L158

 Together these features offer a better interoperability story for 
 ClojureScript React users as well as powerful debugging facilities when 
 coupled with :instrument.

 Feedback welcome!

 http://github.com/swannodette/om

 David


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


Re: om component state

2014-03-21 Thread David Nolen
On Fri, Mar 21, 2014 at 11:45 AM, Adrian Miron adrian.miron...@gmail.comwrote:



 On Thursday, March 20, 2014 10:58:08 PM UTC+2, David Nolen wrote:


 If you don't pass app state data to this component then you don't need to
 bother with build at all. If you need a component that doesn't need app
 state but does need component local state you need to use om.core/graft.
 Refer to the documentation on om.core/graft and look at the examples in the
 repo.

 Channels could work. However :shared was also designed with this scenario
 in mind, you could use an atom with the message in it and placed it in
 :shared if the message is not an important piece of state for the rest of
 your application. There are also examples of :shared in the repo as well.

 HTH,
 David


 Thank you for your reply. I've used graft and it works fine with channels.
 I will also try :shared, but I guess I will have to call refresh! after I
 swap the shared atom?


No the simplest thing would be to call om.core/root again, however if this
is not really a global change (i.e. switching logged in user) then you have
to pay for re-rendering your entire UI and throwing away all component
local state.

Sounds like the simplest solution for you is a :shared message channel.
Components that care about the message need to set up go loops and update
their state when they receive a new message.

HTH,
David

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


Re: local mutable state

2014-03-21 Thread Ben Mabey

On 3/21/14, 5:44 AM, Andy Smith wrote:
Im also interested as to why the mutable state approach would be less 
performant? In the single thread case the locks would be optimized out 
right?
No locks are used when using atoms, only compare-and-swap (CAS) 
operations.  While CAS operations are fast you don't want to use them 
unless you need to in a multi-threaded system.  Clojure nor the JVM will 
optimize out the use of them in a single-threaded case like this.  
They are a very heavy approach when all you need is local mutation.  
Clojure doesn't have local mutation out of the box.. it is very 
opinionated on how state should be handled.  The example solution posted 
earlier in the thread is more indiciative of how state like this is 
handled in clojure.


As pointed out earlier in the thread if you wanted/needed to have local 
mutation you could use https://github.com/ztellman/proteus. In the vast 
majority of cases this is unneeded.


-Ben



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

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups Clojure group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com 
mailto:clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


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


Re: How did you learn Clojure?

2014-03-21 Thread Marcus Blankenship
Hey Devin, I don't think I get getClojure.com.  What is it?

On Mar 20, 2014, at 10:54 PM, Devin Walters dev...@gmail.com wrote:

 Shameless self-promotion: http://GetClojure.com is something I wrote to 
 hopefully help people learn Clojure. One of the primary methods I used for 
 learning Clojure was to do problems, like the ones Alex mentioned, read 
 source, and ask questions in irc. The last one is important IMO and it's the 
 reason why I wanted to make something like GetClojure. The expressions you 
 search for are all taken from the irc channel and run through a sandbox so 
 you can see what the value and output is. This lets you investigate 
 interesting ways other people have chosen to use the language, and saves you 
 some of the back and forth you might encounter on irc.
 
 All of that being said, you still need to be able to reason about what you're 
 doing, so in general I recommend it as a get unstuck sometimes tool. There 
 are some hidden gems in there though, if you go to the last page of results 
 for a search term and work backwards. (hint: search for map, go to the last 
 page, and work backwards from there for a bit) You can also find interesting 
 destructuring examples by searching for 'let AND :or', and so on.
 
 Anyway, hope it's of use to you or anyone else dropping in on this thread.
 
 Happy Clojuring,
 '(Devin Walters)
 
 On Mar 20, 2014, at 22:23, Marcus Blankenship mar...@creoagency.com wrote:
 
 Thanks, Alex!  Is it kosher to post questions about 4Clojure here?  I'm 
 stumped on a few, and simply looking up the answer often isn't helpful...  
 Is there a clojure-noobs list?
 
 Sent from my iPhone
 
 On Mar 20, 2014, at 8:11 PM, Alex Miller a...@puredanger.com wrote:
 
 Hi Marcus, 
 
 Some great problem sites that can provide opportunities for practice:
 - http://clojurescriptkoans.com/ (I think everything here is actually 
 Clojure)
 - http://4clojure.com - make sure to turn on code golf mode and look at 
 others' solutions too
 - http://exercism.io - get feedback from others on your solutions
 - https://projecteuler.net/
 - http://codingforinterviews.com/ - great email series with practice 
 problems
 
 Clojure for Web Development from Pragmatic Press is a new Clojure book 
 that is a little more focused on a problem domain and build a web app.
 
 Hope that helps...
 Alex Miller
 
 On Thursday, March 20, 2014 8:08:41 PM UTC-5, Marcus Blankenship wrote:
 Hi Folks, 
 
 I'm a post technical PM who's fascinated by Clojure, and want to learn it, 
 but am having a hard time without a real project to work on. It's 
 actually excited me so much I'm considering hanging up my PM hat and diving 
 back in the programmer pool again! 
 
 My problem appears to be 1) focus, and 2) fear. Focus because I can't (yet) 
 earn a living on a clojure project, so it must be done during off hours. 
 Fear because it's harder and more different than the old OO languages I've 
 used in the past. 
 
 So I'm curious: how did you learn Clojure well enough to be proficient with 
 it, or how are you working on learning it? 
 
 Anyone else facing the focus + fear dilemma? 
 
 Sent from my iPhone
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from 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/d/optout.
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from 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/d/optout.
 
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from 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 

Re: How to update an atom return the change?

2014-03-21 Thread Jakub Holy
Thanks a lot, Stephen!
21. mars 2014 00:57 skrev Stephen Gilardi scgila...@gmail.com følgende:

 There was a stackoverflow question recently that requested a solution for
 a similar problem:


 https://stackoverflow.com/questions/22409638/remove-first-item-from-clojure-vector-atom-and-return-it

 One solution there is similar to this:

 (defn swap*!
   Like swap! but returns a vector of [old-value new-value]
   [atom f  args]
   (loop [old-value @atom]
 (let [new-value (apply f old-value args)]
   (if (compare-and-set! atom old-value new-value)
 [old-value new-value]
 (recur @atom)

 This will return the correct old-value and new-value which you can diff.

 Another note:

 (swap! state #(update-in % [:teams] make-team))


 can be written more succinctly:

 (swap! state update-in [:teams] make-team)

 —Steve

 On Mar 20, 2014, at 6:28 PM, Jakub Holy jakub.h...@iterate.no wrote:

 I have couple of times run into a situation where I want to update a state
 map held in an atom
 and return the change, not the new value. I haven't found a good way to do
 it so either I am missing
 something obvious or there are more idiomatic ways to achieve what I need.
 Could you advise me?

 A concrete example: In ma webapp I want to assign a unique random ID to
 each user. Creating that ID is simple:

 (def state (atom {:teams {}}))

 ;; Remove already used IDs from a lazy seq of random IDs (= unique), take
 the 1st one
 (defn unique-rand-id [id-set]
   (first (remove id-set (repeatedly #(rand-int Integer/MAX_VALUE))

 ;; Add a new team with a unique random ID to the teams map
 (defn make-team [teams]
   (let [id (unique-rand-id (set (keys teams)))]
 (assoc teams id {})))

 ;; Create a new team; TODO: How to get the new team's ID?!
 (swap! state #(update-in % [:teams] make-team))

 So I can generate and remember a new unique random ID but there is no way
 to find out
 what ID it was (I cannot just take diff of state before and after since
 other threads could
 have also added new IDs to it in the meanwhile.)

 Any advice is appreciated. Thank you!

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


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


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


Re: threading operators

2014-03-21 Thread Andy Smith
Ha! thats perfect! I have seen that one but obviously overlooked it.

On Friday, 21 March 2014 15:21:03 UTC, John Wiseman wrote:

 A generalized threading macro, as-, is built into clojure as of 1.5 (I 
 wonder if clojuredocs.org having so much googlejuice while also being so 
 out of date makes this sort of thing harder to find):

 (as- /tmp x
   (foo x)
   (bar 1 2 x)
   (baz x 3 4)
   (quux 5 x 6))



 On Fri, Mar 21, 2014 at 7:08 AM, Paul L. Snyder 
 pa...@pataprogramming.comjavascript:
  wrote:


 On Fri, 21 Mar 2014, Andy Smith wrote:

  Im wondering if it is worthwhile to create a macro to thread together
  arbitrary forms (x, f, g, h) injecting the result into different 
 positions
  into the list as required?
 
  (thread-together (- x f - g - h))

 Maybe swiss-arrows has what you are looking for?

   (- x
f
(g 1 2 )
(h 3 4)
(i 5  6))

   https://github.com/rplevy/swiss-arrows

 Paul

 --
 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/d/optout.




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


Re: rant / cljs in cljs ? :-)

2014-03-21 Thread t x
I'm using:

lein pdo cljx auto,cljsbuild auto dev'

However, maybe perhaps it's weird timing interaction between cljx and
cljsbuild that's making the lag appear more than it actually is.

On Fri, Mar 21, 2014 at 8:27 AM, David Nolen dnolen.li...@gmail.com wrote:
 Unless you're compiling a very large file - with auto :optimizations :none
 you should always get sub-second compile times under auto.

 David


 On Fri, Mar 21, 2014 at 10:55 AM, Timothy Baldridge tbaldri...@gmail.com
 wrote:

 are you using lein cljsbuild auto ? That's what I use, and I get about
 1-3 sec recompile times for stuff that uses core.async.

 Timothy


 On Fri, Mar 21, 2014 at 12:48 AM, t x txrev...@gmail.com wrote:

 Hi,

 *  I'm already using:

   :incremental true
   :compiler { :optimizations :none }

 * I'm also aware of cljs brepl


 However:

 1) the cljs compiler is still too slow for my liking (even though it's
 not calling closure)

 2) I don't like the cljs repl nearly as much as I like the clj repl


 Now, my dumb/stupid question:

   Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
 with an interpreter that runs 10x slower, if, in exchange, I get to
 hit refresh and my new code starts running.

   Furthermore, I'm _okay_ with their being a big delay every time I
 introduce a new macro from clj land.


   I realize this sounds spoiled -- but -- the cljs compiler delays are
 really really breaking my flow.


 Thanks!

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




 --
 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/d/optout.


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

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


tools.namespace.repl refresh is trying to refresh test dependencies we don't need

2014-03-21 Thread Christopher Poile
Hi all,

clojure.tools.namespace.repl/refresh tries to load (and run) the test files 
from a dependent project and, since we don't use midje on the main project, 
it fails when it can't find midje on the classpath. The dependent project 
is a symlink in the checkouts directory, and that project depends on midje 
in its :dev profile. I am starting the repl through cider-jack-in, and the 
:dev profile is active in the main project, but from reading the lein docs 
it seems that maybe the :dev profile isn't being activated for the 
dependent project?

I could add midje as a depency in my main project (which is what I'm doing 
now to stop the error), but is there a better way to fix this?
Thanks to anyone who can help solve this.

Chris.

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


Re: rant / cljs in cljs ? :-)

2014-03-21 Thread Chas Emerick
This particular trick is a clever one (that I'm afraid I've had some 
hand in propagating, for the benefit of those that like an  auto + 
browser refresh workflow), but it's never going to be particularly 
efficient.  By its very nature, pdo sets up cljx and cljsbuild off and 
running without any coordination; it's equivalent to running the two 
tasks in separate processes.


It's possible that some hooks may become available in cljsbuild so that 
things like cljx can do what they like prior to each compile, but that's 
speculative.


IMO, a REPL-based workflow is far superior to anything involving 
reloading your app's page, insofar as you can (nearly always) apply the 
changes you're working on without blowing away the state of the app.  In 
this context, cljx's nREPL middleware excels (but unfortunately cannot 
be used with the stock ClojureScript browser-REPL; check out Austin).


Note that cljx has not been optimized _at all_.  It's fast enough for 
my purposes (i.e. reasonable when doing a clean rebuild, and snappy when 
doing the small changes typical in a REPL). I'd be happy to merge 
reasonable patches that make the actual cljx transformation faster.


- Chas

On 03/21/2014 01:23 PM, t x wrote:

I'm using:

lein pdo cljx auto,cljsbuild auto dev'

However, maybe perhaps it's weird timing interaction between cljx and
cljsbuild that's making the lag appear more than it actually is.

On Fri, Mar 21, 2014 at 8:27 AM, David Nolen dnolen.li...@gmail.com wrote:

Unless you're compiling a very large file - with auto :optimizations :none
you should always get sub-second compile times under auto.

David


On Fri, Mar 21, 2014 at 10:55 AM, Timothy Baldridge tbaldri...@gmail.com
wrote:

are you using lein cljsbuild auto ? That's what I use, and I get about
1-3 sec recompile times for stuff that uses core.async.

Timothy


On Fri, Mar 21, 2014 at 12:48 AM, t x txrev...@gmail.com wrote:

Hi,

*  I'm already using:

   :incremental true
   :compiler { :optimizations :none }

* I'm also aware of cljs brepl


However:

1) the cljs compiler is still too slow for my liking (even though it's
not calling closure)

2) I don't like the cljs repl nearly as much as I like the clj repl


Now, my dumb/stupid question:

   Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
with an interpreter that runs 10x slower, if, in exchange, I get to
hit refresh and my new code starts running.

   Furthermore, I'm _okay_ with their being a big delay every time I
introduce a new macro from clj land.


   I realize this sounds spoiled -- but -- the cljs compiler delays are
really really breaking my flow.


Thanks!

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




--
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/d/optout.


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


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

Re: local mutable state

2014-03-21 Thread Jacob Goodson
Also, you can use straight up java as well inside of loops.  I, sometimes, 
will write a static method, dump the clojure data strcuture over to java, 
mutate like a crazy man, then slap it back into clojure.  I find that loop 
recur are not as elegant as imperative styles of looping(an opinion of 
course).  I think of recursion as a low level operation, it is a outlier in 
clojure where most of the time we swim in an abstraction bliss.  Anyway, I 
find using pattern matching in conjunction with recursion makes it far more 
elegant... https://github.com/clojure/core.match

On Friday, March 21, 2014 7:48:24 AM UTC-4, Andy Smith wrote:

 Excellent point... thanks for the insight

 On Thursday, 20 March 2014 20:34:47 UTC, tbc++ wrote:

 Not to mention that this isn't local mutation. You are handing the atom 
 to a closure that then gets wrapped by lazy-seq and returned. So the atom 
 may actually sit around for some time.
  


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


[ANN] clojure-contracts-maps 0.1.0

2014-03-21 Thread Ian Rumford
Hello all,

I've pushed to Clojars the first cut of a new library: 
clojure-contracts-mapshttps://github.com/ianrumford/clojure-contracts-maps
 

The library enables you to apply contracts to the values of map keys
by creating getter and putter accessor functions.

It also has a few other features including the option to transform the
new value of a key before the map is updated (e.g. to normalise
the value in some way).

Similarly you can transform the existing value (get) before its
returned (to create a derivative view).

I've put together a blog 
posthttp://ianrumford.github.io/blog/2014/03/19/two-sugars-with-your-contracts-for-clojure-maps/
 giving 
many more details.

This library builds on my  
clojure-contracts-sugarhttps://github.com/ianrumford/clojure-contracts-sugar 
library 
I posted and
bloggedhttp://ianrumford.github.io/blog/2014/02/19/a-little-sugar-with-your-clojure-aspect-contracts/
  about a month or so ago.

A shout-out to Fogus and his clojure.core.contracts library which made
all this possible.

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


Concurrently updating two structures

2014-03-21 Thread Jacob Goodson
Say I have two data structures..

enemies
bullets

I want to update them like so...

(some-game-loop
(update enemies)
(update bullets))

If I wanted to make sure that both structures were getting updated at the 
same time instead of 

enemies and then bullets; would I use refs here or would I use something 
else?   What if there 

were many more structures that I wanted to update asynchronously like 
this?  Thanks clojurians!

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


Re: Concurrently updating two structures

2014-03-21 Thread Ben Mabey
For coordination of this type you could either a) use refs and the STM 
or b) put them in the same nested datastructure and put them both in an 
atom. The latter approach is what I would recommend and what people 
generally tend to do.  If you go down this route you end up with the 
entire state of your game in a single atom.  The tradeoffs is that you 
loose the ability to observe certain changes at a granular layer and you 
drive the contention to a single point (which has been discussed 
recently on another thread).  On the flip side you end up with a single 
value that represents your application's state that is easy to work with.


On 3/21/14, 1:42 PM, Jacob Goodson wrote:

Say I have two data structures..

enemies
bullets

I want to update them like so...

(some-game-loop
(update enemies)
(update bullets))

If I wanted to make sure that both structures were getting updated at 
the same time instead of


enemies and then bullets; would I use refs here or would I use 
something else?   What if there


were many more structures that I wanted to update asynchronously like 
this?  Thanks clojurians!


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

To unsubscribe from 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 
mailto:clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


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


Re: Concurrently updating two structures

2014-03-21 Thread Jacob Goodson
If they were nested what would I use to update them simultaneously? 
Futures, then roll a loop that would wait till both are realized?

On Friday, March 21, 2014 4:00:03 PM UTC-4, Ben Mabey wrote:

  For coordination of this type you could either a) use refs and the STM 
 or b) put them in the same nested datastructure and put them both in an 
 atom. The latter approach is what I would recommend and what people 
 generally tend to do.  If you go down this route you end up with the entire 
 state of your game in a single atom.  The tradeoffs is that you loose the 
 ability to observe certain changes at a granular layer and you drive the 
 contention to a single point (which has been discussed recently on another 
 thread).  On the flip side you end up with a single value that represents 
 your application's state that is easy to work with.

 On 3/21/14, 1:42 PM, Jacob Goodson wrote:
  
 Say I have two data structures..

 enemies
 bullets

 I want to update them like so...

 (some-game-loop
 (update enemies)
 (update bullets))

 If I wanted to make sure that both structures were getting updated at the 
 same time instead of 

 enemies and then bullets; would I use refs here or would I use something 
 else?   What if there 

 were many more structures that I wanted to update asynchronously like 
 this?  Thanks clojurians!

  -- 
 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 javascript:
 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/d/optout.


  

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


Re: Concurrently updating two structures

2014-03-21 Thread Gary Trakhman
It doesn't need to be simultaneous within the actual update function (the
function that's passed in to swap!), it needs to be simultaneous just as
far as the atom state-change is concerned.  A faster update function means
less contention and restarts.


On Fri, Mar 21, 2014 at 4:13 PM, Jacob Goodson
submissionfight...@gmx.comwrote:

 If they were nested what would I use to update them simultaneously?
 Futures, then roll a loop that would wait till both are realized?


 On Friday, March 21, 2014 4:00:03 PM UTC-4, Ben Mabey wrote:

  For coordination of this type you could either a) use refs and the STM
 or b) put them in the same nested datastructure and put them both in an
 atom. The latter approach is what I would recommend and what people
 generally tend to do.  If you go down this route you end up with the entire
 state of your game in a single atom.  The tradeoffs is that you loose the
 ability to observe certain changes at a granular layer and you drive the
 contention to a single point (which has been discussed recently on another
 thread).  On the flip side you end up with a single value that represents
 your application's state that is easy to work with.

 On 3/21/14, 1:42 PM, Jacob Goodson wrote:

 Say I have two data structures..

 enemies
 bullets

 I want to update them like so...

 (some-game-loop
 (update enemies)
 (update bullets))

 If I wanted to make sure that both structures were getting updated at the
 same time instead of

 enemies and then bullets; would I use refs here or would I use something
 else?   What if there

 were many more structures that I wanted to update asynchronously like
 this?  Thanks clojurians!

  --
 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/d/optout.


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


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


Re: Concurrently updating two structures

2014-03-21 Thread Jacob Goodson
Ok, I don't think I am communicating or/either comprehending correctly...

it needs to be simultaneous just as far as the atom state-change is 
concerned

How do I do this?  Once the atom is derefenced I would have access to the 
structures but I need to know how to make sure my code does not 
sequentially update them one at a time.  Obviously, I do not want to write 
something that updates the enemies and, after the enemies are fully 
updated, the bullets get updated. I need something that updates enemies 
while updating the bullets, at the same time.  Maybe a code example would 
help?



On Friday, March 21, 2014 4:15:36 PM UTC-4, Gary Trakhman wrote:

 It doesn't need to be simultaneous within the actual update function (the 
 function that's passed in to swap!), it needs to be simultaneous just as 
 far as the atom state-change is concerned.  A faster update function means 
 less contention and restarts.


 On Fri, Mar 21, 2014 at 4:13 PM, Jacob Goodson 
 submissio...@gmx.comjavascript:
  wrote:

 If they were nested what would I use to update them simultaneously? 
 Futures, then roll a loop that would wait till both are realized?


 On Friday, March 21, 2014 4:00:03 PM UTC-4, Ben Mabey wrote:

  For coordination of this type you could either a) use refs and the STM 
 or b) put them in the same nested datastructure and put them both in an 
 atom. The latter approach is what I would recommend and what people 
 generally tend to do.  If you go down this route you end up with the entire 
 state of your game in a single atom.  The tradeoffs is that you loose the 
 ability to observe certain changes at a granular layer and you drive the 
 contention to a single point (which has been discussed recently on another 
 thread).  On the flip side you end up with a single value that represents 
 your application's state that is easy to work with.

 On 3/21/14, 1:42 PM, Jacob Goodson wrote:
  
 Say I have two data structures..

 enemies
 bullets

 I want to update them like so...

 (some-game-loop
 (update enemies)
 (update bullets))

 If I wanted to make sure that both structures were getting updated at 
 the same time instead of 

 enemies and then bullets; would I use refs here or would I use something 
 else?   What if there 

 were many more structures that I wanted to update asynchronously like 
 this?  Thanks clojurians!

  -- 
 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/d/optout.


   -- 
 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/d/optout.




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


Re: Concurrently updating two structures

2014-03-21 Thread Raoul Duke
 update them one at a time.  Obviously, I do not want to write something that
 updates the enemies and, after the enemies are fully updated, the bullets
 get updated. I need something that updates enemies while updating the
 bullets, at the same time.  Maybe a code example would help?

er... i suspect you need to explain better... it doesn't make any
sense to me what you are saying. you have to break out what you mean
by updating, and why they obviously cannot be done sequentially.
since, i suspect, that's how most all games have done it since the
dawn of 8 bit cpus :-) no?

i suspect you are saying you don't want enemies to step beyond a
bullet or some such issue. but waving some magic concurrency pixie
dust is not a solution, at least if you aren't able to explain how it
*would* be a solution.

generally in simple simulations you accept a certain finite time step
that things jump. and you have to deal with that explicitly e.g. in
your collision detection or whatever.

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


Re: Concurrently updating two structures

2014-03-21 Thread Gary Trakhman
Check out my collision detection here:
https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj#L117

I build a map of collided pairs first, then I run through the whole thing
to update the relevant stuff.


On Fri, Mar 21, 2014 at 4:37 PM, Raoul Duke rao...@gmail.com wrote:

  update them one at a time.  Obviously, I do not want to write something
 that
  updates the enemies and, after the enemies are fully updated, the bullets
  get updated. I need something that updates enemies while updating the
  bullets, at the same time.  Maybe a code example would help?

 er... i suspect you need to explain better... it doesn't make any
 sense to me what you are saying. you have to break out what you mean
 by updating, and why they obviously cannot be done sequentially.
 since, i suspect, that's how most all games have done it since the
 dawn of 8 bit cpus :-) no?

 i suspect you are saying you don't want enemies to step beyond a
 bullet or some such issue. but waving some magic concurrency pixie
 dust is not a solution, at least if you aren't able to explain how it
 *would* be a solution.

 generally in simple simulations you accept a certain finite time step
 that things jump. and you have to deal with that explicitly e.g. in
 your collision detection or whatever.

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


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


Re: Concurrently updating two structures

2014-03-21 Thread Jacob Goodson
Lol...my goodness...

I am just using this as a learning exercise, I do not need to be lectured 
about how to write a game loop...  I said obviously since that was my 
original request, I am only asking to learn clojure a little better.  I 
could just drop into java and write a serial loop that does this really 
fast but I don't care about that; also, telling me how something was done 
on an 8-bit computer is about as relevant as explaining to me the intricate 
biological reactions involved in elephant defecation.

On Friday, March 21, 2014 4:37:22 PM UTC-4, raould wrote:

  update them one at a time.  Obviously, I do not want to write something 
 that 
  updates the enemies and, after the enemies are fully updated, the 
 bullets 
  get updated. I need something that updates enemies while updating the 
  bullets, at the same time.  Maybe a code example would help? 

 er... i suspect you need to explain better... it doesn't make any 
 sense to me what you are saying. you have to break out what you mean 
 by updating, and why they obviously cannot be done sequentially. 
 since, i suspect, that's how most all games have done it since the 
 dawn of 8 bit cpus :-) no? 

 i suspect you are saying you don't want enemies to step beyond a 
 bullet or some such issue. but waving some magic concurrency pixie 
 dust is not a solution, at least if you aren't able to explain how it 
 *would* be a solution. 

 generally in simple simulations you accept a certain finite time step 
 that things jump. and you have to deal with that explicitly e.g. in 
 your collision detection or whatever. 


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


Re: Concurrently updating two structures

2014-03-21 Thread Jacob Goodson
Thanks for the code.

On Friday, March 21, 2014 4:41:34 PM UTC-4, Gary Trakhman wrote:

 Check out my collision detection here: 
 https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj#L117

 I build a map of collided pairs first, then I run through the whole thing 
 to update the relevant stuff.


 On Fri, Mar 21, 2014 at 4:37 PM, Raoul Duke rao...@gmail.comjavascript:
  wrote:

  update them one at a time.  Obviously, I do not want to write something 
 that
  updates the enemies and, after the enemies are fully updated, the 
 bullets
  get updated. I need something that updates enemies while updating the
  bullets, at the same time.  Maybe a code example would help?

 er... i suspect you need to explain better... it doesn't make any
 sense to me what you are saying. you have to break out what you mean
 by updating, and why they obviously cannot be done sequentially.
 since, i suspect, that's how most all games have done it since the
 dawn of 8 bit cpus :-) no?

 i suspect you are saying you don't want enemies to step beyond a
 bullet or some such issue. but waving some magic concurrency pixie
 dust is not a solution, at least if you aren't able to explain how it
 *would* be a solution.

 generally in simple simulations you accept a certain finite time step
 that things jump. and you have to deal with that explicitly e.g. in
 your collision detection or whatever.

 --
 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/d/optout.




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


Re: Concurrently updating two structures

2014-03-21 Thread Raoul Duke
 I am just using this as a learning exercise, I do not need to be lectured
 about how to write a game loop...  I said obviously since that was my
 original request, I am only asking to learn clojure a little better.  I
 could just drop into java and write a serial loop that does this really fast
 but I don't care about that; also, telling me how something was done on an
 8-bit computer is about as relevant as explaining to me the intricate
 biological reactions involved in elephant defecation.

you're hired! :-)

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


[ANN] thi.ng/morphogen - Declarative 3D form evolution through tree-based transformations

2014-03-21 Thread Karsten Schmidt
Hi all, I've just pushed the first (promising) beginnings of a new
project to GH and would like to share with you:

https://github.com/thi-ng/morphogen/

Building on top of its companions, the recently announced thi.ng/geom
 thi.ng/luxor libraries, morphogen provides a set of extensible
building blocks to generate complex 3d structures in a completely data
driven, declarative style.

As usual for this project series, this too is developed in a literate
format and even though it's still early days, there's quite a bit of
background info, result renders and detailed descriptions available
already.

Since the weekend is upon us and maybe one or two of you are
interested too in these things, I'd highly appreciate if some critical
and/or creative eyeballs could go over this. Please take a peek, if
you can!

Some small examples (and their renders) I've been using for testing
various bits are here:
https://github.com/thi-ng/morphogen/blob/master/src/examples.org

Things I'm actively working on over the next weeks:

- new deform operators
- export operator tree as graphviz file
- develop HTML5 GUI for operator tree editing

Thank you for your consideration! :) 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/d/optout.


Re: Clojure 1.6.0-RC1 - LAST CHANCE, PLEASE TEST

2014-03-21 Thread Stefan Kamphausen
Hi,


after two days of git bisecting and running my tests over and over again, I 
give up.  While I can repeatedly identify the commit which causes the 
biggest slowdown for me between the 1.5.1 tag and 1.6.0 RC1 I simply refuse 
to believe that the result of my analysis is correct.

On 5045ac124e24ed1fe02be86a10f7f212a4dc everything is fine, on 
96f5b5bdcae44ccc69e33d701e6188dc2570dadf things are slow.  And no, I am not 
running into the exception.

I can only guess that there is some error on my side.  I do not think, the 
slowdown I reported based upon this program should be no reason to delay 
1.6.0. (Even though I'd still like to understand what's going on.)


Best,
stefan

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


apply to quoted form

2014-03-21 Thread Andy Smith
I came across the following issue when doing problem 

user= (let [f '(+ 1 1)] (apply (first f) (rest f)))
1

I could use eval but eval is bad (apparently)...

Investigating this further I can see that :

user= (let [f '(+ 1 1)] (type (first f)))
clojure.lang.Symbol

wheras :

user= (type +)
clojure.core$_PLUS_

It would seem that I still need to call eval on the '+ at least, in order 
to resolve it to a function, but eval is still bad (apparently).

I could create a map of symbol to function and I can see that others have 
done the same, but this seems a bit verbose because clojure will do that 
for me with eval. If the map is the correct approach then why is it any 
better than eval? 

What is the correct thing to do here? Im sure this is revealing some 
fundamental misunderstanding that I have... :o/




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


Re: apply to quoted form

2014-03-21 Thread Andy Smith
that is 'problem 121 from 4clojure' 

http://www.4clojure.com/problem/121

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


Re: How to update an atom return the change?

2014-03-21 Thread Jakub Holy
For the interested, this is my (certainly pretty imperfect) solution for
changing a value in a state map and returning the old and new value (that
can be safely diffed to get the change):

(defn swap-in!
  Combination of update-in and swap! returning the value at the path
before and after.
  [atom path f  args]
  (loop []
(let [old-a @atom
  old-val (get-in old-a path)
  new-val (apply f (cons old-val args))
  new-a (assoc-in old-a path new-val)]
  (if (compare-and-set! atom old-a new-a)
[old-val new-val]
(recur)

;; example:
(swap-in! (atom {:k 1}) [:k] + 2) ;; = [1 3]


2014-03-21 0:57 GMT+01:00 Stephen Gilardi scgila...@gmail.com:

 There was a stackoverflow question recently that requested a solution for
 a similar problem:


 https://stackoverflow.com/questions/22409638/remove-first-item-from-clojure-vector-atom-and-return-it

 One solution there is similar to this:

 (defn swap*!
   Like swap! but returns a vector of [old-value new-value]
   [atom f  args]
   (loop [old-value @atom]
 (let [new-value (apply f old-value args)]
   (if (compare-and-set! atom old-value new-value)
 [old-value new-value]
 (recur @atom)

 This will return the correct old-value and new-value which you can diff.

 Another note:

 (swap! state #(update-in % [:teams] make-team))


 can be written more succinctly:

 (swap! state update-in [:teams] make-team)

 —Steve

 On Mar 20, 2014, at 6:28 PM, Jakub Holy jakub.h...@iterate.no wrote:

 I have couple of times run into a situation where I want to update a state
 map held in an atom
 and return the change, not the new value. I haven't found a good way to do
 it so either I am missing
 something obvious or there are more idiomatic ways to achieve what I need.
 Could you advise me?

 A concrete example: In ma webapp I want to assign a unique random ID to
 each user. Creating that ID is simple:

 (def state (atom {:teams {}}))

 ;; Remove already used IDs from a lazy seq of random IDs (= unique), take
 the 1st one
 (defn unique-rand-id [id-set]
   (first (remove id-set (repeatedly #(rand-int Integer/MAX_VALUE))

 ;; Add a new team with a unique random ID to the teams map
 (defn make-team [teams]
   (let [id (unique-rand-id (set (keys teams)))]
 (assoc teams id {})))

 ;; Create a new team; TODO: How to get the new team's ID?!
 (swap! state #(update-in % [:teams] make-team))

 So I can generate and remember a new unique random ID but there is no way
 to find out
 what ID it was (I cannot just take diff of state before and after since
 other threads could
 have also added new IDs to it in the meanwhile.)

 Any advice is appreciated. Thank you!

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


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




-- 
*Forget software. Strive to make an impact, deliver a valuable change.*

* (**Vær så snill og hjelp meg med å forbedre norsken **min –** skriftlig
og muntlig. Takk!**)*

Jakub Holy
Solutions Engineer | +47 966 23 666
Iterate AS | www.iterate.no
The Lean Software Development Consultancy
- http://theholyjava.wordpress.com/ -

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

Re: rant / cljs in cljs ? :-)

2014-03-21 Thread Moritz Ulrich

I really hope that a small plugin to coordinate cljx/cljsbuild will show
up in the near future. I found cljsbuild's crossovers much better
integrated and easier to use (but still far inferior to cljx).

I agree that a REPL based workflow is much superior, especially with
tools like Om which remove the need to coordinate DOM updates.

Chas Emerick writes:

 This particular trick is a clever one (that I'm afraid I've had some 
 hand in propagating, for the benefit of those that like an  auto + 
 browser refresh workflow), but it's never going to be particularly 
 efficient.  By its very nature, pdo sets up cljx and cljsbuild off and 
 running without any coordination; it's equivalent to running the two 
 tasks in separate processes.

 It's possible that some hooks may become available in cljsbuild so that 
 things like cljx can do what they like prior to each compile, but that's 
 speculative.

 IMO, a REPL-based workflow is far superior to anything involving 
 reloading your app's page, insofar as you can (nearly always) apply the 
 changes you're working on without blowing away the state of the app.  In 
 this context, cljx's nREPL middleware excels (but unfortunately cannot 
 be used with the stock ClojureScript browser-REPL; check out Austin).

 Note that cljx has not been optimized _at all_.  It's fast enough for 
 my purposes (i.e. reasonable when doing a clean rebuild, and snappy when 
 doing the small changes typical in a REPL). I'd be happy to merge 
 reasonable patches that make the actual cljx transformation faster.

 - Chas

 On 03/21/2014 01:23 PM, t x wrote:
 I'm using:

 lein pdo cljx auto,cljsbuild auto dev'

 However, maybe perhaps it's weird timing interaction between cljx and
 cljsbuild that's making the lag appear more than it actually is.

 On Fri, Mar 21, 2014 at 8:27 AM, David Nolen dnolen.li...@gmail.com wrote:
 Unless you're compiling a very large file - with auto :optimizations :none
 you should always get sub-second compile times under auto.

 David


 On Fri, Mar 21, 2014 at 10:55 AM, Timothy Baldridge tbaldri...@gmail.com
 wrote:
 are you using lein cljsbuild auto ? That's what I use, and I get about
 1-3 sec recompile times for stuff that uses core.async.

 Timothy


 On Fri, Mar 21, 2014 at 12:48 AM, t x txrev...@gmail.com wrote:
 Hi,

 *  I'm already using:

:incremental true
:compiler { :optimizations :none }

 * I'm also aware of cljs brepl


 However:

 1) the cljs compiler is still too slow for my liking (even though it's
 not calling closure)

 2) I don't like the cljs repl nearly as much as I like the clj repl


 Now, my dumb/stupid question:

Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
 with an interpreter that runs 10x slower, if, in exchange, I get to
 hit refresh and my new code starts running.

Furthermore, I'm _okay_ with their being a big delay every time I
 introduce a new macro from clj land.


I realize this sounds spoiled -- but -- the cljs compiler delays are
 really really breaking my flow.


 Thanks!

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



 --
 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/d/optout.

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

Re: Clojure 1.6.0-RC1 - LAST CHANCE, PLEASE TEST

2014-03-21 Thread Andy Fingerhut
That is odd.  This is a shot in the dark, and probably unhelpful because I
do not know a good way to verify whether my guess is true, but perhaps the
seqFrom method went from being small enough to be inlined by your JIT
before that change, to being too large to consider for inlining after the
change?  It isn't a big change in the code, so it would have to have been
close to the threshold if this is true.

Andy


On Fri, Mar 21, 2014 at 3:51 PM, Stefan Kamphausen ska2...@gmail.comwrote:

 Hi,


 after two days of git bisecting and running my tests over and over again,
 I give up.  While I can repeatedly identify the commit which causes the
 biggest slowdown for me between the 1.5.1 tag and 1.6.0 RC1 I simply refuse
 to believe that the result of my analysis is correct.

 On 5045ac124e24ed1fe02be86a10f7f212a4dc everything is fine, on
 96f5b5bdcae44ccc69e33d701e6188dc2570dadf things are slow.  And no, I am not
 running into the exception.

 I can only guess that there is some error on my side.  I do not think, the
 slowdown I reported based upon this program should be no reason to delay
 1.6.0. (Even though I'd still like to understand what's going on.)


 Best,
 stefan

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


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


Re: apply to quoted form

2014-03-21 Thread Moritz Ulrich

Andy Smith writes:

 I came across the following issue when doing problem 

 user= (let [f '(+ 1 1)] (apply (first f) (rest f)))
 1

 I could use eval but eval is bad (apparently)...

 Investigating this further I can see that :

 user= (let [f '(+ 1 1)] (type (first f)))
 clojure.lang.Symbol

 wheras :

 user= (type +)
 clojure.core$_PLUS_

 It would seem that I still need to call eval on the '+ at least, in order 
 to resolve it to a function, but eval is still bad (apparently).

 I could create a map of symbol to function and I can see that others have 
 done the same, but this seems a bit verbose because clojure will do that 
 for me with eval. If the map is the correct approach then why is it any 
 better than eval? 

 What is the correct thing to do here? Im sure this is revealing some 
 fundamental misunderstanding that I have... :o/

You want to read about the connection between Vars, Namespaces and
Symbols. Please don't see the following as a good summary for these
topics, it just illustrates the concepts in the scope of your problem:

A var, for example #'clojure.core/+, is a way to refer to a storage
location. #'clojure.core/+ is a var which 'contains' a function which
adds numbers.

A Namespace (for example clojure.core) is just a collection of vars. 

A symbol is a form of identifier. '+ is a symbol.

You start with the symbol +. The function `(ns-resolve ns sym)' will
try to find a var in `ns' with the same name as `sym' and return it.

In the end, you want to call the function behind the var, so you have to
use `var-get' to get the value the var points to.

-- 
Moritz Ulrich


pgphkZl7qIu1U.pgp
Description: PGP signature


Re: apply to quoted form

2014-03-21 Thread John Mastro
On Fri, Mar 21, 2014 at 3:55 PM, Andy Smith the4thamig...@googlemail.comwrote:
 I came across the following issue when doing problem

 user= (let [f '(+ 1 1)] (apply (first f) (rest f)))
 1

That's interesting. It seems it's the last form in the list that's being
returned, and it doesn't matter what function you apply

(apply '+ '(2 1))   ;= 1
(apply '+ '(1 2))   ;= 2
(apply 'map '(2 1)) ;= 1

I don't have any immediate thoughts on why it behaves like that, though
I'm sure there's a reason (?).

 I could use eval but eval is bad (apparently)...

You could use clojure.core/resolve instead, I think that should be safe.

(let [f '(+ 1 1)]
  (apply (resolve (first f) (rest f
;= 2

--
John Mastro

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


Re: Clojure 1.6.0-RC1 - LAST CHANCE, PLEASE TEST

2014-03-21 Thread Stefan Kamphausen


On Saturday, March 22, 2014 12:41:55 AM UTC+1, Andy Fingerhut wrote:

 That is odd.  This is a shot in the dark, and probably unhelpful because I 
 do not know a good way to verify whether my guess is true, but perhaps the 
 seqFrom method went from being small enough to be inlined by your JIT 
 before that change, to being too large to consider for inlining after the 
 change?  It isn't a big change in the code, so it would have to have been 
 close to the threshold if this is true.


if there is anything I can do to test this, just let me know.

Best,
stefan 

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


Re: apply to quoted form

2014-03-21 Thread John Mastro
On Fri, Mar 21, 2014 at 4:44 PM, John Mastro john.b.mas...@gmail.comwrote:

 (let [f '(+ 1 1)]
   (apply (resolve (first f) (rest f
 ;= 2


Sorry, I have a typo in there. It should be:

(let [f '(+ 1 1)]
  (apply (resolve (first f)) (rest f)))

--
John Mastro

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


Re: apply to quoted form

2014-03-21 Thread John Mastro
On Fri, Mar 21, 2014 at 4:44 PM, John Mastro john.b.mas...@gmail.comwrote:

 That's interesting. It seems it's the last form in the list that's being
 returned, and it doesn't matter what function you apply


Sigh, clearly sometimes I type faster than I think. That should be it
doesn't matter what symbol you apply, since as you already noted it's not
a function object at all.

--
John Mastro

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


Re: apply to quoted form

2014-03-21 Thread Sean Corfield
This happens because a Symbol is a function that looks itself up in its 
argument much like Keywords do:

user= ('a {'a 2 'b 3})
2
user= ('b {'a 2 'b 3})
3
user= ('b 42)
nil

And the two argument version provides a default value to return if the symbol 
is not found:

user= ('c {'a 2 'b 3} ::not-found)
:user/not-found
user= ('c not a map ::not-found)
:user/not-found

Sean

On Mar 21, 2014, at 4:44 PM, John Mastro john.b.mas...@gmail.com wrote:

 
 On Fri, Mar 21, 2014 at 3:55 PM, Andy Smith the4thamig...@googlemail.com 
 wrote:
  I came across the following issue when doing problem 
 
  user= (let [f '(+ 1 1)] (apply (first f) (rest f)))
  1
 
 That's interesting. It seems it's the last form in the list that's being
 returned, and it doesn't matter what function you apply
 
 (apply '+ '(2 1))   ;= 1
 (apply '+ '(1 2))   ;= 2
 (apply 'map '(2 1)) ;= 1
 
 I don't have any immediate thoughts on why it behaves like that, though
 I'm sure there's a reason (?).
 
  I could use eval but eval is bad (apparently)...
 
 You could use clojure.core/resolve instead, I think that should be safe.
 
 (let [f '(+ 1 1)]
   (apply (resolve (first f) (rest f
 ;= 2



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: How did you learn Clojure?

2014-03-21 Thread Jarrod Swart
A tip if you are completely stuck on 4clojure:

Often the 4clojure problem will say you can't use a particular function. 
 The first thing I would do is go look at the source code for that 
function, then I would try to find other functions with similar 
functionality.

Much like learning to paint or write, you have to copy first.  Eventually 
looking through all that source code you will start to develop a sense of 
how a problem can be solved, and in giving any solution 4clojure lets you 
look at the solutions of others.  Look at the most prolific 4clojure users, 
their solutions will teach you a lot.  Look up the functions they used.  In 
order to learn to Think in Clojure you need to understand how someone who 
already can\does did what they did. 

Another general tip is to harness momentum, when I started learning I 
picked one thing that I could completely finish in a day.  And the trick is 
to dream small, some things I did:

   - List the files in a directory and sort them by type.
   - A crypto-quote assist\solver.
   - A small text based adventure game.
   

The goal is to get a WHOLE thing done, even if it is a small thing.  I did 
this 2-3 times a week.  Porting old code you have done before in another 
language is great too because the big issue here will be learning to turn 
OO\Imperative code into functional code.

I also wrote a blog post listing the resources I used when just getting 
started: http://jarrodswart.com/beginner-resources-clojure/, and a super 
friendly 10k foot view of the reduce 
function: http://jarrodswart.com/clojure-like-im-five-reduce-functions/.

Hope this helps,
Jarrod

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


Re: How to update an atom return the change?

2014-03-21 Thread Jarrod Swart
Just to add to this because I ran across this reading some code a few days 
ago:

https://github.com/overtone/at-at/blob/master/src/overtone/at_at.clj#L43-51

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


[ANN] Clojure 1.6.0-RC2

2014-03-21 Thread Alex Miller
Clojure 1.6.0-RC2 is now available.

Try it via
- Download: http://central.maven.org/maven2/org/clojure/clojure/1.6.0-RC2
- Leiningen: [org.clojure/clojure 1.6.0-RC2]

See the full change log here:
https://github.com/clojure/clojure/blob/master/changes.md

Clojure 1.6.0-RC2 has the following changes since 1.6.0-RC1:

- String hasheq calculation has changed so it can leverage cached String
hashCode
- [CLJ-1387] reduce-kv on large hash maps ignores reduced result

Please let us know how it looks - we would like to make this 1.6.0 final.

Alex

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


Re: Clojure 1.6.0-RC1 - LAST CHANCE, PLEASE TEST

2014-03-21 Thread Alex Miller
That's pretty weird. 

1.6.0-RC2 is out now - I would really appreciate it if you could give it a 
shot.

Alex

On Friday, March 21, 2014 5:51:14 PM UTC-5, Stefan Kamphausen wrote:

 Hi,


 after two days of git bisecting and running my tests over and over again, 
 I give up.  While I can repeatedly identify the commit which causes the 
 biggest slowdown for me between the 1.5.1 tag and 1.6.0 RC1 I simply refuse 
 to believe that the result of my analysis is correct.

 On 5045ac124e24ed1fe02be86a10f7f212a4dc everything is fine, on 
 96f5b5bdcae44ccc69e33d701e6188dc2570dadf things are slow.  And no, I am not 
 running into the exception.

 I can only guess that there is some error on my side.  I do not think, the 
 slowdown I reported based upon this program should be no reason to delay 
 1.6.0. (Even though I'd still like to understand what's going on.)


 Best,
 stefan



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


Re: namespace dependency

2014-03-21 Thread Dave Sann
thanks, that got me on the right track.

it turns out that clojure.tools.namespace.dir/scan can do this. The reason 
I couldn't see the dependencies I was looking for was because I had managed 
to write (ns .. (require ...)) instead of (ns ... (:require ...)) in the 
files I was looking at. This caused the declaration parsing to miss the 
referred namespaces.

Cheers

Dave



On Saturday, 22 March 2014 01:11:53 UTC+11, cjeris wrote:

 You might take a look at Tim McCormack's Nephila visualizer:

 https://github.com/timmc/nephila


 On Fri, Mar 21, 2014 at 6:33 AM, Dave Sann dave...@gmail.comjavascript:
  wrote:

 Assuming a set of directories/classpath, is there a simple way to 
 determine the set of namespaces that are dependent on another namespace?

 in this case, by dependent I mean (for example):

 A refers B
 B refers C D

 dependents of B are A
 dependents of C are B and A
 dependents of D are B and A
 dependents of A are nothing.

 I had a look at tools.namespace but I didn't see an easy way to do this. 
 Maybe I missed it.

 Thanks

 Dave

  -- 
 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/d/optout.




 -- 
 Chris Jeris
 cje...@brightcove.com javascript:
 freenode/twitter/github: ystael
  

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


Re: [ANN] Clojure 1.6.0-RC2

2014-03-21 Thread Mikera
Working fine for me with core.matrix latest build.

On Saturday, 22 March 2014 10:46:22 UTC+8, Alex Miller wrote:

 Clojure 1.6.0-RC2 is now available. 
  
 Try it via 
 - Download: http://central.maven.org/maven2/org/clojure/clojure/1.6.0-RC2
 - Leiningen: [org.clojure/clojure 1.6.0-RC2]

 See the full change log here:
 https://github.com/clojure/clojure/blob/master/changes.md

 Clojure 1.6.0-RC2 has the following changes since 1.6.0-RC1:

 - String hasheq calculation has changed so it can leverage cached String 
 hashCode
 - [CLJ-1387] reduce-kv on large hash maps ignores reduced result

 Please let us know how it looks - we would like to make this 1.6.0 final.

 Alex


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