Re: Clojure and the Anti-If Campaign

2012-05-30 Thread Tassilo Horn
Benny Tsai benny.t...@gmail.com writes:

 There's while in clojure.core; would that work?

That would be cheating:

--8---cut here---start-8---
user (macroexpand '(while (foo) (bar)))
(loop* [] (clojure.core/when (foo) (bar) (recur)))
--8---cut here---end---8---

And of course, `when` expands to an `if` again.

 On Tuesday, May 29, 2012 8:13:24 AM UTC-7, Andrew wrote:

 Thanks for sharing your blog post. Is there an Anti-If alternative to
 loop/recur in a situation where you have to poll for a condition to
 be true? (Seems to me that this necessitates some kind of conditional
 statement)

If the value checked by the predicate is held in some clojure reference
type, you can add a watch function (`add-watch`).  You still need to
test the predicate in the watch function, but at least you don't need to
do polling, because the watch function will only be called when the
value changes.

Bye,
Tassilo

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


Re: Recursive lets

2012-05-30 Thread nicolas.o...@gmail.com
 I agree with the other commenters that letfn is good when you can use
 it, but here you can't use it. Your general approach is really the
 best you can do, though it's nicer to use promise/deliver than atom/
 swap!, since these values are never going to change again.

I was looking for something equivalent to letrec in scheme. (Which
allows slightly more than let or letfn)

But your idea of a promise/deliver is nicer than my atom/reset!: it
expresses the idea of closing the loop better.

Thanks again.

Nicolas.

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


Re: Clojurians in Austria

2012-05-30 Thread Jozef Wagner
Thanks for replies!

I've created a group at https://groups.google.com/forum/#!forum/clojure-at 

Feel free to join :)

Best,
Jozef

On Tuesday, May 29, 2012 7:20:02 PM UTC+2, bsmith.occs wrote:

 I too am in Vienna. I use Clojure at work for a few small internal 
 tools, but not in production. I'd be glad to meet some other 
 Clojurists. 

 // Ben 

 On Tue, May 29, 2012 at 5:05 PM, Nuno Marques 
  wrote: 
  I'm in Vienna and I know a couple of more Clojure people here. 
  I would be happy to help start a clojure group here. 
  
  On May 29, 2012, at 4:40 PM, Florian Over wrote: 
  
  Hi 
  i met a nice guy (David from intermaps.com) from Vienna on 
 EuroClojure. 
  He mentioned that there are other Clojure-User in Vienna as well. 
  But no UserGroup right now. 
  
  Maybe you can start irc clojure-at ? 
  
  Florian 
  
  2012/5/29 Jozef Wagner : 
  Hi, 
  
  Are there some Clojurians from Austria or is there an Austria Clojure 
  group? 
  
  I'm looking for a Clojure related job in Austria, and so far I haven't 
 found 
  any Austrian group on meetup.com nor on the google groups :( 
  
  Best, 
  Jozef 


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

Re: Clojurians in Austria

2012-05-30 Thread Stefan Hübner
There was a How to build communities session at EuroClojure. In
summary:

- Just get going. Find some people (with 3 your already a group), find a
  place (like a pub for starters) and meet. You'll like it!
- Meet regularly e.g. monthly.
- If you want to do some coding and your group grows, find a space
  (Vienna has at least one Hackerspace - metalab - that might work. In
  Berlin we meet at an office of one of our members)
- When the group grows, experiment with different schemes for your
  events. London does Dojos a la
  http://www.ntoll.org/how-to-run-an-awesome-code-dojo.html. Here in
  Berlin we've occasonially had talks, but favour *doing* something
  with code. 4clojure.com has loads of interesting problems to hack on.
- Food and beverages are nice but not the key aspect ;)

Good luck for your endeavour!

Jozef Wagner jozef.wag...@gmail.com writes:

 Thanks for replies!

 I've created a group at https://groups.google.com/forum/#!forum/clojure-at 

 Feel free to join :)

 Best,
 Jozef

 On Tuesday, May 29, 2012 7:20:02 PM UTC+2, bsmith.occs wrote:

 I too am in Vienna. I use Clojure at work for a few small internal
 tools, but not in production. I'd be glad to meet some other
 Clojurists.

 // Ben

 On Tue, May 29, 2012 at 5:05 PM, Nuno Marques
  wrote:
  I'm in Vienna and I know a couple of more Clojure people here.
  I would be happy to help start a clojure group here.
 
  On May 29, 2012, at 4:40 PM, Florian Over wrote:
 
  Hi
  i met a nice guy (David from intermaps.com) from Vienna on EuroClojure.
  He mentioned that there are other Clojure-User in Vienna as well.
  But no UserGroup right now.
 
  Maybe you can start irc clojure-at ?
 
  Florian
 
  2012/5/29 Jozef Wagner :
  Hi,
 
  Are there some Clojurians from Austria or is there an Austria Clojure
  group?
 
  I'm looking for a Clojure related job in Austria, and so far I haven't
 found
  any Austrian group on meetup.com nor on the google groups :(
 
  Best,
  Jozef

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

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


Tracking ClojureScript Performance

2012-05-30 Thread David Nolen
Brian Taylor has put together a pretty awesome resource for tracking
ClojureScript performance: http://50ply.com/cljs-bench

If there's a particular aspect of your ClojureScript application that
you're finding unbearably slow you can contribute a benchmark here:
http://github.com/netguy204/cljs-bench

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

Re: How do I suppress warnings in a Clojurescript compilation?

2012-05-30 Thread Evan Mezeske
It sounds to me like you're using a plain JavaScriupt file as an externs 
definition.  If that's the case, one way to get rid of the warnings is to 
clean up the externs file so that it only contains the function/variable 
names that are meant to be publicly used.  As an example, here's the 
externs file for jquery: 
https://github.com/ibdknox/jayq/blob/master/resources/externs/jquery.js .

On Wednesday, May 30, 2012 12:15:35 PM UTC-7, Stephen Cagle wrote:

 When I compile in advanced mode, I get thousands of warnings of the nature

 May 30, 2012 11:22:23 AM com.google.javascript.jscomp.LoggerErrorManager 
 println
 WARNING: /Users/stephen/work/rpc/jquery-1.7.2.min.js:2: WARNING - 
 accessing name a in externs has no effect
 function cu(a){if(!cj[a]){var 
 b=c.body,d=f(+a+).appendTo(b),e=d.css(display);d.remove();if(e===none||e===){ck||(ck=c.createElement(iframe),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?!doctype
  
 html:)+htmlbody),cl.close();d=cl.createElement(a),cl.body.a... 
 (It goes on for around a hundred something lines)

 Where 'a' can be any variable. This results in wall clock compilation time 
 of 63 minutes, but user compilation time of 4 minutes (if I remember 
 correctly). My java processor usage is hovering at just a few percentage 
 points.

 I assume this means that it is spending all its time printing out these 
 warning messages to me. Is there way in my project file to tell 
 Clojurescript to not print the warnings?


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

Simultaneous use of the same dynamic binding

2012-05-30 Thread Gerrard McNulty
I see a lot of clojure libraries use the pattern where an implicit
variable is stored as a dynamic variable.  A good example is
clojure.java.jdbc:

(require '[clojure.java.jdbc :as sql])

(sql/with-connection db-spec
  sql code here)

What do I do if I have to instantiate two things that uses the same
dynamic binding at the same time.  Using the java.jdbc example, what
if I wanted to run multiple selects from db-1 and insert each result
into db-2?  Do I need keep calling (sql/with-connection db-2 ...)
after each select from db-1?

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


Re: How do I suppress warnings in a Clojurescript compilation?

2012-05-30 Thread Stephen Cagle
David,

I am depending on lein-cljsbuild 0.1.10

I am compiling by typing  lein cljsbuild once

This is the content of my project.clj's cljsbuild section:

:cljsbuild {:crossovers [rpc.tree]
   :builds [{:source-path src/rpc/client
  :compiler {:output-to resources/public/main.js
  :optimizations :advanced
  :externs [jquery-1.7.2.min.js]
  :pretty-print true}}]}

Evan,
Yes, I imagine that would fix it, as jayqe is the dependency I am using 
that seems to cause these issues. I know nothing about it, but is it 
unreasonable to expect the closure compiler to just figure it out for 
itself? Will modifying the jquery code manually generate substantially 
different code than letting closure figure out which jquery resources I am 
actually using? I am curious.

On Wednesday, May 30, 2012 1:33:25 PM UTC-7, Evan Mezeske wrote:

 It sounds to me like you're using a plain JavaScriupt file as an externs 
 definition.  If that's the case, one way to get rid of the warnings is to 
 clean up the externs file so that it only contains the function/variable 
 names that are meant to be publicly used.  As an example, here's the 
 externs file for jquery: 
 https://github.com/ibdknox/jayq/blob/master/resources/externs/jquery.js .

 On Wednesday, May 30, 2012 12:15:35 PM UTC-7, Stephen Cagle wrote:

 When I compile in advanced mode, I get thousands of warnings of the nature

 May 30, 2012 11:22:23 AM com.google.javascript.jscomp.LoggerErrorManager 
 println
 WARNING: /Users/stephen/work/rpc/jquery-1.7.2.min.js:2: WARNING - 
 accessing name a in externs has no effect
 function cu(a){if(!cj[a]){var 
 b=c.body,d=f(+a+).appendTo(b),e=d.css(display);d.remove();if(e===none||e===){ck||(ck=c.createElement(iframe),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?!doctype
  
 html:)+htmlbody),cl.close();d=cl.createElement(a),cl.body.a... 
 (It goes on for around a hundred something lines)

 Where 'a' can be any variable. This results in wall clock compilation 
 time of 63 minutes, but user compilation time of 4 minutes (if I remember 
 correctly). My java processor usage is hovering at just a few percentage 
 points.

 I assume this means that it is spending all its time printing out these 
 warning messages to me. Is there way in my project file to tell 
 Clojurescript to not print the warnings?



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

Re: Simultaneous use of the same dynamic binding

2012-05-30 Thread Sean Corfield
On Wed, May 30, 2012 at 3:26 PM, Gerrard McNulty
gerrard.mcnu...@gmail.com wrote:
 I see a lot of clojure libraries use the pattern where an implicit
 variable is stored as a dynamic variable.  A good example is
 clojure.java.jdbc:

I wouldn't say it's a good example. It's certainly an example of this pattern.

 What do I do if I have to instantiate two things that uses the same
 dynamic binding at the same time.  Using the java.jdbc example, what
 if I wanted to run multiple selects from db-1 and insert each result
 into db-2?  Do I need keep calling (sql/with-connection db-2 ...)
 after each select from db-1?

No, you'd need to doall on the selects from db-1 and lift the results
out and then pass them into inserts on db-2.

Your example is partly why this practice of binding dynamic variables
as implicit variables is poor: it doesn't compose.

Coming soon to clojure.java.jdbc: an API where you can pass the db
connection directly into every operation.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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


Re: Simultaneous use of the same dynamic binding

2012-05-30 Thread Jack Moffitt
 What do I do if I have to instantiate two things that uses the same
 dynamic binding at the same time.  Using the java.jdbc example, what
 if I wanted to run multiple selects from db-1 and insert each result
 into db-2?  Do I need keep calling (sql/with-connection db-2 ...)
 after each select from db-1?

 Your example is partly why this practice of binding dynamic variables
 as implicit variables is poor: it doesn't compose.

Note that Korma gets around this somewhat by tying the database to use
to the table definition. It's effectively the same thing as doall and
lifting the results, but at least it doesn't have any syntactic
overhead.

jack.

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


Re: How do I suppress warnings in a Clojurescript compilation?

2012-05-30 Thread Evan Mezeske
Unfortunately, I have not been able to find even a decent resource on the 
general topic of creating extern definition files.  So, please take this 
with a grain of salt, and let's hope someone more knowledgeable can come 
along and clear things up.

My belief is that using an unmodified JS file as an externs file will most 
likely result in an overeager list of unmanglable names being used  when 
minifying your compiled JS.  There's plenty of names mentioned in the 
jQuery sources that are not meant to be called publicly, and I expect that 
the closure compiler doesn't know that.

Another problem arises due the extremely dynamic nature of JS -- it's not 
possible statically to tell what fields an object might have, since they 
can be added dynamically, etc.  It would be trivial to write a contrived 
example where the compiler couldn't know not to mangle a particular name.

Aaaanyway, the best solution for your specific case is to just change your 
:externs to [externs/jquery.js].  The jayq JAR contains this resource, 
and it has already been hand-built to be used as an externs file.

On Wednesday, May 30, 2012 6:46:17 PM UTC-7, Stephen Cagle wrote:

 David,

 I am depending on lein-cljsbuild 0.1.10

 I am compiling by typing  lein cljsbuild once

 This is the content of my project.clj's cljsbuild section:

 :cljsbuild {:crossovers [rpc.tree]
:builds [{:source-path src/rpc/client
   :compiler {:output-to resources/public/main.js
   :optimizations :advanced
   :externs [jquery-1.7.2.min.js]
   :pretty-print true}}]}

 Evan,
 Yes, I imagine that would fix it, as jayqe is the dependency I am using 
 that seems to cause these issues. I know nothing about it, but is it 
 unreasonable to expect the closure compiler to just figure it out for 
 itself? Will modifying the jquery code manually generate substantially 
 different code than letting closure figure out which jquery resources I am 
 actually using? I am curious.

 On Wednesday, May 30, 2012 1:33:25 PM UTC-7, Evan Mezeske wrote:

 It sounds to me like you're using a plain JavaScriupt file as an externs 
 definition.  If that's the case, one way to get rid of the warnings is to 
 clean up the externs file so that it only contains the function/variable 
 names that are meant to be publicly used.  As an example, here's the 
 externs file for jquery: 
 https://github.com/ibdknox/jayq/blob/master/resources/externs/jquery.js .

 On Wednesday, May 30, 2012 12:15:35 PM UTC-7, Stephen Cagle wrote:

 When I compile in advanced mode, I get thousands of warnings of the 
 nature

 May 30, 2012 11:22:23 AM com.google.javascript.jscomp.LoggerErrorManager 
 println
 WARNING: /Users/stephen/work/rpc/jquery-1.7.2.min.js:2: WARNING - 
 accessing name a in externs has no effect
 function cu(a){if(!cj[a]){var 
 b=c.body,d=f(+a+).appendTo(b),e=d.css(display);d.remove();if(e===none||e===){ck||(ck=c.createElement(iframe),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?!doctype
  
 html:)+htmlbody),cl.close();d=cl.createElement(a),cl.body.a... 
 (It goes on for around a hundred something lines)

 Where 'a' can be any variable. This results in wall clock compilation 
 time of 63 minutes, but user compilation time of 4 minutes (if I remember 
 correctly). My java processor usage is hovering at just a few percentage 
 points.

 I assume this means that it is spending all its time printing out these 
 warning messages to me. Is there way in my project file to tell 
 Clojurescript to not print the warnings?



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

Re: How do I suppress warnings in a Clojurescript compilation?

2012-05-30 Thread Evan Mezeske
I also meant to mention that there are a ton of knobs on the closure 
compiler that are not exposed by the ClojureScript compiler.  This is 
something I'd like to improve (or see improved) at some point, but it's a 
tricky problem, due to the vast number of options [1].  I expect the only 
way to really expose them all would be to add a hook where user code could 
set the options object before compiling.

It does look like there is an option that *might* disable the warnings 
you're seeing: DiagnosticGroups.EXTERNS_VALIDATION [2].  I haven't tested 
this, so I'm not sure if it would quiet down the X has no effect messages 
or not.  At any rate, there's no easy way to tweak this setting with 
ClojureScript.

[1] 
http://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/javascript/jscomp/CompilerOptions.java
[2] http://code.google.com/p/closure-compiler/wiki/Warnings

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