A ClojureScript One Question: Why is so much html created on the client side.

2012-08-10 Thread john
Hello, I am just trying to understand the best practices in ClojureScript One. One thing that strikes me is that most html gets put (with the help of macros using enlive) in the actual cljs page. As someone who hasn't done web-applications for years I myself would have created as much dynamic

Re: Attractive examples of function-generating functions

2012-08-10 Thread Jonas
How about the new reducers library: http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html Jonas On Wednesday, August 8, 2012 7:48:23 PM UTC+3, Brian Marick wrote: I'm looking for medium-scale

Re: reduce-kv doesn't reduce a sorted-map in order

2012-08-10 Thread Alex Baranosky
Sounds like a bug to me, in that it doesn't behave as I would expect. On Thu, Aug 9, 2012 at 7:29 PM, Baishampayan Ghose b.gh...@gmail.comwrote: Hi, It seems reduce-kv doesn't reduce a sorted-map in the correct order. Example - user (def *sm (into (sorted-map) {:aa 1 :zz 2 :bb 3 :yy 4 :cc

Re: Attractive examples of function-generating functions

2012-08-10 Thread Alex Baranosky
While admittedly neat, and educational, this kind of code is fancy for production use in my opinion: (defn make-point [x y] (fn [member] (cond (= member :x) x (= member :y) y))) On Fri, Aug 10, 2012 at 6:06 PM, Jonas jonas.enl...@gmail.com wrote: How about the new reducers

Re: reduce-kv doesn't reduce a sorted-map in order

2012-08-10 Thread Stuart Halloway
Confirmed -- thanks for the report. Stu Hi, It seems reduce-kv doesn't reduce a sorted-map in the correct order. Example - user (def *sm (into (sorted-map) {:aa 1 :zz 2 :bb 3 :yy 4 :cc 5 :xx 6})) ;= #'user/*sm user *sm ;= {:aa 1, :bb 3, :cc 5, :xx 6, :yy 4, :zz 2} ;; plain

Re: A ClojureScript One Question: Why is so much html created on the client side.

2012-08-10 Thread Pierre-Henry Perret
Enlive is abstractement conceive : if you put a remote on client you could cache it... To do that with the same abstract language , you have the awesome enfocus [0] lib with a sample app here [1], and for those clojururians interested in MVC [2] Any way, there will be some *remote *to get

currying and partial evaluation

2012-08-10 Thread gfredericks
After discovering a need for currying functions with partial evaluation (and having to do it by hand) in a clojurescript project, and deciding that a macro version might be feasible, I decided to give it a try. The result is here https://github.com/fredericksgary/currj, and seems to work at

Immutability rules when it comes to Ref type

2012-08-10 Thread Hussein B.
Hi, I have a ref type that wraps a map, this map is going to embed many nested other maps. According to immutability rules, what happens when: A new nested map is updated (entry is removed or update) or even a new nested map is added to the master map that is wrapped by ref type? Thanks for

Re: Attractive examples of function-generating functions

2012-08-10 Thread Maik Schünemann
I think enlives transformersare a very good example of functions returning functions. Maybe you should have a look at the getting started guide and the tutorials Send from Android Am 09.08.2012 23:13 schrieb Jonah Benton jo...@jonah.com: You've probably seen these, but if not, Doug Crockford's

Re: Immutability rules when it comes to Ref type

2012-08-10 Thread Pierre-Henry Perret
Would answer, if you want to be atomic, means transactional memory, that is a feature of Clore . Le vendredi 10 août 2012 18:21:12 UTC+2, Hussein B. a écrit : Hi, I have a ref type that wraps a map, this map is going to embed many nested other maps. According to immutability rules, what

Re: Immutability rules when it comes to Ref type

2012-08-10 Thread Pierre-Henry Perret
If you want to stay with atomic transactions this is a Clojure feature , STM, if my souvenirs sont bons Le vendredi 10 août 2012 18:21:12 UTC+2, Hussein B. a écrit : Hi, I have a ref type that wraps a map, this map is going to embed many nested other maps. According to immutability rules,

Re: Clojure group in DFW area

2012-08-10 Thread Steven Proctor
@(:dfw clojure-user-groups) I'll claim that promise. :) --Proctor On Thursday, August 9, 2012 8:42:07 AM UTC-5, Alex Robbins wrote: The group hasn't met in a long time, but we were actually talking about some kind of a relaunch last week. We were hoping some Clojure interest had

Issue of protocol methods with names starting with -

2012-08-10 Thread Jerry Peng
The following code fails with a strange exception No matching field found: _GT_foobar for class user.MyFoobar: (defprotocol Foobar (-foobar [this])) (defrecord MyFoobar [value] Foobar (-foobar [this] (str Foobar: value))) (extend-protocol Foobar String (-foobar [this] (str

Re: A ClojureScript One Question: Why is so much html created on the client side.

2012-08-10 Thread Nick Ward
I think it depends on the style of web site you are making. On the more GMail style 'web app' end of the spectrum, rendering/templating on the client side means you don't have to inundate the server with AJAX requests (for example, if different items are cached upon the initial connection). This

Re: A ClojureScript One Question: Why is so much html created on the client side.

2012-08-10 Thread Rick Wilson
On 8/10/12 5:21 AM, john wrote: Hello, I am just trying to understand the best practices in ClojureScript One. One thing that strikes me is that most html gets put (with the help of macros using enlive) in the actual cljs page. As someone who hasn't done web-applications for years I myself

Re: Immutability rules when it comes to Ref type

2012-08-10 Thread Andy Fingerhut
Hussein: If you ignore the ref for the moment, making any change to a map, or a map nested inside a map however many levels deep you wish, does not mutate the original map. Instead it creates a brand new map with the new set of keys and values. It is as if the original was copied, and the

Re: Immutability rules when it comes to Ref type

2012-08-10 Thread Hussein B.
Crystal clear, thanks. On Friday, August 10, 2012 10:16:19 PM UTC+3, Andy Fingerhut wrote: Hussein: If you ignore the ref for the moment, making any change to a map, or a map nested inside a map however many levels deep you wish, does not mutate the original map. Instead it creates a

Better ideas how to collect analytics data

2012-08-10 Thread Hussein B.
Hi, I'm collecting analytics data. I used a master map that holds many other nested maps. Considering maps are immutable, many new maps are going to be allocated. (Yes, that is efficient in Clojure). Basic operation that I'm using is update-in , very convenient. Do you have a better idea how to

Why Clojure map literal creates an instance of array map?

2012-08-10 Thread Hussein B.
Hi, Why Clojure map literal creates an instance of array map but not hash map? What are the advantages of array map over hash map? 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

Re: Why Clojure map literal creates an instance of array map?

2012-08-10 Thread Tamreen Khan
It's not dependent on whether it's a literal but on the size of the map, 8 key-value pairs is the threshold. This results in a PersistentHashMap (class {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9}) = clojure.lang.PersistentHashMap This gets you a PersistentArrayMap (class {1 1 2 2 3 3 4 4 5 5 6 6 7 7

How to measure pieces of Clojure code?

2012-08-10 Thread Hussein B.
Hi, I want to measure how much space an algorithm is taking and then trying to change some aspects to see how things are going to differ. I also want to measure how much time it takes to complete an operation. What tools can I use? Thanks. -- You received this message because you are

Re: Why Clojure map literal creates an instance of array map?

2012-08-10 Thread Hussein B.
Thanks, never knew about this hashtable threshold factor. On Saturday, August 11, 2012 1:01:02 AM UTC+3, Tamreen Khan (Scriptor) wrote: It's not dependent on whether it's a literal but on the size of the map, 8 key-value pairs is the threshold. This results in a PersistentHashMap (class

Re: A ClojureScript One Question: Why is so much html created on the client side.

2012-08-10 Thread Brenton
Hello John, ClojureScript One is an example of a single-page application. This means that you get one page load from the server and everything else happens in the browser without any further page loads. The initial page that is loaded is dynamically generated on the server. Any other updates

Re: How to measure pieces of Clojure code?

2012-08-10 Thread ronen
Hmm if by space you mean memory then I think that only a profiler can help with that, regarding time using https://github.com/hugoduncan/criterium for benchmarking is the path I would take Ronen On Saturday, August 11, 2012 1:21:05 AM UTC+3, Hussein B. wrote: Hi, I want to measure how much

Re: Attractive examples of function-generating functions

2012-08-10 Thread Brian Rowe
That's a good call. +1 On Friday, August 10, 2012 8:36:25 AM UTC-4, Jonas wrote: How about the new reducers library: http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html Jonas On