Re: Promise for ClojureScript?

2012-11-27 Thread Max Penet
jayq [1] now supports jQuery deferred API , there are 2 examples of its use 
with these 2 macros: let-ajax and let-deferred (see the readme).  

[1] https://github.com/ibdknox/jayq

On Tuesday, November 27, 2012 12:51:22 AM UTC+1, FrankS wrote:

 All this call-back stuff drives me crazy in ClojureScriptJS… 

 Unfortunately we do not have a real cljs promise yet. 

 There seem to be javascript constructs that promise (pun intended) to do 
 similar things - jQuery has some deferred and promise things. 

 I have no experience with any of those javascript libs, and I cannot find 
 any example in ClojureScript that use those… 

 Any advise/suggestions/pointers/cljs-sample-code? 

 Thanks, FrankS. 



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

ANN - Conjure 2.1.1 - Lightweight mocking library

2012-11-27 Thread Alex Baranosky
Conjure is a lightweight mocking library intended to be used on top of
clojure.test.

We've been using it at Runa for a long time, and it is compatible with all
versions of Clojure from 1.2 to 1.5-beta1.

https://github.com/amitrathore/conjure

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

Re: Promise for ClojureScript?

2012-11-27 Thread Niel Drummond
angularjs also has a promise - http://docs.angularjs.org/api/ng.$q

I can vouch for using angularjs with clojurescript (it's much better than
using jquery in cljs), but haven't got as far as using this API item,
though I can't imagine that it would be that complicated.

- Niel


On Tue, Nov 27, 2012 at 2:53 AM, Frank Siebenlist 
frank.siebenl...@gmail.com wrote:

 I've been following the separate discussion-thread about your enhanced
 Promise effort, and it looks really cool and very useful.

 Having that also available (next week ;-) ) in clojurescript would be
 fantastic!

 -FS.


 On Nov 26, 2012, at 5:32 PM, Stuart Sierra the.stuart.sie...@gmail.com
 wrote:

  I've been working on a promises API with callbacks for Clojure (JVM):
  http://dev.clojure.org/display/design/Promises
 
  If I can get buy-in and support for implementing this as a
 language-level feature in Clojure, the obvious next step would be to port
 it to ClojureScript.
 
  -S
 

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

Starting a Clojure user group in Budapest

2012-11-27 Thread Balint Erdi
Hey,

I've grown extremely enthusiastic about Clojure (and still growing more and 
more :) ) and would like to spread the love around here in Budapest, 
Hungary.

This is to estimate how many people are interested in attending a monthly 
meetup where we'd have presentations, code dojos, etc, so please raise your 
hand if you are interested. Possibly also ask around at your 
workplace/friends so that I can get a fair estimate.

Thank you,
Balint

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

Re: a question for crate and hiccup

2012-11-27 Thread Dave Sann
I hadn't considered a need to generate html strings on the browser (at 
least, not for performance).  Do you have any references that demonstrate 
that it is faster to parse strings than generate dom elements directly with 
the js dom api. That seems counter-intuitive to me.

D

On Monday, 26 November 2012 01:51:30 UTC+11, Max Penet wrote:

 Strong +1

 This is a great idea. 
 This would allow more flexibility in some corner cases and 
 prevent unnecessary duplication, not to mention sharing. 
 Another example: I believe crate compiles templates using the DOM API, 
 which is often fine, but sometimes you'd want it to do this using raw 
 strings (when working with a large number of Elements), for performance 
 reason. This would help to solve such issues.

 Max


 On Sunday, November 25, 2012 12:11:09 PM UTC+1, Dave Sann wrote:

 I wonder if it would be worth making the effort to separate the hiccup 
 rendering from the hiccup generation in these libraries.

 By hiccup generation, I mean constructing data of the form [:tag {:attr 
 val} contents] ...
 By rendering, I mean
  in the case of hiccup - producing HTML strings
  in the case of crate - directly producing DOM nodes in the browser

 My thought is that this would give a generic set of hiccup data 
 generating functions that could be easily used across both libs with 
 rendering specific to the environment. 

 I don't generally use the libs in hiccup or crate because they are not 
 portable and slightly inconsistent in places - all my hiccup data 
 generation code can run on the server or on the browser. It might be good 
 to have a core unified set for both...

 thoughts?

 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

Re: ANN: clj-schema, Schemas For Clojure Maps

2012-11-27 Thread Stathis Sideris
Hello Alex,

This looks very useful, thanks. What's the license under which you are 
releasing this code? Also, I'm wondering whether something like that could 
be the next step for Typed Clojure. From Ambrose's thesis, I got the 
impression that he would like Typed Clojure to eventually cater for 
checking the contents of maps.

Thanks,

Stathis


On Sunday, 25 November 2012 23:22:04 UTC, Alex Baranosky wrote:

 Clj-schema is a library for defining and validating schemas for maps, as 
 well as for using those schemas to create valid test data.  We've been 
 using this in production for at least a few months now, at Runa.

 https://github.com/runa-dev/clj-schema

 The main benefits I've found from using this library are:
 * validating the inputs to the application: validating Ring request params 
 and config files
 * validating before storing maps into the DB
 * using the clj-schema.fixtures library to create valid test data that 
 stays valid.  So as the standard form of a map changes over time the tests 
 will stay in sync with those changes automatically.
 * there are some code-readability benefits as well - any developer can 
 pretty quickly see what certain kinds of maps tend to look like.

 There's more info in the README:
 https://github.com/runa-dev/clj-schema/blob/master/README.md

 Future possibilities:
 * auto-generating test data from clj-schema fixtures
 * being able to create schemas for sets and sequences (currently a schema 
 is always for a map)

 Contributors welcome.

 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

Re: Docs on standard protocols

2012-11-27 Thread Chas Emerick
Having a good Java IDE around (e.g. Eclipse or IntelliJ) certainly
helps, though not so much in developing a comprehensive mental model
of how everything fits together.

Some years ago, Chris Houser worked at building static visualizations
of the core Clojure interfaces and abstract implementations, and how
those fed into the concrete implementations of maps, seqs, etc. that
we use daily:

https://github.com/Chouser/clojure-classes/blob/master/graph-w-legend.png

I had similar objectives, but wanted to tie implementation details
(e.g. the Java interfaces that Clojure defined) together with related
functions, and the higher-level concepts that further related those
functions to others, etc.  Add in a dynamic visualization, and you get
Clojure Atlas:

http://www.clojureatlas.com

For example, here's the atlas focused on graph around
PersistentHashMap, the concrete implementation behind e.g. `{:a 1 :b 2}
`:


http://www.clojureatlas.com/org.clojure:clojure:1.4.0?guest=t#clojure.lang.PersistentHashMap

Cheers,

- Chas

On Nov 26, 5:53 pm, Dmitry Groshev lambdadmi...@gmail.com wrote:
 Is there any reference of standard protocols in which one can participate?
 When working with Java code and building bindings to complex Java classes,
 it's sometimes handy to define instances of Seq (for example) for them. But
 it's horribly troublesome to look up protocols in source code every time.
 Can you please point me to appropriate documentation, if such exists?

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

2012-11-27 Thread Gergely Nagy
Balint Erdi balint.e...@gmail.com writes:

 Hey,

 I've grown extremely enthusiastic about Clojure (and still growing more and 
 more :) ) and would like to spread the love around here in Budapest, 
 Hungary.

 This is to estimate how many people are interested in attending a monthly 
 meetup where we'd have presentations, code dojos, etc, so please raise your 
 hand if you are interested. Possibly also ask around at your 
 workplace/friends so that I can get a fair estimate.

I'd definitely be interested, and with a Clojure-related presentation
coming up at work in february, I'm hoping that a few more collegues will
become enlightened too.

-- 
|8]

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

2012-11-27 Thread Frank Failla
Thank you!


On Fri, Nov 23, 2012 at 3:04 PM, dmiller dmiller2...@gmail.com wrote:

 Frank:

 Fixed in the master branch (which is 1.5 dev).
 I also created a new branch named clojure-1.4.1 that is still a 1.4
 version, with the the patch.
 Also created binary distribution zip files for the new 1.4.1 release.
 Several other bug fixes included in this update.

 -David



 On Friday, November 16, 2012 8:46:01 AM UTC-6, ffailla wrote:

 Thank you David for looking into this so quickly.  For now I am working
 around this by not destructuring, but I look forward to the patch.  Thanks.

 -Frank

 On Thursday, November 15, 2012 7:41:39 PM UTC-5, dmiller wrote:

 The difference is that the JVM version is correct and the CLR
 implementation has a bug.

 I'll fix it in the current branch and try to get a patched 1.4 out as
 soon as I can.



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

JVM Language survey on InfoQ

2012-11-27 Thread Alex Miller
Using Clojure? Let people know here:

http://www.infoq.com/research/next-jvm-language

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

2012-11-27 Thread Sean Grove
I've been meaning to write a wrapper around the google closure async
primitives: 
https://groups.google.com/forum/#!msg/closure-library-discuss/aHjKn7K6O9Q/XmZSK54lc3cJ

Are there any reasons not to, or any libraries that have attempted it already?

On Tue, Nov 27, 2012 at 12:21 AM, Niel Drummond
niel.drumm...@grumpytoad.org wrote:
 angularjs also has a promise - http://docs.angularjs.org/api/ng.$q

 I can vouch for using angularjs with clojurescript (it's much better than
 using jquery in cljs), but haven't got as far as using this API item, though
 I can't imagine that it would be that complicated.

 - Niel


 On Tue, Nov 27, 2012 at 2:53 AM, Frank Siebenlist
 frank.siebenl...@gmail.com wrote:

 I've been following the separate discussion-thread about your enhanced
 Promise effort, and it looks really cool and very useful.

 Having that also available (next week ;-) ) in clojurescript would be
 fantastic!

 -FS.


 On Nov 26, 2012, at 5:32 PM, Stuart Sierra the.stuart.sie...@gmail.com
 wrote:

  I've been working on a promises API with callbacks for Clojure (JVM):
  http://dev.clojure.org/display/design/Promises
 
  If I can get buy-in and support for implementing this as a
  language-level feature in Clojure, the obvious next step would be to port 
  it
  to ClojureScript.
 
  -S
 

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

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

2012-11-27 Thread Frank Siebenlist
Thanks Max - I can see you have been busy with jayq lately… I'll check it out.

-FS.


On Nov 27, 2012, at 12:05 AM, Max Penet m...@qbits.cc wrote:

 jayq [1] now supports jQuery deferred API , there are 2 examples of its use 
 with these 2 macros: let-ajax and let-deferred (see the readme).  
 
 [1] https://github.com/ibdknox/jayq
 
 On Tuesday, November 27, 2012 12:51:22 AM UTC+1, FrankS wrote:
 All this call-back stuff drives me crazy in ClojureScriptJS… 
 
 Unfortunately we do not have a real cljs promise yet. 
 
 There seem to be javascript constructs that promise (pun intended) to do 
 similar things - jQuery has some deferred and promise things. 
 
 I have no experience with any of those javascript libs, and I cannot find any 
 example in ClojureScript that use those… 
 
 Any advise/suggestions/pointers/cljs-sample-code? 
 
 Thanks, FrankS. 
 

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

2012-11-27 Thread Cesar Pinera
I put together some notes and hints on how to share Clojure functions with
an Android app in Java for the Portland Clojure meetup.

https://github.com/cesarpinera/TargetAndroid

Clojure is hard on the device's resources, particularly memory. Also,
there's somethings that don't work terribly well with Dalvik, such as
concurrency. Still, it works. I would definitely not consider it for a real
world product, though.



On Mon, Nov 26, 2012 at 1:28 PM, John Gabriele jmg3...@gmail.com wrote:

 Hi,

 What is the current status of Clojure on Android? That is, for
 creating Android apps in Clojure.

 I found this http://dev.clojure.org/display/design/Android+Support ,
 but it appears to have been last-updated Feb 2011.

 What are currently the main limitations in creating and running
 Clojure programs on Android? (Does some limited subset of Clojure
 work? Does the bytecode that Clojure produces run on Dalvik?)

 Is it currently possible to write your Android app in Java but then
 call out to app code written in Clojure?

 Thanks!
 ---John

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

[ANN] modern-cljs - tutorial 8 and CLJS patch

2012-11-27 Thread Giacomo Cosenza
Hi all,
I just  published the 8th episode of my series of tutorials on clojurescript. 

https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-08.md

In this episode I patched the CLJS compiler to overcome the code duplication 
problem detected in the 7th tutorial. I extended CLJS options map by adding an 
:exclude compiler option that can be valorized as a vector of cljs source 
files/directories to be excluded from compilation. lein-cljsbuild still work 
without any intervention. 

Hope you find it useful 

My best

Mimmo

@david nolen: few days ago I sent the signed CA. Should I wait any confirmation 
to submit the patch to CLJS? 




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

2012-11-27 Thread John Gabriele
On Monday, November 26, 2012 9:14:07 PM UTC-5, Herwig Hochleitner wrote:

 2012/11/26 John Gabriele jmg...@gmail.com javascript:

 What are currently the main limitations in creating and running
 Clojure programs on Android? (Does some limited subset of Clojure
 work? Does the bytecode that Clojure produces run on Dalvik?)


 Clojure on Android is alive and well as far as I'm aware. I'm not 
 currently using it, but last time I checked, even eval, hence the REPL 
 worked. 
 Mr. Solano Gómez pulled that off by dexing the dex utility for use on 
 android.


Hm. I need to read up on what the dex is, and why one would want to dex it. 
:)
 

 Also: https://groups.google.com/forum/?fromgroups#!forum/clojure-android


Oooh, thanks. Did not know about that group.

---John
 

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

2012-11-27 Thread John Gabriele
On Tuesday, November 27, 2012 12:46:44 PM UTC-5, César Piñera wrote:

 I put together some notes and hints on how to share Clojure functions with 
 an Android app in Java for the Portland Clojure meetup. 

 https://github.com/cesarpinera/TargetAndroid

 This looks great. Thanks, César.
 

 Clojure is hard on the device's resources, particularly memory. Also, 
 there's somethings that don't work terribly well with Dalvik, such as 
 concurrency. Still, it works. I would definitely not consider it for a real 
 world product, though.

 I see. Thanks again for the info.

---John

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

Macro not being expanded?

2012-11-27 Thread Ben Wolfson
Sometimes I want to do the same thing for multiple classes of
exceptions without writing very similar catch clauses repeatedly, so I
wrote a macro:

(defmacro try*
  Exactly like try, except that catch statements can contain a
   sequence of exception-types which should all be handled in the same
   way. E.g.:

   (try* expr1 expr2
  (catch ArithmeticException a-exc ...)
  (catch [Exception AssertionError] e ...)
  (finally ...)
  [ exprs]
  (letfn [(is-multi-catch? [expr] (sequential? (second expr)))
  (expand-catches [expr] (map (fn [exn-type] (list* 'catch
exn-type (drop 2 expr))) (second expr)))
  (is-postlude? [expr] (and (list? expr) (#{'finally 'catch}
(first expr]
(let [[exprs postlude] (split-with (complement is-postlude?) exprs)
  [catches finally] (split-with (comp #{'catch} first) postlude)
  catches (mapcat #(if (is-multi-catch? %) (expand-catches %)
[%]) catches)]
 ;; kick errors down to core try
  `(try ~@exprs
~@catches
~@finally

This seems to work fine.

But it *doesn't* work inside a different macro:

user (defmacro g [ forms] `(try* ~@forms (catch [Exception
AssertionError] e# 6)))
#'user/g
user (g  2 3)
; Evaluation aborted
with the error: Unable to resolve classname: [java.lang.Exception
java.lang.AssertionError]

These macroexpansions are as expected:

user (macroexpand-1 '(g 2 3))
(user/try* 2 3 (catch [java.lang.Exception java.lang.AssertionError]
e__45530__auto__ 6))
user (macroexpand-1 '(user/try* 2 3 (catch [java.lang.Exception
java.lang.AssertionError] e__45530__auto__ 6)))
(try 2 3 (catch java.lang.Exception e__45530__auto__ 6) (catch
java.lang.AssertionError e__45530__auto__ 6))

But the second one here (the first is identical to the above) is not:

user (macroexpand-1 '(g 2 3))
(user/try* 2 3 (catch [java.lang.Exception java.lang.AssertionError]
e__45530__auto__ 6))
user (macroexpand-1 *1)
(try 2 3 (catch [java.lang.Exception java.lang.AssertionError]
e__45530__auto__ 6))

What's going on? Where'd my try* go?

-- 
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks,
which may be sweet, aromatic, fermented or spirit-based. ... Family
and social life also offer numerous other occasions to consume drinks
for pleasure. [Larousse, Drink entry]

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

2012-11-27 Thread Tero Parviainen
PPK has numbers for this from a few years 
ago: http://www.quirksmode.org/dom/innerhtml.html
A more recent benchmark: http://andrew.hedges.name/experiments/innerhtml/

There used to be a huge difference in favor of strings + innerHTML, but 
with recent browsers the situation seems to have evened out. 

I did a more or less direct port of Hiccup to ClojureScript last year, 
which also returns strings like the original: 
https://github.com/teropa/hiccups. I haven't really been maintaining it, 
though, so it might take some work to get it running with recent 
ClojureScript versions.


tiistai, 27. marraskuuta 2012 11.57.20 UTC+2 Dave Sann kirjoitti:

 I hadn't considered a need to generate html strings on the browser (at 
 least, not for performance).  Do you have any references that demonstrate 
 that it is faster to parse strings than generate dom elements directly with 
 the js dom api. That seems counter-intuitive to me.

 D

 On Monday, 26 November 2012 01:51:30 UTC+11, Max Penet wrote:

 Strong +1

 This is a great idea. 
 This would allow more flexibility in some corner cases and 
 prevent unnecessary duplication, not to mention sharing. 
 Another example: I believe crate compiles templates using the DOM API, 
 which is often fine, but sometimes you'd want it to do this using raw 
 strings (when working with a large number of Elements), for performance 
 reason. This would help to solve such issues.

 Max


 On Sunday, November 25, 2012 12:11:09 PM UTC+1, Dave Sann wrote:

 I wonder if it would be worth making the effort to separate the hiccup 
 rendering from the hiccup generation in these libraries.

 By hiccup generation, I mean constructing data of the form [:tag {:attr 
 val} contents] ...
 By rendering, I mean
  in the case of hiccup - producing HTML strings
  in the case of crate - directly producing DOM nodes in the browser

 My thought is that this would give a generic set of hiccup data 
 generating functions that could be easily used across both libs with 
 rendering specific to the environment. 

 I don't generally use the libs in hiccup or crate because they are not 
 portable and slightly inconsistent in places - all my hiccup data 
 generation code can run on the server or on the browser. It might be good 
 to have a core unified set for both...

 thoughts?

 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

Re: Current status of Clojure on Android?

2012-11-27 Thread Curtis Gagliardi
How do you use clojurescript on android?  SL4A?  How does it compare to a 
native app?  I'm looking to try to write an android app but want to avoid 
java, but it sounds like clojure isn't really ready for production on 
android.

On Monday, November 26, 2012 8:14:07 PM UTC-6, Herwig Hochleitner wrote:

 2012/11/26 John Gabriele jmg...@gmail.com javascript:

 What are currently the main limitations in creating and running
 Clojure programs on Android? (Does some limited subset of Clojure
 work? Does the bytecode that Clojure produces run on Dalvik?)


 Clojure on Android is alive and well as far as I'm aware. I'm not 
 currently using it, but last time I checked, even eval, hence the REPL 
 worked. 
 Mr. Solano Gómez pulled that off by dexing the dex utility for use on 
 android.

 The main drawback is startup time, which is a couple of seconds on my 
 Galaxy Nexus.

 Therefore, and because of portability, I write my current android project 
 in ClojureScript.
  

 Is it currently possible to write your Android app in Java but then
 call out to app code written in Clojure?


 Same as with Clojure on the JVM. Google's work to making Dalvik compliant 
 really pays off. 

 Also: https://groups.google.com/forum/?fromgroups#!forum/clojure-android
  

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

Clojurescript tests not including non-test source-path

2012-11-27 Thread Sean Grove
I've been trying to create a simple project with CLJS source and CLJS
tests using lein-cljsbuild 0.2.9, but it doesn't seem to be able to
pick up on the cljs source.

How can I get the clojurescript tests to compile/run and include the
actual project source?

The output from running `lein clean  lein cljsbuild test`, the
project.clj, and the relevant cljs files are all here:
https://gist.github.com/31613f73e92212e161bb

The repo structure is:

/
|-src
|- -/clj
|- -/cljs
|-  |-main.cljs
|-test
|- - test.cljs
|- -/zenbox
|-  |-test/
|-|-main.cljs

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

2012-11-27 Thread David Nolen
I think you need to make sure that the cljs files are also on the Lein 2
:source-paths

David


On Tue, Nov 27, 2012 at 12:50 PM, Sean Grove s...@cloudfuji.com wrote:

 I've been trying to create a simple project with CLJS source and CLJS
 tests using lein-cljsbuild 0.2.9, but it doesn't seem to be able to
 pick up on the cljs source.

 How can I get the clojurescript tests to compile/run and include the
 actual project source?

 The output from running `lein clean  lein cljsbuild test`, the
 project.clj, and the relevant cljs files are all here:
 https://gist.github.com/31613f73e92212e161bb

 The repo structure is:

 /
 |-src
 |- -/clj
 |- -/cljs
 |-  |-main.cljs
 |-test
 |- - test.cljs
 |- -/zenbox
 |-  |-test/
 |-|-main.cljs

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

Re: Current status of Clojure on Android?

2012-11-27 Thread Paul deGrandis
Curtis,

I have successful built a ClojureScript app that uses SL4A (Rhino).  The 
startup time is an issue, the performance isn't great but is acceptable.  
If you're just prototyping something or need a tool for in-house use - this 
is one alternative.
Given the work and efforts that Cesar highlighted, you might be better off 
with straight Clojure.

Depending on the requirements of your app, you might also consider an HTML5 
client-side application, and rely upon CSS functionality for graphical 
support.  This would free you from Java, enable you to use ClojureScript, 
and comes with a lot of tooling support (and flexibility).

Regards,
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

Re: Clojurescript tests not including non-test source-path

2012-11-27 Thread Sean Grove
Thanks for the tip!

Sadly, doesn't seem to make any difference - here's the updated
project.clj and the (same) output:
https://gist.github.com/c159e76e559f407287ce

SEVERE: 
/Users/sgrove/code/clojure/zenbox/.lein-cljsbuild-compiler-1/zenbox/test/main.js:3:
ERROR - required zenbox.main namespace never provided
goog.require('zenbox.main');
^

zenbox.main is defined in src/cljs/main.cljs:

(ns zenbox.main
  (:require [domina :as domina]
[domina.css :as dcss]
[goog.events :as ge]
[goog.ui.Component.State]
[goog.Disposable]
[goog.ui.Menu]
[goog.ui.MenuButton]
[goog.ui.MenuItem]
[goog.ui.MenuSeparator]
[goog.ui.PopupMenu]
[goog.dom :as gd]
[goog.dom.DomHelper :as gdh]
[goog.positioning :as gp]
[zenbox.events :as ze]
[zenbox.dom :as zd]
[zenbox.profile-data :as data]
[zenbox.templates :as templates]
[zenbox.widget.user-profile :as zup]))

Any other ideas?

On Tue, Nov 27, 2012 at 11:24 AM, David Nolen dnolen.li...@gmail.com wrote:
 I think you need to make sure that the cljs files are also on the Lein 2
 :source-paths

 David


 On Tue, Nov 27, 2012 at 12:50 PM, Sean Grove s...@cloudfuji.com wrote:

 I've been trying to create a simple project with CLJS source and CLJS
 tests using lein-cljsbuild 0.2.9, but it doesn't seem to be able to
 pick up on the cljs source.

 How can I get the clojurescript tests to compile/run and include the
 actual project source?

 The output from running `lein clean  lein cljsbuild test`, the
 project.clj, and the relevant cljs files are all here:
 https://gist.github.com/31613f73e92212e161bb

 The repo structure is:

 /
 |-src
 |- -/clj
 |- -/cljs
 |-  |-main.cljs
 |-test
 |- - test.cljs
 |- -/zenbox
 |-  |-test/
 |-|-main.cljs

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

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


ClojureScript One Architecture

2012-11-27 Thread Duraid
Hi,

I really like the design decisions taken by ClojureScript One and I would 
like use them to build applications at work.

Unfortunately it is not possible to use clojure at work but I'm think of 
using a similar approach with javascript.

In your knowledge what is the javascript framework that is similar to 
ClojureScript One? Backbone, Angular,.. etc?

Is there a library that I can use to perform dispatch/fire/watch?

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

Re: Clojurescript tests not including non-test source-path

2012-11-27 Thread David Nolen
Not really, take a look at core.logic's project.clj and try to determine
what's wrong.

On Tuesday, November 27, 2012, Sean Grove wrote:

 Thanks for the tip!

 Sadly, doesn't seem to make any difference - here's the updated
 project.clj and the (same) output:
 https://gist.github.com/c159e76e559f407287ce

 SEVERE:
 /Users/sgrove/code/clojure/zenbox/.lein-cljsbuild-compiler-1/zenbox/test/main.js:3:
 ERROR - required zenbox.main namespace never provided
 goog.require('zenbox.main');
 ^

 zenbox.main is defined in src/cljs/main.cljs:

 (ns zenbox.main
   (:require [domina :as domina]
 [domina.css :as dcss]
 [goog.events :as ge]
 [goog.ui.Component.State]
 [goog.Disposable]
 [goog.ui.Menu]
 [goog.ui.MenuButton]
 [goog.ui.MenuItem]
 [goog.ui.MenuSeparator]
 [goog.ui.PopupMenu]
 [goog.dom :as gd]
 [goog.dom.DomHelper :as gdh]
 [goog.positioning :as gp]
 [zenbox.events :as ze]
 [zenbox.dom :as zd]
 [zenbox.profile-data :as data]
 [zenbox.templates :as templates]
 [zenbox.widget.user-profile :as zup]))

 Any other ideas?

 On Tue, Nov 27, 2012 at 11:24 AM, David Nolen 
 dnolen.li...@gmail.comjavascript:;
 wrote:
  I think you need to make sure that the cljs files are also on the Lein 2
  :source-paths
 
  David
 
 
  On Tue, Nov 27, 2012 at 12:50 PM, Sean Grove 
  s...@cloudfuji.comjavascript:;
 wrote:
 
  I've been trying to create a simple project with CLJS source and CLJS
  tests using lein-cljsbuild 0.2.9, but it doesn't seem to be able to
  pick up on the cljs source.
 
  How can I get the clojurescript tests to compile/run and include the
  actual project source?
 
  The output from running `lein clean  lein cljsbuild test`, the
  project.clj, and the relevant cljs files are all here:
  https://gist.github.com/31613f73e92212e161bb
 
  The repo structure is:
 
  /
  |-src
  |- -/clj
  |- -/cljs
  |-  |-main.cljs
  |-test
  |- - test.cljs
  |- -/zenbox
  |-  |-test/
  |-|-main.cljs
 
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@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+unsubscr...@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 post to this group, send email to clojure@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+unsubscr...@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 post to this group, send email to clojure@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+unsubscr...@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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: [ANN] modern-cljs - tutorial 8 and CLJS patch

2012-11-27 Thread Michael Klishin
2012/11/27 Giacomo Cosenza mimmo.cose...@gmail.com

 Hope you find it useful


Giacomo,

This is fantastic. I think this may be the most valuable source of
information about CLJS
on the Web.

We will figure out a way to add ClojureScript content to
http://clojure-doc.org, this has to be easier
to discover.
-- 
MK

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

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

Re: [ANN] modern-cljs - tutorial 8 and CLJS patch

2012-11-27 Thread Wes Freeman
On Tue, Nov 27, 2012 at 3:09 PM, Michael Klishin 
michael.s.klis...@gmail.com wrote:

 This is fantastic. I think this may be the most valuable source of
 information about CLJS
 on the Web.

 We will figure out a way to add ClojureScript content to
 http://clojure-doc.org, this has to be easier
 to discover.


+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

[cljs] Implement transport for a REPL

2012-11-27 Thread Krukow
Hi,
I have a special non-browser environment which doesn't support a 
ClojureScript REPL at the moment. 

I was wondering if someone has any insight into how much work it would be 
to create an equivalent of the browser-connected repl for a new 
environment. That is, I'd like a repl running in the command line, reading, 
js-compiling, and (via some mechanism) sends JS to the other environment, 
evaluates the JS in the env and prints the response.

I don't have any experience building such a thing, but my (perhaps naive) 
hope would be that if only I can provide the transport mechanism to/from 
the environment, most of the additional work could be stolen from what has 
already been built?

Cheers,
- Karl

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

2012-11-27 Thread Walter van der Laan
It is possible to execute forms in a debugging context but AFAIK there is 
no easy setup that allows you to step through the execution.

The easiest way to evaluate forms in context is to setup emacs as described 
here http://clojure-doc.org/articles/tutorials/emacs.html. This will allow 
you to set breakpoints by inserting (swank.core/break) as described here 
http://hugoduncan.org/post/2010/swank_clojure_gets_a_break_with_the_local_environment.xhtml.
 
This slime/swank setup is robust and well documented.

nrepl-ritz offers a new way to set up emacs with a debugger. It has just 
been introduced by Hugo Duncan in the Clojure/conj and it works well for 
me. It is described here https://github.com/pallet/ritz/tree/develop/nrepl. 
It brings some functionality that is not available through slime/swank but 
it is not as complete and battle tested. To me the biggest benefit of this 
new setup is the ability to examine the stacktrace on exceptions. It allows 
you to inspect values and evaluate expressions at any point in the 
stacktrace. I find this to be helpful not only for my own errors but also 
for compiler errors because you can often find the expression that the 
compiler is complaining about somewhere in the stacktrace.

Stepping through the execution is harder to setup but it might be possible. 
The CDT debugger can be set up as described here 
http://georgejahad.com/clojure/swank-cdt.html. It worked great for me at 
some point but I'm no longer using it because doesn't work with openjdk 
AFAIK,


On Monday, November 26, 2012 11:15:44 PM UTC+1, Sol Tourne wrote:


  In your list, the only thing you won't be able to do with Eclipse is 
 executing clojure forms in the context of the breakpoint. 

 Thanks, that's very useful info. 

 Is that doable in emacs? (ie 'executing clojure forms in the context of 
 the breakpoint'.) The answers so far emphasize emacs' customisability 
 (which is great) but say nothing about stepping through the execution with 
 a debugger -- is that something that's not doable with emacs?

 Generally, thanks everyone for all the advice!

  

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

2012-11-27 Thread David Nolen
It's definitely possible. I've been to meaning to merge some experimental
work I've done creating a Node.js ClojureScript REPL in hopes that some one
would be willing to take it further.

David


On Tue, Nov 27, 2012 at 4:22 PM, Krukow karl.kru...@gmail.com wrote:

 Hi,
 I have a special non-browser environment which doesn't support a
 ClojureScript REPL at the moment.

 I was wondering if someone has any insight into how much work it would be
 to create an equivalent of the browser-connected repl for a new
 environment. That is, I'd like a repl running in the command line, reading,
 js-compiling, and (via some mechanism) sends JS to the other environment,
 evaluates the JS in the env and prints the response.

 I don't have any experience building such a thing, but my (perhaps naive)
 hope would be that if only I can provide the transport mechanism to/from
 the environment, most of the additional work could be stolen from what has
 already been built?

 Cheers,
 - Karl

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

Re: [cljs] Implement transport for a REPL

2012-11-27 Thread Karl Krukow
Great! Thanks for your quick reply (again).

I'd certainly love to look at it if you can provide a link.

What do you think about the possibility of creating some protocol for the 
transport needed for a connected repl?

- Karl

On 27/11/2012, at 22.32, David Nolen wrote:

 It's definitely possible. I've been to meaning to merge some experimental 
 work I've done creating a Node.js ClojureScript REPL in hopes that some one 
 would be willing to take it further.
 
 David
 
 
 On Tue, Nov 27, 2012 at 4:22 PM, Krukow karl.kru...@gmail.com wrote:
 Hi,
 I have a special non-browser environment which doesn't support a 
 ClojureScript REPL at the moment. 
 
 I was wondering if someone has any insight into how much work it would be to 
 create an equivalent of the browser-connected repl for a new environment. 
 That is, I'd like a repl running in the command line, reading, js-compiling, 
 and (via some mechanism) sends JS to the other environment, evaluates the JS 
 in the env and prints the response.
 
 I don't have any experience building such a thing, but my (perhaps naive) 
 hope would be that if only I can provide the transport mechanism to/from the 
 environment, most of the additional work could be stolen from what has 
 already been built?
 
 Cheers,
 - Karl
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group 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

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

2012-11-27 Thread Frank Siebenlist
Pls take a look at Bodil's recent project:

https://github.com/bodil/cljs-noderepl

-FS.


On Nov 27, 2012, at 1:32 PM, David Nolen dnolen.li...@gmail.com wrote:

 It's definitely possible. I've been to meaning to merge some experimental 
 work I've done creating a Node.js ClojureScript REPL in hopes that some one 
 would be willing to take it further.
 
 David
 
 
 On Tue, Nov 27, 2012 at 4:22 PM, Krukow karl.kru...@gmail.com wrote:
 Hi,
 I have a special non-browser environment which doesn't support a 
 ClojureScript REPL at the moment. 
 
 I was wondering if someone has any insight into how much work it would be to 
 create an equivalent of the browser-connected repl for a new environment. 
 That is, I'd like a repl running in the command line, reading, js-compiling, 
 and (via some mechanism) sends JS to the other environment, evaluates the JS 
 in the env and prints the response.
 
 I don't have any experience building such a thing, but my (perhaps naive) 
 hope would be that if only I can provide the transport mechanism to/from the 
 environment, most of the additional work could be stolen from what has 
 already been built?
 
 Cheers,
 - Karl
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group 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

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

2012-11-27 Thread Karl Krukow
Yes! Thank you for that link :)

On 27/11/2012, at 22.44, Frank Siebenlist wrote:

 Pls take a look at Bodil's recent project:
 
 https://github.com/bodil/cljs-noderepl
 
 -FS.
 
 
 On Nov 27, 2012, at 1:32 PM, David Nolen dnolen.li...@gmail.com wrote:
 
 It's definitely possible. I've been to meaning to merge some experimental 
 work I've done creating a Node.js ClojureScript REPL in hopes that some one 
 would be willing to take it further.
 
 David
 
 
 On Tue, Nov 27, 2012 at 4:22 PM, Krukow karl.kru...@gmail.com wrote:
 Hi,
 I have a special non-browser environment which doesn't support a 
 ClojureScript REPL at the moment. 
 
 I was wondering if someone has any insight into how much work it would be to 
 create an equivalent of the browser-connected repl for a new environment. 
 That is, I'd like a repl running in the command line, reading, js-compiling, 
 and (via some mechanism) sends JS to the other environment, evaluates the JS 
 in the env and prints the response.
 
 I don't have any experience building such a thing, but my (perhaps naive) 
 hope would be that if only I can provide the transport mechanism to/from the 
 environment, most of the additional work could be stolen from what has 
 already been built?
 
 Cheers,
 - Karl
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group 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
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group 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


Re: [cljs] Implement transport for a REPL

2012-11-27 Thread David Nolen
Looks much better than my attempt :)


On Tue, Nov 27, 2012 at 4:58 PM, Karl Krukow karl.kru...@gmail.com wrote:

 Yes! Thank you for that link :)

 On 27/11/2012, at 22.44, Frank Siebenlist wrote:

  Pls take a look at Bodil's recent project:
 
  https://github.com/bodil/cljs-noderepl
 
  -FS.
 
 
  On Nov 27, 2012, at 1:32 PM, David Nolen dnolen.li...@gmail.com wrote:
 
  It's definitely possible. I've been to meaning to merge some
 experimental work I've done creating a Node.js ClojureScript REPL in hopes
 that some one would be willing to take it further.
 
  David
 
 
  On Tue, Nov 27, 2012 at 4:22 PM, Krukow karl.kru...@gmail.com wrote:
  Hi,
  I have a special non-browser environment which doesn't support a
 ClojureScript REPL at the moment.
 
  I was wondering if someone has any insight into how much work it would
 be to create an equivalent of the browser-connected repl for a new
 environment. That is, I'd like a repl running in the command line, reading,
 js-compiling, and (via some mechanism) sends JS to the other environment,
 evaluates the JS in the env and prints the response.
 
  I don't have any experience building such a thing, but my (perhaps
 naive) hope would be that if only I can provide the transport mechanism
 to/from the environment, most of the additional work could be stolen from
 what has already been built?
 
  Cheers,
  - Karl
 
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with
 your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group 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
 
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with
 your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group 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


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

2012-11-27 Thread Yves Parès
Did you look at what vimclojure (+ nailgun server + lein vimclojure plugin) 
currently provides? It doesn't use nrepl yet, but I'd be curious to know 
how its features relate to emacs' clojure plugins, and also how their 
features may be valuable when it comes to working with noir/compojure/ring.
The thing is that thanks to ring's automatic code reload middleware, I 
never felt the need to have a tight integration between the editor and the 
REPL, but as I've been doing Clojure for only 3 months I may be missing 
something.
(I'm also a vimmer considering to start off learning Emacs.)


Le lundi 26 novembre 2012 13:45:19 UTC+1, jaju a écrit :

 On Sun, Nov 25, 2012 at 11:08 PM, Laurent PETIT 
 lauren...@gmail.comjavascript:
  wrote:

 My advice: don't try to learn too much at once. Eclipse+counterclockwise 
 (and probably Intellij+La Clojure) lets you start right away hacking 
 clojure. They are specifically designed to be newbie friendly   Postpone 
 the decision of  becoming an emacs ninja to when you feel ok with clojure 
 and you feel that you lack customization power (if ever).


 Not to take away anything from any other IDE/editor, but I started off on 
 emacs (thanks to Baishampayan) and it's the most natural environment (along 
 with slime/nrepl/ritz++) for clojure! I've been a vimmer all my life, and 
 it's still the best editor to me, but emacs is another world. And learning 
 clojure meant I could easily personalize my emacs config since I had then 
 become a *lot* more comfortable with elisp too - something that stopped 
 me from exploring emacs in my pre-clojure years.

 You won't need to be a ninja, but spending a couple of days with someone 
 who has a good emacs setup and is willing to pair/teach will help you tide 
 over almost anything.

 -- 
 jaju

  


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

2012-11-27 Thread Frederik De Bleser
I had some trouble because all goals need to take in the list of lvars. 
`infd` doesn't take in a list, but your sudoku blog post has `all-infd` 
which does the trick:

(defn all-infd 
  Assign a domain to all vars.
  [vars domain]
  (if (seq vars)
(all
  (domfd (first vars) domain)
  (all-infd (next vars) domain))
succeed))

Which means that `distinct-numbers` can be written as such:

(defn distinct-numbers [n min max]
  Generate all combinations of n numbers between min and max.
  (run* [q]
(let [vars (repeatedly n lvar)]
  (all
(all-infd vars (interval min max))
(distinctfd vars)
(== q vars)


user= (distinct-numbers 3 6 8)
((6 7 8) (6 8 7) (7 6 8) (7 8 6) (8 6 7) (8 7 6))

Thanks for the help!

Frederik




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

2012-11-27 Thread David Nolen
Yep infd's api is a bit annoying - I'd like to change it to match
distinctfd.

David


On Tue, Nov 27, 2012 at 5:57 PM, Frederik De Bleser
frede...@burocrazy.comwrote:

 I had some trouble because all goals need to take in the list of lvars.
 `infd` doesn't take in a list, but your sudoku blog post has `all-infd`
 which does the trick:

 (defn all-infd
   Assign a domain to all vars.
   [vars domain]
   (if (seq vars)
 (all
   (domfd (first vars) domain)
   (all-infd (next vars) domain))
 succeed))

 Which means that `distinct-numbers` can be written as such:

 (defn distinct-numbers [n min max]
   Generate all combinations of n numbers between min and max.
   (run* [q]
 (let [vars (repeatedly n lvar)]
   (all
 (all-infd vars (interval min max))
 (distinctfd vars)
 (== q vars)


 user= (distinct-numbers 3 6 8)
 ((6 7 8) (6 8 7) (7 6 8) (7 8 6) (8 6 7) (8 7 6))

 Thanks for the help!

 Frederik


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

Re: help choosing dev environment for clojure

2012-11-27 Thread Phil Hagelberg
On Tue, Nov 27, 2012 at 1:30 PM, Walter van der Laan
waltervanderl...@gmail.com wrote:
 Stepping through the execution is harder to setup but it might be possible.
 The CDT debugger can be set up as described here
 http://georgejahad.com/clojure/swank-cdt.html. It worked great for me at
 some point but I'm no longer using it because doesn't work with openjdk

Swank Clojure is no longer under active development, but for what it's
worth it has never had any incompatibility issues with OpenJDK.

-Phil

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


Re: JVM Language survey on InfoQ

2012-11-27 Thread Timothy Washington
Cool. I just voted. And from the looks of it, Clojure is tracking very
well.

Total number of participants: *432*Option Adoption% of Code in New Language
Votes DetailsScala78%72% 253Heatmap
http://www.infoq.com/research/next-jvm-language#
Clojure78%76% 230Heatmap
http://www.infoq.com/research/next-jvm-language# Java
855%60%193 Heatmap  http://www.infoq.com/research/next-jvm-language#
Groovy76%66% 152Heatmap  http://www.infoq.com/research/next-jvm-language#
JavaScript82%71%149 Heatmap http://www.infoq.com/research/next-jvm-language#
JRuby76%66% 97Heatmap  http://www.infoq.com/research/next-jvm-language#
Erlang64%62%65 Heatmap  http://www.infoq.com/research/next-jvm-language#
. ..

Tim Washington
Interruptsoftware.ca


*Today a young man on acid realized that all matter is merely energy
condensed to a slow vibration, that we are all one consciousness
experiencing itself subjectively, there is no such thing as death, life is
only a dream, and we are the imagination of ourselves. Here's Tom with the
Weather.* -- Bill Hicks



On Tue, Nov 27, 2012 at 10:38 AM, Alex Miller a...@puredanger.com wrote:

 Using Clojure? Let people know here:

 http://www.infoq.com/research/next-jvm-language



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

Defining comparison functions for complex data types

2012-11-27 Thread Mark
A long time ago, I wrote this simple heap implementation:

https://gist.github.com/4158634

There are a lot of rough edges here. Many of them could be cleaned up (ie, 
replaced with standard library functions) if I could rely on the contents 
of the heap being trivially comparable using  and  methods. However, I'd 
like to be able to put complex data types into my heap, so I need to be 
able to supply comparison logic, potentially even for functions (like 
min-key) that don't allow me to explicitly provide one.

I have the sense that this sort of thing is possible using deftype, 
defrecord, multimethods, or protocols, but I'm having a hard time figuring 
out where to start my education on these topics - there's a lot to know 
about all of this stuff.

Can anyone suggest a place where I can get started?

Thanks!

Mark

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

2012-11-27 Thread Stephen Compall
On Tue, 2012-11-27 at 10:34 -0800, Ben Wolfson wrote:
 What's going on? Where'd my try* go?

try* isn't general enough to accept some macroexpansions, because list?
is not the predicate you want.

repl (- (macroexpand-1 '(g 2 3)) (drop 3) first)
(catch [java.lang.Exception java.lang.AssertionError] e__902__auto__ 6)
repl (list? *1)
false
repl (list? '(catch [java.lang.Exception java.lang.AssertionError] 
e__902__auto__ 6))
true
repl (- (macroexpand-1 '(g 2 3)) (drop 3) first class)
clojure.lang.Cons

quasiquote tends to produce conses.  Compare seq?, sequential?, and
incubator's seqable? to find the predicate you want.

-- 
Stephen Compall
^aCollection allSatisfy: [:each | aCondition]: less is better than


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

2012-11-27 Thread Ben Wolfson
ah, ok. thanks.

On Tue, Nov 27, 2012 at 7:03 PM, Stephen Compall
stephen.comp...@gmail.com wrote:
 On Tue, 2012-11-27 at 10:34 -0800, Ben Wolfson wrote:
 What's going on? Where'd my try* go?

 try* isn't general enough to accept some macroexpansions, because list?
 is not the predicate you want.

 repl (- (macroexpand-1 '(g 2 3)) (drop 3) first)
 (catch [java.lang.Exception java.lang.AssertionError] e__902__auto__ 6)
 repl (list? *1)
 false
 repl (list? '(catch [java.lang.Exception java.lang.AssertionError] 
 e__902__auto__ 6))
 true
 repl (- (macroexpand-1 '(g 2 3)) (drop 3) first class)
 clojure.lang.Cons

 quasiquote tends to produce conses.  Compare seq?, sequential?, and
 incubator's seqable? to find the predicate you want.

 --
 Stephen Compall
 ^aCollection allSatisfy: [:each | aCondition]: less is better than


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



-- 
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks,
which may be sweet, aromatic, fermented or spirit-based. ... Family
and social life also offer numerous other occasions to consume drinks
for pleasure. [Larousse, Drink entry]

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

2012-11-27 Thread Alex Baranosky
Hi Stathis,

Thanks for your interestin clj-schema. If you use it and have any feedback
please let me know.

clj-schema is released under the MIT license: http://mit-license.org/

I think TypedClojure is really cool. I'm excited about both approaches
because in general I'm very interested in approaches to coding that help us
ensure that our code works correctly. That said there are some interesting
differences in the approaches:

   - schemas can be used for other things other than validation or type
   checking.


   - schemas are more decoupled from the code.  Say you are reading a map
   out of a file, or get a map returned from another library.  With schemas
   you could easily validate the map.  How would that be handled in a
   TypeClojure approach?  Also, schema validation only checks at a snapshot in
   time; it makes no effort to ensure that that map is always correct.


   - schema validation happens at run-time; TypedClojure is a static
   analysis tool. ( Of course, if there was some kind of adapter for
   TypedClojure it could take schemas as params to the type declarations.)


Alex

On Tue, Nov 27, 2012 at 2:23 AM, Stathis Sideris side...@gmail.com wrote:

 Hello Alex,

 This looks very useful, thanks. What's the license under which you are
 releasing this code? Also, I'm wondering whether something like that could
 be the next step for Typed Clojure. From Ambrose's thesis, I got the
 impression that he would like Typed Clojure to eventually cater for
 checking the contents of maps.

 Thanks,

 Stathis


 On Sunday, 25 November 2012 23:22:04 UTC, Alex Baranosky wrote:

 Clj-schema is a library for defining and validating schemas for maps, as
 well as for using those schemas to create valid test data.  We've been
 using this in production for at least a few months now, at Runa.

 https://github.com/runa-dev/**clj-schemahttps://github.com/runa-dev/clj-schema

 The main benefits I've found from using this library are:
 * validating the inputs to the application: validating Ring request
 params and config files
 * validating before storing maps into the DB
 * using the clj-schema.fixtures library to create valid test data that
 stays valid.  So as the standard form of a map changes over time the tests
 will stay in sync with those changes automatically.
 * there are some code-readability benefits as well - any developer can
 pretty quickly see what certain kinds of maps tend to look like.

 There's more info in the README:
 https://github.com/runa-dev/**clj-schema/blob/master/README.**mdhttps://github.com/runa-dev/clj-schema/blob/master/README.md

 Future possibilities:
 * auto-generating test data from clj-schema fixtures
 * being able to create schemas for sets and sequences (currently a schema
 is always for a map)

 Contributors welcome.

 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Clojure Recursion (loop-recur) Questions

2012-11-27 Thread Curtis
Thank you Andy - This was fabulously helpful - I really appreciate 
your explanation.

Would you permit me to include your answer in a blog post about the above 
question?



On Monday, November 19, 2012 6:25:30 PM UTC-8, Andy Fingerhut wrote:

 If you are familiar with tail recursion, then loop/recur this is Clojure's 
 way to achieve tail recursion.

 http://en.wikipedia.org/wiki/Tail_call

 The general tail call optimization mechanism as implemented in the 
 programming language Scheme, for example, means that tail-position calls 
 must not consume additional stack, and must effectively work like a goto 
 appropriate muddling of stack frames to pass the parameters to the new 
 function (which might be a recursive call, or could be to a different 
 function).  Whether the tail call is recursive or not, the return address 
 of the original calling function doesn't change after the goto.

 Clojure's loop/recur only implements tail recursion, not general tail-call 
 optimization.  tail recursion is far more commonly used in languages that 
 have it than the general tail-call optimization to arbitrary functions.


 Specifically on your questions about the return address, suppose function 
 foo calls function bar, and bar has the loop/recur inside of it.  At the 
 time when foo first calls bar, it saves a return address inside of foo so 
 that when bar returns, it continues in foo just after where the call to bar 
 was.

 loop/recur never touches that return address.   It stays there the whole 
 time.

 The loop is effectively a target label for a goto, and one or more 
 occurrences of recur inside of it simply rebind the loop variable values, 
 and goot the loop's target label.  Anything deeper down on the stack is not 
 changed, and there is no pushing or popping of any return addresses.  Just 
 a goto.


 Rich would have liked to implement general tail recursion in Clojure. 
  Here are a couple of relevant excerpts from Rich Hickey's Clojure for 
 Lispers talk, transcript here:


 http://jafingerhut.github.com/clojure-info/clojure-for-lispers-transcript.txt

 Clojure does not have tail call optimization.  Not because I'm against
 it.  I'm all for it.  It's something I had to trade off in being on
 the JVM.  However, I was just at the JVM languages summit, and tail
 call optimization, every language designer who cam up there said tail
 call optimization, tail call optimization.  And they've heard it, and
 hopefully it will come in a future VM, hopefully soon.

 You've seen
 languages... SISC Scheme does tail calls in the JVM, right.  It does
 it with this whole other infrastructure.  They're calling scheme is
 nothing like Java's, right?  You have to pass additional things, or
 trampoline, or whatever.  Clojure does none of that.  Clojure has
 pedal to the metal calling conventions that match Java's, so I don't
 have tail recursion, because you can't do that unless the JVM does
 that.

 Andy



 On Nov 19, 2012, at 4:38 PM, Curtis wrote:

 Clojure Koans - Recursion

 (defn recursive-reverse [coll]
   (loop [coll coll
  acc '() ]
  (if (= (count coll) 0)
 acc
(recur (rest coll) (cons (first coll) acc))
  )
   )
 )

 I struggled with this one for a while - I don’t want to admit it, but 
 honestly even though i have been coding since I was 16 years old - there 
 are still many areas where I am rusty or weak.

 There is actually a surprising amount of low level concepts operating in a 
 list recursive reverse in clojure.

- tail-call recursion
- accumulator
- loop construct

 I have some questions about how this “special form”  
 loophttp://clojure.org/special_forms#Special%20Forms--(loop%20%5Bbindings*%20%5D%20exprs*)
  operates 
 with recurhttp://clojure.org/special_forms#Special%20Forms--(recur%20exprs*)

 I think I need to make sure that I always remember the following :

- the arity of the recur call must match the arity of the loop form
- recur must be in the tail position.

 I’m not sure how this loop / recur mechanism is implemented in the JVM - I 
 imaging that the binding created by ‘loop’ is associated with registers 
 that are overwritten as part of the call to ‘recur’. The documentation says 
 the bindings are rebound on call of recur in parallel and the execution of 
 recur - is done in order.

 My questions are

- Is recur causing some kind of local jump after each binding?
- What happens with the return address? 
- If recur doesn’t consume stack - what is going on with the return 
address? 
- Is the return address always the same for the same recursive call?

 More importantly - Is there a chapter in Knuth AOC that could help me with 
 this? Any other resources?  

 I feel like I am really missing some context. Am I missing anything 
 obvious, important or insightful?



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

Re: Clojure Recursion (loop-recur) Questions

2012-11-27 Thread Ben Mabey

On 11/27/12 9:17 PM, Curtis wrote:
Thank you Andy - This was fabulously helpful - I really appreciate 
your explanation.


Would you permit me to include your answer in a blog post about the 
above question?




On Monday, November 19, 2012 6:25:30 PM UTC-8, Andy Fingerhut wrote:

If you are familiar with tail recursion, then loop/recur this is
Clojure's way to achieve tail recursion.

http://en.wikipedia.org/wiki/Tail_call
http://en.wikipedia.org/wiki/Tail_call

The general tail call optimization mechanism as implemented in the
programming language Scheme, for example, means that tail-position
calls must not consume additional stack, and must effectively work
like a goto appropriate muddling of stack frames to pass the
parameters to the new function (which might be a recursive call,
or could be to a different function).  Whether the tail call is
recursive or not, the return address of the original calling
function doesn't change after the goto.

Clojure's loop/recur only implements tail recursion, not general
tail-call optimization.  tail recursion is far more commonly used
in languages that have it than the general tail-call optimization
to arbitrary functions.


Specifically on your questions about the return address, suppose
function foo calls function bar, and bar has the loop/recur inside
of it.  At the time when foo first calls bar, it saves a return
address inside of foo so that when bar returns, it continues in
foo just after where the call to bar was.

loop/recur never touches that return address.   It stays there the
whole time.

The loop is effectively a target label for a goto, and one or more
occurrences of recur inside of it simply rebind the loop variable
values, and goot the loop's target label.  Anything deeper down on
the stack is not changed, and there is no pushing or popping of
any return addresses.  Just a goto.


Rich would have liked to implement general tail recursion in
Clojure.  Here are a couple of relevant excerpts from Rich
Hickey's Clojure for Lispers talk, transcript here:


http://jafingerhut.github.com/clojure-info/clojure-for-lispers-transcript.txt

http://jafingerhut.github.com/clojure-info/clojure-for-lispers-transcript.txt

Clojure does not have tail call optimization.  Not because I'm against
it.  I'm all for it.  It's something I had to trade off in being on
the JVM.  However, I was just at the JVM languages summit, and tail
call optimization, every language designer who cam up there said tail
call optimization, tail call optimization.  And they've heard it, and
hopefully it will come in a future VM, hopefully soon.

You've seen
languages... SISC Scheme does tail calls in the JVM, right.  It does
it with this whole other infrastructure.  They're calling scheme is
nothing like Java's, right?  You have to pass additional things, or
trampoline, or whatever.  Clojure does none of that.  Clojure has
pedal to the metal calling conventions that match Java's, so I don't
have tail recursion, because you can't do that unless the JVM does
that.

Andy



On Nov 19, 2012, at 4:38 PM, Curtis wrote:


Clojure Koans - Recursion
(defn recursive-reverse [coll]
   (loop [coll coll
  acc '() ]
  (if (= (count coll) 0)
 acc
(recur (rest coll) (cons (first coll) acc))
  )
   )
)

I struggled with this one for a while - I don’t want to admit it,
but honestly even though i have been coding since I was 16 years
old - there are still many areas where I am rusty or weak.

There is actually a surprising amount of low level concepts
operating in a list recursive reverse in clojure.

  * tail-call recursion
  * accumulator
  * loop construct

I have some questions about how this “special form” loop

http://clojure.org/special_forms#Special%20Forms--%28loop%20%5Bbindings*%20%5D%20exprs*%29
 operates
with recur
http://clojure.org/special_forms#Special%20Forms--%28recur%20exprs*%29

I think I need to make sure that I always remember the following :

  * the arity of the recur call must match the arity of the loop form
  * recur must be in the tail position.

I’m not sure how this loop / recur mechanism is implemented in
the JVM - I imaging that the binding created by ‘loop’ is
associated with registers that are overwritten as part of the
call to ‘recur’. The documentation says the bindings are rebound
on call of recur in parallel and the execution of recur - is done
in order.

My questions are

  * Is recur causing some kind of local jump after each binding?
  * What happens with the return address?
  * If recur doesn’t consume stack - what is going on with the
return address?
  * Is the return address always the same for 

Re: help choosing dev environment for clojure

2012-11-27 Thread Chris Ford
When considering the availability of a debugger, keep in mind that your
workflow might be different when you code Clojure compared to how you
approach Java, Ruby etc.

Because functions require less context to run than methods of an object, I
find that experimenting at the REPL (or rather executing forms within my
editor) a better way to work out what's going on than debugging through an
actual program execution.

Cheers,

Chris

On 28 November 2012 06:43, Phil Hagelberg p...@hagelb.org wrote:

 On Tue, Nov 27, 2012 at 1:30 PM, Walter van der Laan
 waltervanderl...@gmail.com wrote:
  Stepping through the execution is harder to setup but it might be
 possible.
  The CDT debugger can be set up as described here
  http://georgejahad.com/clojure/swank-cdt.html. It worked great for me at
  some point but I'm no longer using it because doesn't work with openjdk

 Swank Clojure is no longer under active development, but for what it's
 worth it has never had any incompatibility issues with OpenJDK.

 -Phil

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


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

2012-11-27 Thread Andy Fingerhut

On Nov 27, 2012, at 8:17 PM, Curtis wrote:

 Thank you Andy - This was fabulously helpful - I really appreciate your 
 explanation.
 
 Would you permit me to include your answer in a blog post about the above 
 question?


Sure, use it however you like.

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


Re: Clojure Recursion (loop-recur) Questions

2012-11-27 Thread Ben Wolfson
On Mon, Nov 19, 2012 at 6:24 PM, Andy Fingerhut
andy.finger...@gmail.com wrote:
 Clojure's loop/recur only implements tail recursion, not general tail-call
 optimization.  tail recursion is far more commonly used in languages that
 have it than the general tail-call optimization to arbitrary functions.

Can you explain this? I'm assuming that having tail recursion here
means not you can call yourself in tail position but calls to
yourself in tail position don't grow the stack. But I don't really
follow the second sentence, which seems to have two possible
continuations:

(a) tail recursion is far more commonly used in languages that have it
than the general tail-call optimization to arbitrary functions ... is
used in languages that have tail recursion.
(b) tail recursion is far more commonly used in languages that have it
than the general tail-call optimization to arbitrary functions ... is
used in languages that have *it* (i.e. general TCO).

But in (a), general tail-call optimization to arbitrary functions
couldn't be used very much in those languages; they don't have it. And
in (b), general TCO subsumes the optimization of tail recursion and
comes into play whenever a procedure is called from tail position, so
it would seem to be used pervasively in languages that have general
TCO.

-- 
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks,
which may be sweet, aromatic, fermented or spirit-based. ... Family
and social life also offer numerous other occasions to consume drinks
for pleasure. [Larousse, Drink entry]

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

2012-11-27 Thread Andy Fingerhut
Yes, that wasn't very clear of me.  Here is what I was thinking when writing 
that.

In Scheme, which has general tail-call optimization, you will often find 
functions written where the programmer went out of their way to change it from 
recursive, but doesn't use tail calls, into something that recursive and uses 
tail calls.  There are sections in introductory Scheme books showing how to 
change non-tail-recursive functions into tail-recursive ones, using accumulator 
parameters.

The programmer did this because they wanted to take advantage of tail-call 
optimization and avoid using stack space linear in the depth of recursive 
calls.  This becomes almost natural after a while, and it makes sense -- you 
don't want to use linear stack space for processing long linear data structures 
when you know you could use constant space with a bit more coding effort.

I can't say this authoritatively, but I think it is far less common for 
programmers to go out of their way to change calls to other functions into tail 
calls, if they weren't originally written as tail calls.  Sets of 2 or more 
functions that are mutually recursive are less common than self-recursive ones. 
 I know that there are Scheme programs that take advantage of general tail 
calls to write state machines where each state is a separate function and they 
call each other, and other programs like that, but tail-recursive functions are 
pervasive in Scheme.

Andy

On Nov 27, 2012, at 10:12 PM, Ben Wolfson wrote:

 On Mon, Nov 19, 2012 at 6:24 PM, Andy Fingerhut
 andy.finger...@gmail.com wrote:
 Clojure's loop/recur only implements tail recursion, not general tail-call
 optimization.  tail recursion is far more commonly used in languages that
 have it than the general tail-call optimization to arbitrary functions.
 
 Can you explain this? I'm assuming that having tail recursion here
 means not you can call yourself in tail position but calls to
 yourself in tail position don't grow the stack. But I don't really
 follow the second sentence, which seems to have two possible
 continuations:
 
 (a) tail recursion is far more commonly used in languages that have it
 than the general tail-call optimization to arbitrary functions ... is
 used in languages that have tail recursion.
 (b) tail recursion is far more commonly used in languages that have it
 than the general tail-call optimization to arbitrary functions ... is
 used in languages that have *it* (i.e. general TCO).
 
 But in (a), general tail-call optimization to arbitrary functions
 couldn't be used very much in those languages; they don't have it. And
 in (b), general TCO subsumes the optimization of tail recursion and
 comes into play whenever a procedure is called from tail position, so
 it would seem to be used pervasively in languages that have general
 TCO.
 
 -- 
 Ben Wolfson

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

2012-11-27 Thread Mimmo Cosenza
Thanks Michael,
hope to mantain myself to your generous judgment.

mimmo (it's my nickname)

 
On Nov 27, 2012, at 9:09 PM, Michael Klishin michael.s.klis...@gmail.com 
wrote:

 2012/11/27 Giacomo Cosenza mimmo.cose...@gmail.com
 Hope you find it useful 
 
 Giacomo,
 
 This is fantastic. I think this may be the most valuable source of 
 information about CLJS
 on the Web.
 
 We will figure out a way to add ClojureScript content to 
 http://clojure-doc.org, this has to be easier
 to discover.
 -- 
 MK
 
 http://github.com/michaelklishin
 http://twitter.com/michaelklishin
 
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

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