Re: object identity

2014-02-26 Thread t x
[start slightly insane idea]


Perhaps we need the following:

* a way to tag a function as _pure_

* a map with uber_weak keys + values

  by "uber_weak", I mean the k/v pair vanishes when either the key
_or_ the value is gc-ed


Then, what we do here, is that every function auto-memoizes:

  (func args) ==>

* lookup in my uber_weak k/v map; if args is already there, return
last computed value

* if not, compute value, then put it into the uber_weak k/v map


Suppose "uber_weak" maps exist, this does not cause gc problems because:

  * if our uber_weak map is the last reference to the either the k or
the v, the entire k/v pair gets removed from the uber_weak map


[end slightly insane idea]


I'm also going to mention that I know no where near enough about
js/java GC to say anything about how to implement "uber_weak" maps.


On Wed, Feb 26, 2014 at 8:37 PM, Bobby Eickhoff  wrote:
> This seems like a reasonable optimization.  I read something similar a few
> years ago
> (http://lorgonblog.wordpress.com/2008/05/24/catamorphisms-part-four/):
>
> What we want is a function which will be smart, and only allocate new data
> structures when necessary.  Indeed, one of the main advantages of immutable
> data structures is the ability to "share" portions of structure.
>
>
> Bobby
>
> On Monday, February 24, 2014 4:00:34 PM UTC-5, Brian Craft wrote:
>>
>> This is vaguely related to David's posts about om/react, where he talks
>> about optimizing state change tracking by checking object identity on
>> immutable objects: deep compares can be avoided if same identity implies no
>> changes.
>>
>> My first thought was that there are many algorithms that will give you a
>> new object every time, even if nothing has changed.  E.g. if your state has
>> an array whose elements must be validated, doing a map over the elements
>> will give you a new array every time, even if it makes no changes.
>>
>> Enforcing non-negative values, for instance:
>>
>> => (let [x {:a [1 -2 3]}] (update-in x [:a] (fn [y] (mapv #(if (< % 0) 0
>> %) y
>> {:a [1 0 3]}
>>
>> In the following case the values are already non-negative, but we still
>> get a new object:
>>
>> => (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (mapv
>> #(if (< % 0) 0 %) y)
>> false
>>
>> One can imagine trying to rewrite this so it passes through the vector if
>> nothing has changed. E.g.
>>
>> => (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (reduce
>> (fn [v i] (if (< (v i) 0) (assoc v i 0) v)) y (range (count y)))
>> true
>>
>> => (let [x {:a [1 -1 3]}] (identical? x (update-in x [:a] (fn [y] (reduce
>> (fn [v i] (if (< (v i) 0) (assoc v i 0) v)) y (range (count y)))
>> false
>>
>> I expect many algorithms would need to be reworked like this in order to
>> rely on object identity for change tracking. Is this madness? Am I thinking
>> about this the wrong way?
>>
>>
>> An interesting note here is that the next-to-last update-in, above,
>> returned the same object. I didn't know update-in could return the same
>> object. A simpler example:
>>
>> => (let [x {"a" [1 2 3]} y (update-in x ["a"] (fn [z] z))] [x y
>> (identical? x y)])
>> [{"a" [1 2 3]} {"a" [1 2 3]} true]
>>
>> => (let [x {"a" [1 2 3]} y (update-in x ["a"] (fn [z] [1 2 3]))] [x y
>> (identical? x y)])
>> [{"a" [1 2 3]} {"a" [1 2 3]} false]
>>
>>
>> Is this some kind of optimization in update-in, that it doesn't create a
>> new object if the new attribute is identical to the old attribute? Is it
>> peculiar to the data type? Is it documented anywhere?
>>
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

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


Re: object identity

2014-02-26 Thread Bobby Eickhoff
This seems like a reasonable optimization.  I read something similar a few 
years ago 
(http://lorgonblog.wordpress.com/2008/05/24/catamorphisms-part-four/):

What we want is a function which will be smart, and only allocate new data 
structures when necessary.  Indeed, one of the main advantages of immutable 
data structures is the ability to "share" portions of structure.


Bobby

On Monday, February 24, 2014 4:00:34 PM UTC-5, Brian Craft wrote:
>
> This is vaguely related to David's posts about om/react, where he talks 
> about optimizing state change tracking by checking object identity on 
> immutable objects: deep compares can be avoided if same identity implies no 
> changes.
>
> My first thought was that there are many algorithms that will give you a 
> new object every time, even if nothing has changed.  E.g. if your state has 
> an array whose elements must be validated, doing a map over the elements 
> will give you a new array every time, even if it makes no changes.
>
> Enforcing non-negative values, for instance:
>
> => (let [x {:a [1 -2 3]}] (update-in x [:a] (fn [y] (mapv #(if (< % 0) 0 
> %) y
> {:a [1 0 3]}
>
> In the following case the values are already non-negative, but we still 
> get a new object:
>
> => (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (mapv 
> #(if (< % 0) 0 %) y)
> false
>
> One can imagine trying to rewrite this so it passes through the vector if 
> nothing has changed. E.g.
>
> => (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (reduce 
> (fn [v i] (if (< (v i) 0) (assoc v i 0) v)) y (range (count y)))
> true
>
> => (let [x {:a [1 -1 3]}] (identical? x (update-in x [:a] (fn [y] (reduce 
> (fn [v i] (if (< (v i) 0) (assoc v i 0) v)) y (range (count y)))
> false
>
> I expect many algorithms would need to be reworked like this in order to 
> rely on object identity for change tracking. Is this madness? Am I thinking 
> about this the wrong way?
>
>
> An interesting note here is that the next-to-last update-in, above, 
> returned the same object. I didn't know update-in could return the same 
> object. A simpler example:
>
> => (let [x {"a" [1 2 3]} y (update-in x ["a"] (fn [z] z))] [x y 
> (identical? x y)])
> [{"a" [1 2 3]} {"a" [1 2 3]} true]
>
> => (let [x {"a" [1 2 3]} y (update-in x ["a"] (fn [z] [1 2 3]))] [x y 
> (identical? x y)])
> [{"a" [1 2 3]} {"a" [1 2 3]} false]
>
>
> Is this some kind of optimization in update-in, that it doesn't create a 
> new object if the new attribute is identical to the old attribute? Is it 
> peculiar to the data type? Is it documented anywhere?
>
>
>

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


Re: object identity

2014-02-26 Thread Mikera
I would try to write code that behaves like this where possible, because it 
certainly improves performance (because of faster identity checks + less GC 
pressure as you suggest). I think it is good practice in general when 
implementing immutable data structures.

However I would generally not *rely* on this behaviour. It should be seen 
as an implementation detail.

On Thursday, 27 February 2014 03:11:25 UTC+8, Brian Craft wrote:
>
> Ok, trying a different way of asking this:
>
> Is it common practice in clojure to write data transforms in a way that 
> will return the same object when possible (when the transform would be a 
> noop), such as the mapv vs. reduce/assoc in my example? Would you do this 
> to speed up equality checks, or to reduce gc pressure? Or is this an 
> anti-pattern like using identical?
>
> b.c.
>
> On Tuesday, February 25, 2014 9:59:11 AM UTC-8, David Nolen wrote:
>>
>> I don't really have anything to add to this thread but I will say that 
>> Om's use of identical? is an implementation detail that's likely to change. 
>> = already does an identical? check, ideally Om could use not= in the future 
>> instead of (not (identical? ...)).
>>
>> David
>>
>>
>> On Tue, Feb 25, 2014 at 12:54 PM, Brian Craft  wrote:
>>
>>> No, my question isn't "is there a way" to do this. I'm sure there are a 
>>> dozen ways to do it. My question is about a specific way of doing it. In 
>>> particular, if your solution does not involve calling (identical? ..), then 
>>> it's not what I'm asking about.
>>>
>>> In om core there's a call to identical? under the :shouldComponentUpdate 
>>> key, which I suspect is what David was talking about in his blog posts 
>>> about avoiding deep compares via immutable data structures. My question is 
>>> about whether that has implications for how you write algorithms that 
>>> update state, and whether the semantics of update-in (or assoc, really) 
>>> that allow it to return the same object if the update would return an 
>>> identical object, are related to this mechanism, if these semantics are 
>>> documented, and if they depend on the data type being assoc'd.
>>>
>>>
>>>
>>> On Monday, February 24, 2014 6:27:02 PM UTC-8, t x wrote:
>>>
 Perhaps I mis-interpreted your question. 

 I thought the question asked was: 


 GIven: 
   * pure function "func" 
   * some object "obj" 
   * (def a (func obj)) 
   * (def b (func obj)) 

 Example: 
   * obj = [1 2 3] 
   * (defn func [lst] (map #(* 2 %) lst)) 

 Then: 
   * is there a O(1) way to check if (= a b) ? 

   In the above, we create two _different_ lists, both of which stores 
 [2 4 6], thus they're equal, but not identical 

 Proposed solution: 
   tag the returned-value with a meta object, where the meta object 
 describes how the object was computed. 

   in this case, both [2 4 6] would have _identical_ meta objects, 
 since they're both from the list [1 2 3] 





 On Mon, Feb 24, 2014 at 5:56 PM, Brian Craft  
 wrote: 
 > You're solving a similar problem, but I'm asking specifically about 
 using 
 > object identity, not equality, for tracking changes in a nested 
 structure. 
 > 
 > 
 > On Monday, February 24, 2014 1:42:03 PM UTC-8, t x wrote: 
 >> 
 >> I finally have a chance to give back. :-) 
 >> 
 >> I hacked up a newb's half-React. It does tree diffing + dom 
 updating, 
 >> but not the virtual event handling system. 
 >> 
 >> I ran into this exact problem, and solved it as follows: 
 >> 
 >> 
 >> ## problem definition: 
 >> 
 >> render: data -> dom 
 >> tree-diff: dom * dom -> list of dom-update-actions 
 >> 
 >> we want to avoid "deep tree diffing" on tree-diff 
 >> 
 >> the key idea is as follows: 
 >> 
 >>   when render is called twice with same args, 
 >> 
 >>   * we still have to recompute every time 
 >>   * we don't have to re-compare every time 
 >> 
 >> if render is a pure function, we do somethign like: 
 >> 
 >> (defn render [data] 
 >>   (with-meta (render-pure data) {:pure data})) 
 >> 
 >> (render-pure data) gives us a dom-tree 
 >> we tag it with a meta project, telling us that it came from "data", 
 >> and that it was a pure function 
 >> 
 >> 
 >> then, doing the tree-diff stage, we do: 
 >> 
 >> 
 >> (defn tree-diff [old-dom new-dom] 
 >>   (let [mo (meta old-dom) 
 >> no (meta new-dom)] 
 >> (if (and (:pure mo) (:pure no) (= (:pure mo) (:pure no))) 
 >>   .. ah, they're from the same pure function, thus the same ... 
 >>   ... okay, let's do expensive deep diff))) 
 >> 
 >> 
 >> so basically, we abuse meta objects, record 
 >> 
 >>   * what data gave us this dom tree ? 
 >>   * was the func that gave us the dom tr

Re: The future of CongoMongo?

2014-02-26 Thread Michael Klishin
2014-02-27 4:56 GMT+04:00 Mark Engelberg :

> I've looked at monger a couple of times, and felt it was more involved
> than I wanted.  For example, I was turned off by the need to manually
> create object IDs as part of creating records.  I like how congomongo does
> it for me.


See monger.collection/insert-and-return


-- 
MK

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

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


Re: object identity

2014-02-26 Thread Andy Fingerhut
There are likely to be common ways of writing data transforms that happen
to return the same identical object as they were given, because
'primitives' like assoc often do.

I don't know of anyone who intentionally relies upon this behavior for
correctness of their code, and would strongly advise against ever doing so.

I also don't know of anyone who intentionally tries to write such code in
order to improve performance of their Clojure programs.  If they did, I
would guess they would often be frustrated by small changes to their
program that reduced performance by no longer returning identical objects.

Andy


On Wed, Feb 26, 2014 at 11:11 AM, Brian Craft  wrote:

> Ok, trying a different way of asking this:
>
> Is it common practice in clojure to write data transforms in a way that
> will return the same object when possible (when the transform would be a
> noop), such as the mapv vs. reduce/assoc in my example? Would you do this
> to speed up equality checks, or to reduce gc pressure? Or is this an
> anti-pattern like using identical?
>
> b.c.
>
>
> On Tuesday, February 25, 2014 9:59:11 AM UTC-8, David Nolen wrote:
>
>> I don't really have anything to add to this thread but I will say that
>> Om's use of identical? is an implementation detail that's likely to change.
>> = already does an identical? check, ideally Om could use not= in the future
>> instead of (not (identical? ...)).
>>
>> David
>>
>>
>> On Tue, Feb 25, 2014 at 12:54 PM, Brian Craft  wrote:
>>
>>> No, my question isn't "is there a way" to do this. I'm sure there are a
>>> dozen ways to do it. My question is about a specific way of doing it. In
>>> particular, if your solution does not involve calling (identical? ..), then
>>> it's not what I'm asking about.
>>>
>>> In om core there's a call to identical? under the :shouldComponentUpdate
>>> key, which I suspect is what David was talking about in his blog posts
>>> about avoiding deep compares via immutable data structures. My question is
>>> about whether that has implications for how you write algorithms that
>>> update state, and whether the semantics of update-in (or assoc, really)
>>> that allow it to return the same object if the update would return an
>>> identical object, are related to this mechanism, if these semantics are
>>> documented, and if they depend on the data type being assoc'd.
>>>
>>>
>>>
>>> On Monday, February 24, 2014 6:27:02 PM UTC-8, t x wrote:
>>>
 Perhaps I mis-interpreted your question.

 I thought the question asked was:


 GIven:
   * pure function "func"
   * some object "obj"
   * (def a (func obj))
   * (def b (func obj))

 Example:
   * obj = [1 2 3]
   * (defn func [lst] (map #(* 2 %) lst))

 Then:
   * is there a O(1) way to check if (= a b) ?

   In the above, we create two _different_ lists, both of which stores
 [2 4 6], thus they're equal, but not identical

 Proposed solution:
   tag the returned-value with a meta object, where the meta object
 describes how the object was computed.

   in this case, both [2 4 6] would have _identical_ meta objects,
 since they're both from the list [1 2 3]





 On Mon, Feb 24, 2014 at 5:56 PM, Brian Craft 
 wrote:
 > You're solving a similar problem, but I'm asking specifically about
 using
 > object identity, not equality, for tracking changes in a nested
 structure.
 >
 >
 > On Monday, February 24, 2014 1:42:03 PM UTC-8, t x wrote:
 >>
 >> I finally have a chance to give back. :-)
 >>
 >> I hacked up a newb's half-React. It does tree diffing + dom
 updating,
 >> but not the virtual event handling system.
 >>
 >> I ran into this exact problem, and solved it as follows:
 >>
 >>
 >> ## problem definition:
 >>
 >> render: data -> dom
 >> tree-diff: dom * dom -> list of dom-update-actions
 >>
 >> we want to avoid "deep tree diffing" on tree-diff
 >>
 >> the key idea is as follows:
 >>
 >>   when render is called twice with same args,
 >>
 >>   * we still have to recompute every time
 >>   * we don't have to re-compare every time
 >>
 >> if render is a pure function, we do somethign like:
 >>
 >> (defn render [data]
 >>   (with-meta (render-pure data) {:pure data}))
 >>
 >> (render-pure data) gives us a dom-tree
 >> we tag it with a meta project, telling us that it came from "data",
 >> and that it was a pure function
 >>
 >>
 >> then, doing the tree-diff stage, we do:
 >>
 >>
 >> (defn tree-diff [old-dom new-dom]
 >>   (let [mo (meta old-dom)
 >> no (meta new-dom)]
 >> (if (and (:pure mo) (:pure no) (= (:pure mo) (:pure no)))
 >>   .. ah, they're from the same pure function, thus the same ...
 >>   ... okay, let's do expensive deep diff)))
 >>
 >>
 >> so

Re: Latest web framework for clojure

2014-02-26 Thread Moritz Ulrich
Om is well-suited to handle the UI-part for you. It doesn't do any
server communication or forces you into any particular programming
style or project layout.

On Thu, Feb 27, 2014 at 2:35 AM, Mark Engelberg
 wrote:
> As far as I can tell, neither luminus nor caribou are well-suited to
> building, for example, interactive "web apps" like this web-based chat room
> which serves as the "Hello World" for the Opa web framework:
> https://github.com/MLstate/opalang/wiki/Hello%2C-chat
>
> Is this the kind of thing that Pedestal and Hoplon are meant for?  Or Om?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

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


Re: Latest web framework for clojure

2014-02-26 Thread Mark Engelberg
As far as I can tell, neither luminus nor caribou are well-suited to
building, for example, interactive "web apps" like this web-based chat room
which serves as the "Hello World" for the Opa web framework:
https://github.com/MLstate/opalang/wiki/Hello%2C-chat

Is this the kind of thing that Pedestal and Hoplon are meant for?  Or Om?

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


Re: The future of CongoMongo?

2014-02-26 Thread Leonardo Borges
>
> I'd like to see CongoMongo's API completely overhauled, to remove 
> dependencies on dynamic global variables etc, so this would be introduce a 
> new API, and deprecate the old API.
>

I've used both libraries but since I haven't worked with Mongo
extensively from Clojure I still don't have a strong preference.

For what's worth however, I would like to see the dependency in
dynamic vars removed. It's a good design goal to have.

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


Re: The future of CongoMongo?

2014-02-26 Thread Mark Engelberg
I use and prefer congomongo, and am happy with its current state.  It's
lightweight and does what I want it to do.

I've looked at monger a couple of times, and felt it was more involved than
I wanted.  For example, I was turned off by the need to manually create
object IDs as part of creating records.  I like how congomongo does it for
me.

Maybe overhauling congomongo is not the way to go.  Maybe let monger occupy
the more complex niche, and just do the minimum updates to congomongo to
keep it current with evolving java and mongo apis, keeping congomongo nice
and simple.

--Mark




On Wed, Feb 26, 2014 at 3:04 PM, Sean Corfield  wrote:

> (this is a variant of a discussion I started on the congomongo-dev mailing
> list a while back)
>
> Do you use MongoDB with Clojure?
>
> Which library do you use?
>
> I seem to have become the de facto primary maintainer for CongoMongo now -
> I gather most other maintainers are not currently using MongoDB (or are
> just happy with the status quo).
>
> Having gone through the recent major overhaul of java.jdbc, I'd like to
> see something similar for CongoMongo and with the new MongoDB driver
> version (3.x) bringing API changes, it seems like a good time to discuss
> the direction for CongoMongo...
>
> I'd like to see CongoMongo's API completely overhauled, to remove
> dependencies on dynamic global variables etc, so this would be introduce a
> new API, and deprecate the old API.
>
> I'd also like to see a congomongo organization on Github for managing
> CongoMongo going forward, much as exists with clj-time. So maybe it's time
> to think about a break with "tradition" and fork the project into a new
> location and build the new API there instead? Or perhaps even a ground-up
> rewrite under a new name?
>
> The other popular MongoDB client library is Monger, but it's also
> primarily an "imperative" API with globally managed state (connect! set-db!
> disconnect! etc) although it provides a much richer composable DSL and
> vastly superior documentation - and it provides a secondary API that allows
> you to pass in the db handle everywhere but its definitely not as clean /
> complete as the primary API.
>
> I've spent some time at work on a spike to convert our application from
> CongoMongo to Monger and there are pros and cons to Monger's API - I'm
> finding I have to rely more on being closer to the metal in terms of the
> Java API which is sometimes a good thing and sometimes not. We have hit a
> couple of roadblocks that I'm discussing with Michael / ClojureWerkz which
> prevent us going all the way with Monger.
>
> At this point I'm not sure which way World Singles will go. I'm not sure I
> have the heart for a complete rewrite of CongoMongo but there are parts of
> Monger I'm not happy with either. Michael / ClojureWerkz have been very
> receptive to suggestions and pull requests so part of me feels like that's
> a better use of my time - but if folks are genuinely interested in a new
> version of CongoMongo, I could be persuaded to do that instead.
>
> What are your thoughts on this?
>
> Sean Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
>
>
>

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


Re: Latest web framework for clojure

2014-02-26 Thread Chris Kuttruff
+1 to this... I've set up a basic site with these basic tools (jetty 
instead of http-kit for development simplicity with lein ring).  Couldn't 
be any simpler to get going, and it's really nice to have everything 
explicitly namespaced... you can just organize things how want.

Also, I would recommend checking out clj-sql-up if you'd like a nice, small 
library for doing database migrations.  There are certainly some other 
options out there in this dept, but I think clj-sql-up is the simplest 
possible implementation and still allows you the flexibility of dynamically 
generating sql strings with clojure (if you're using some other library to 
dynamically generate sql; would be easy to include and use with the 
migration files)
https://github.com/ckuttruff/clj-sql-up

Please let me know if you have any issues, but I think it should be pretty 
easy to use, and hopefully useful for your project.  


On Wednesday, February 26, 2014 12:29:44 PM UTC-8, Moritz Ulrich wrote:
>
> In addition to all the other message here please note, that it's very 
> helpful to build a site with just http-kit, hiccup and compojure, 
> which are all three independent components. This gives you the freedom 
> to structure your application however you like without getting in your 
> way like many frameworks. 
>
> It's also a good learning exercise as you learn how most Clojure 
> web-application stacks work. 
>
> On Wed, Feb 26, 2014 at 2:13 AM, Aravindh S 
> > 
> wrote: 
> > Hi All, 
> >I have been reading clojure for sometime now. I am at a point where I 
> > want to learn a web framework. I see many options available for clojure 
> > where few are built upon others. So if I am to learn one, which 
> framework 
> > does the community recommend? 
> > 
> > Thanks 
> > Aravindh.S 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> > Note that posts from new members are moderated - please be patient with 
> your 
> > first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com  
> > For more options, visit this group at 
> > http://groups.google.com/group/clojure?hl=en 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Clojure" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to clojure+u...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>

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


The future of CongoMongo?

2014-02-26 Thread Sean Corfield
(this is a variant of a discussion I started on the congomongo-dev mailing list 
a while back)

Do you use MongoDB with Clojure?

Which library do you use?

I seem to have become the de facto primary maintainer for CongoMongo now - I 
gather most other maintainers are not currently using MongoDB (or are just 
happy with the status quo).

Having gone through the recent major overhaul of java.jdbc, I'd like to see 
something similar for CongoMongo and with the new MongoDB driver version (3.x) 
bringing API changes, it seems like a good time to discuss the direction for 
CongoMongo...

I'd like to see CongoMongo's API completely overhauled, to remove dependencies 
on dynamic global variables etc, so this would be introduce a new API, and 
deprecate the old API.

I'd also like to see a congomongo organization on Github for managing 
CongoMongo going forward, much as exists with clj-time. So maybe it's time to 
think about a break with "tradition" and fork the project into a new location 
and build the new API there instead? Or perhaps even a ground-up rewrite under 
a new name?

The other popular MongoDB client library is Monger, but it's also primarily an 
"imperative" API with globally managed state (connect! set-db! disconnect! etc) 
although it provides a much richer composable DSL and vastly superior 
documentation - and it provides a secondary API that allows you to pass in the 
db handle everywhere but its definitely not as clean / complete as the primary 
API.

I've spent some time at work on a spike to convert our application from 
CongoMongo to Monger and there are pros and cons to Monger's API - I'm finding 
I have to rely more on being closer to the metal in terms of the Java API which 
is sometimes a good thing and sometimes not. We have hit a couple of roadblocks 
that I'm discussing with Michael / ClojureWerkz which prevent us going all the 
way with Monger.

At this point I'm not sure which way World Singles will go. I'm not sure I have 
the heart for a complete rewrite of CongoMongo but there are parts of Monger 
I'm not happy with either. Michael / ClojureWerkz have been very receptive to 
suggestions and pull requests so part of me feels like that's a better use of 
my time - but if folks are genuinely interested in a new version of CongoMongo, 
I could be persuaded to do that instead.

What are your thoughts on this?

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

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





signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Can't start repl with Leiningen

2014-02-26 Thread Matej Fröbe





*#apt-get update#apt-cache show openjdk-7-jrePackage: openjdk-7-jreSource: 
openjdk-7Version: 7u21-2.3.9-5...*

So if I understand correctly (I'm more or less a Linux newbie), this means 
that "update 21" is the version in distro's repositories.


Am Mittwoch, 26. Februar 2014 21:36:39 UTC+1 schrieb Zach Oakes:
>
> Is their a reason your OpenJDK install is only on update 21? I believe the 
> most recent is 51, though I doubt that is the problem. I also doubt it's a 
> memory issue; I can run the REPL just fine on a netbook with 1GB of RAM 
> running Ubuntu x64.
>
> On Wednesday, February 26, 2014 3:05:53 PM UTC-5, Matej Fröbe wrote:
>>
>> I only have 2GB. I tried adding -Xms1024M (and some lower and higher 
>> values) to the java command in lein script, but it didn't help.
>>
>>
>> Am Mittwoch, 26. Februar 2014 19:52:49 UTC+1 schrieb Armando Blancas:
>>>
>>> I had the same problem with an old box I had around the house. Put 
>>> Fedora 20 on it with a recent open jdk, but had just 1GB of memory total. I 
>>> attributed the error to the lower memory since I never have that issue at 
>>> work or other machines with at least 4GB. If you have more than 2GB, 
>>> experiment with something like -Xms1024M or more.
>>>
>>> On Wednesday, February 26, 2014 9:28:42 AM UTC-8, Matej Fröbe wrote:

 Debian jessie 32-bit

 Am Mittwoch, 26. Februar 2014 15:50:19 UTC+1 schrieb John Gabriele:
>
> On Wednesday, February 26, 2014 3:19:43 AM UTC-5, Matej Fröbe wrote:
>>
>> It seems that this is independent of where I run the project.
>>
>>>

> Matej,
>
> What OS (and version) are you using?
>  
>


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


Re: Can't start repl with Leiningen

2014-02-26 Thread Zach Oakes
Is their a reason your OpenJDK install is only on update 21? I believe the 
most recent is 51, though I doubt that is the problem. I also doubt it's a 
memory issue; I can run the REPL just fine on a netbook with 1GB of RAM 
running Ubuntu x64.

On Wednesday, February 26, 2014 3:05:53 PM UTC-5, Matej Fröbe wrote:
>
> I only have 2GB. I tried adding -Xms1024M (and some lower and higher 
> values) to the java command in lein script, but it didn't help.
>
>
> Am Mittwoch, 26. Februar 2014 19:52:49 UTC+1 schrieb Armando Blancas:
>>
>> I had the same problem with an old box I had around the house. Put Fedora 
>> 20 on it with a recent open jdk, but had just 1GB of memory total. I 
>> attributed the error to the lower memory since I never have that issue at 
>> work or other machines with at least 4GB. If you have more than 2GB, 
>> experiment with something like -Xms1024M or more.
>>
>> On Wednesday, February 26, 2014 9:28:42 AM UTC-8, Matej Fröbe wrote:
>>>
>>> Debian jessie 32-bit
>>>
>>> Am Mittwoch, 26. Februar 2014 15:50:19 UTC+1 schrieb John Gabriele:

 On Wednesday, February 26, 2014 3:19:43 AM UTC-5, Matej Fröbe wrote:
>
> It seems that this is independent of where I run the project.
>
>>
>>>
 Matej,

 What OS (and version) are you using?
  

>>>

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


Re: Latest web framework for clojure

2014-02-26 Thread Moritz Ulrich
In addition to all the other message here please note, that it's very
helpful to build a site with just http-kit, hiccup and compojure,
which are all three independent components. This gives you the freedom
to structure your application however you like without getting in your
way like many frameworks.

It's also a good learning exercise as you learn how most Clojure
web-application stacks work.

On Wed, Feb 26, 2014 at 2:13 AM, Aravindh S  wrote:
> Hi All,
>I have been reading clojure for sometime now. I am at a point where I
> want to learn a web framework. I see many options available for clojure
> where few are built upon others. So if I am to learn one, which framework
> does the community recommend?
>
> Thanks
> Aravindh.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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

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


[ANN]: Buddy 0.1.0-beta4: Authentication, Authorization & Signing library for Clojure.

2014-02-26 Thread Andrey Antukh
Hi!

I am happy to announce a new release of buddy 0.1.0-beta4: authentication,
authorization and signing library for clojure.

Comparing it with previous release/announcement this comes with big api
restructuring and simplification.

Changes:

- As previously mentioned: api restructuring (after this release, api
should not change drastically).
- Improved documentation example code.
- New granular and url independent access rules decorator.
- New simple token auth backend.
- Few additional methods for signing (initial work for add support for json
web token)

Github: https://github.com/niwibe/buddy
Doc: http://niwibe.github.io/buddy/

Any improvements, examples or more documentation are welcome!
Thanks!

Greetings!
Andrey




-- 
Andrey Antukh - Андрей Антух -  / 
http://www.niwi.be 
https://github.com/niwibe

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


Re: Can't start repl with Leiningen

2014-02-26 Thread Matej Fröbe
I only have 2GB. I tried adding -Xms1024M (and some lower and higher 
values) to the java command in lein script, but it didn't help.


Am Mittwoch, 26. Februar 2014 19:52:49 UTC+1 schrieb Armando Blancas:
>
> I had the same problem with an old box I had around the house. Put Fedora 
> 20 on it with a recent open jdk, but had just 1GB of memory total. I 
> attributed the error to the lower memory since I never have that issue at 
> work or other machines with at least 4GB. If you have more than 2GB, 
> experiment with something like -Xms1024M or more.
>
> On Wednesday, February 26, 2014 9:28:42 AM UTC-8, Matej Fröbe wrote:
>>
>> Debian jessie 32-bit
>>
>> Am Mittwoch, 26. Februar 2014 15:50:19 UTC+1 schrieb John Gabriele:
>>>
>>> On Wednesday, February 26, 2014 3:19:43 AM UTC-5, Matej Fröbe wrote:

 It seems that this is independent of where I run the project.

>
>>
>>> Matej,
>>>
>>> What OS (and version) are you using?
>>>  
>>>
>>

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


Re: [ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-02-26 Thread Base
Peter,

This looks great!  can't wait to try it out. 
Well done.

On Wednesday, February 26, 2014 7:57:24 AM UTC-6, Peter Taoussanis wrote:
>
> Hi folks,
>
> Quick post to announce a new lib release: 
> https://github.com/ptaoussanis/sente
>
> From the README:
> *Sente* is small client+server library that makes it easy to build *reliable, 
> high-performance realtime web applications with Clojure*.
>
> * *Bidirectional a/sync comms* over both *WebSockets* and *Ajax* 
> (auto-selecting).
> * *Robust*: auto keep-alives, buffering, mode fallback, reconnects.
> * edn rocks. So *send edn, get edn*: no json here.
> * *Tiny, simple API*: make-channel-socket! and you're good to go.
> * Automatic, sensible support for users connected with *multiple clients* 
> and/or 
> devices simultaneously.
> * *Flexible model*: use it anywhere you'd use WebSockets or Ajax.
> * *Fully documented, with examples* (more forthcoming).
> * Small: *less than 600 lines of code* for the entire client+server 
> implementation.
> * *Supported servers*: currently only http-kit, but easily extended.
>
> ---
> Have been using something like this in production since a little after 
> core.async came out, and wouldn't want to go back. Note that I tweaked a 
> few things for the public release so there may be some rough edges 
> initially. 
>
> An example project's included (new as of today) and there's a Leiningen 
> alias configured to handle all the fiddly bits like getting the Cljx and 
> Cljs to compile: just download, `lein start-dev` at a terminal, and you're 
> good to go.
>
> Any questions/problems/whatever, you can reach me here or on GitHub.
>
> That's it! Happy hacking, cheers! :-)
> - *Peter Taoussanis*
> https://twitter.com/ptaoussanis
> https://www.taoensso.com/clojure-libraries
>

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


Re: Latest web framework for clojure

2014-02-26 Thread Josh Kamau
If you are writting  blog-like application , check out caribou
http://caribou.github.io/caribou/docs/outline.html


On Wed, Feb 26, 2014 at 9:44 PM, Curtis Gagliardi <
gagliardi.cur...@gmail.com> wrote:

> If you're interested in the url-generation and data-based routing, there
> are some Compojure competitors like Bidi which have those features without
> bringing on something as large as Pedestal: https://github.com/juxt/bidi(the 
> readme has a nice comparison chart).
>
> On Tuesday, February 25, 2014 11:57:18 PM UTC-8, Jan Herich wrote:
>>
>> It depends also on your requirements. For example if you want your app to
>> work in many
>> deployment scenarios (standalone Jetty  or Tomcat, J2EE web
>> containers...) and you may
>> have to use servlet 3.0 API asynchronous features, nothing beats pedestal
>> currently.
>>
>> The concept of interceptors is little harder to grok then simple ring
>> handlers (which are reused
>> to the greatest possible extent anyway), but they really make sense and
>> truly decomplect
>> execution order, unlike traditional ring wrapping handlers.
>>
>> The routing systems is also more transparent (data based) then Compojure
>> macro routing
>> and the url generation facility is nice.
>>
>> Sometimes i hear people say that pedestal is "unclojurish" and complex,
>> but i think they
>> just don't get the difference between complex and easy. Overall, i think
>> that pedestal
>> represents core clojure philosophy better then any other clojure server
>> side framework.
>>
>> Dňa streda, 26. februára 2014 2:13:30 UTC+1 Aravindh S napísal(-a):
>>>
>>> Hi All,
>>>I have been reading clojure for sometime now. I am at a point where I
>>> want to learn a web framework. I see many options available for clojure
>>> where few are built upon others. So if I am to learn one, which framework
>>> does the community recommend?
>>>
>>> Thanks
>>> Aravindh.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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


Re: object identity

2014-02-26 Thread Brian Craft
Ok, trying a different way of asking this:

Is it common practice in clojure to write data transforms in a way that 
will return the same object when possible (when the transform would be a 
noop), such as the mapv vs. reduce/assoc in my example? Would you do this 
to speed up equality checks, or to reduce gc pressure? Or is this an 
anti-pattern like using identical?

b.c.

On Tuesday, February 25, 2014 9:59:11 AM UTC-8, David Nolen wrote:
>
> I don't really have anything to add to this thread but I will say that 
> Om's use of identical? is an implementation detail that's likely to change. 
> = already does an identical? check, ideally Om could use not= in the future 
> instead of (not (identical? ...)).
>
> David
>
>
> On Tue, Feb 25, 2014 at 12:54 PM, Brian Craft 
> > wrote:
>
>> No, my question isn't "is there a way" to do this. I'm sure there are a 
>> dozen ways to do it. My question is about a specific way of doing it. In 
>> particular, if your solution does not involve calling (identical? ..), then 
>> it's not what I'm asking about.
>>
>> In om core there's a call to identical? under the :shouldComponentUpdate 
>> key, which I suspect is what David was talking about in his blog posts 
>> about avoiding deep compares via immutable data structures. My question is 
>> about whether that has implications for how you write algorithms that 
>> update state, and whether the semantics of update-in (or assoc, really) 
>> that allow it to return the same object if the update would return an 
>> identical object, are related to this mechanism, if these semantics are 
>> documented, and if they depend on the data type being assoc'd.
>>
>>
>>
>> On Monday, February 24, 2014 6:27:02 PM UTC-8, t x wrote:
>>
>>> Perhaps I mis-interpreted your question. 
>>>
>>> I thought the question asked was: 
>>>
>>>
>>> GIven: 
>>>   * pure function "func" 
>>>   * some object "obj" 
>>>   * (def a (func obj)) 
>>>   * (def b (func obj)) 
>>>
>>> Example: 
>>>   * obj = [1 2 3] 
>>>   * (defn func [lst] (map #(* 2 %) lst)) 
>>>
>>> Then: 
>>>   * is there a O(1) way to check if (= a b) ? 
>>>
>>>   In the above, we create two _different_ lists, both of which stores 
>>> [2 4 6], thus they're equal, but not identical 
>>>
>>> Proposed solution: 
>>>   tag the returned-value with a meta object, where the meta object 
>>> describes how the object was computed. 
>>>
>>>   in this case, both [2 4 6] would have _identical_ meta objects, 
>>> since they're both from the list [1 2 3] 
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Feb 24, 2014 at 5:56 PM, Brian Craft  
>>> wrote: 
>>> > You're solving a similar problem, but I'm asking specifically about 
>>> using 
>>> > object identity, not equality, for tracking changes in a nested 
>>> structure. 
>>> > 
>>> > 
>>> > On Monday, February 24, 2014 1:42:03 PM UTC-8, t x wrote: 
>>> >> 
>>> >> I finally have a chance to give back. :-) 
>>> >> 
>>> >> I hacked up a newb's half-React. It does tree diffing + dom updating, 
>>> >> but not the virtual event handling system. 
>>> >> 
>>> >> I ran into this exact problem, and solved it as follows: 
>>> >> 
>>> >> 
>>> >> ## problem definition: 
>>> >> 
>>> >> render: data -> dom 
>>> >> tree-diff: dom * dom -> list of dom-update-actions 
>>> >> 
>>> >> we want to avoid "deep tree diffing" on tree-diff 
>>> >> 
>>> >> the key idea is as follows: 
>>> >> 
>>> >>   when render is called twice with same args, 
>>> >> 
>>> >>   * we still have to recompute every time 
>>> >>   * we don't have to re-compare every time 
>>> >> 
>>> >> if render is a pure function, we do somethign like: 
>>> >> 
>>> >> (defn render [data] 
>>> >>   (with-meta (render-pure data) {:pure data})) 
>>> >> 
>>> >> (render-pure data) gives us a dom-tree 
>>> >> we tag it with a meta project, telling us that it came from "data", 
>>> >> and that it was a pure function 
>>> >> 
>>> >> 
>>> >> then, doing the tree-diff stage, we do: 
>>> >> 
>>> >> 
>>> >> (defn tree-diff [old-dom new-dom] 
>>> >>   (let [mo (meta old-dom) 
>>> >> no (meta new-dom)] 
>>> >> (if (and (:pure mo) (:pure no) (= (:pure mo) (:pure no))) 
>>> >>   .. ah, they're from the same pure function, thus the same ... 
>>> >>   ... okay, let's do expensive deep diff))) 
>>> >> 
>>> >> 
>>> >> so basically, we abuse meta objects, record 
>>> >> 
>>> >>   * what data gave us this dom tree ? 
>>> >>   * was the func that gave us the dom tree pure ? 
>>> >> 
>>> >> And if so, we just do a equality check on the data -- which are are 
>>> >> _not_ "regenerating" and thus matches an equality check. 
>>> >> 
>>> >> 
>>> >> Please let me if: 
>>> >> 
>>> >>   (a) this resolves the issue 
>>> >>   (b) I completely misunderstood the question 
>>> >> 
>>> >> 
>>> >> Thanks! 
>>> >> 
>>> >> 
>>> >> 
>>> >> 
>>> >> 
>>> >> 
>>> >> On Mon, Feb 24, 2014 at 1:00 PM, Brian Craft  
>>> wrote: 
>>> >> > This is vaguely related to David's posts about om/react, where he 
>>> talks 
>>> >> > about optimizing state change tra

Re: Can't start repl with Leiningen

2014-02-26 Thread Armando Blancas
I had the same problem with an old box I had around the house. Put Fedora 
20 on it with a recent open jdk, but had just 1GB of memory total. I 
attributed the error to the lower memory since I never have that issue at 
work or other machines with at least 4GB. If you have more than 2GB, 
experiment with something like -Xms1024M or more.

On Wednesday, February 26, 2014 9:28:42 AM UTC-8, Matej Fröbe wrote:
>
> Debian jessie 32-bit
>
> Am Mittwoch, 26. Februar 2014 15:50:19 UTC+1 schrieb John Gabriele:
>>
>> On Wednesday, February 26, 2014 3:19:43 AM UTC-5, Matej Fröbe wrote:
>>>
>>> It seems that this is independent of where I run the project.
>>>

>
>> Matej,
>>
>> What OS (and version) are you using?
>>  
>>
>

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


Re: Latest web framework for clojure

2014-02-26 Thread Curtis Gagliardi
If you're interested in the url-generation and data-based routing, there 
are some Compojure competitors like Bidi which have those features without 
bringing on something as large as Pedestal: https://github.com/juxt/bidi 
(the readme has a nice comparison chart). 

On Tuesday, February 25, 2014 11:57:18 PM UTC-8, Jan Herich wrote:
>
> It depends also on your requirements. For example if you want your app to 
> work in many 
> deployment scenarios (standalone Jetty  or Tomcat, J2EE web containers...) 
> and you may 
> have to use servlet 3.0 API asynchronous features, nothing beats pedestal 
> currently.
>
> The concept of interceptors is little harder to grok then simple ring 
> handlers (which are reused
> to the greatest possible extent anyway), but they really make sense and 
> truly decomplect
> execution order, unlike traditional ring wrapping handlers.
>
> The routing systems is also more transparent (data based) then Compojure 
> macro routing
> and the url generation facility is nice.
>
> Sometimes i hear people say that pedestal is "unclojurish" and complex, 
> but i think they
> just don't get the difference between complex and easy. Overall, i think 
> that pedestal 
> represents core clojure philosophy better then any other clojure server 
> side framework.
>
> Dňa streda, 26. februára 2014 2:13:30 UTC+1 Aravindh S napísal(-a):
>>
>> Hi All,
>>I have been reading clojure for sometime now. I am at a point where I 
>> want to learn a web framework. I see many options available for clojure 
>> where few are built upon others. So if I am to learn one, which framework 
>> does the community recommend? 
>>
>> Thanks
>> Aravindh.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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Can't start repl with Leiningen

2014-02-26 Thread Matej Fröbe
Debian jessie 32-bit

Am Mittwoch, 26. Februar 2014 15:50:19 UTC+1 schrieb John Gabriele:
>
> On Wednesday, February 26, 2014 3:19:43 AM UTC-5, Matej Fröbe wrote:
>>
>> It seems that this is independent of where I run the project.
>>
>>>

> Matej,
>
> What OS (and version) are you using?
>  
>

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


Re: error in website text

2014-02-26 Thread John Gabriele
On Wednesday, February 26, 2014 10:01:16 AM UTC-5, Janek Warchoł wrote:
>
> Then it seems that i have completely misunderstood the point of that 
> paragraph - it may be worth rewording it.
> Anyway, thanks for explanation.  Best,
> Janek
>

Could be changed to: "It endeavors to be a general-purpose language, 
suitable for use in the same areas as Java."

-- 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Help with data structures and dereferencing

2014-02-26 Thread Robert Quinn
david, 

I think you're right.  I've complicated things by conflating the two 
concepts.

the overall structure of the data is a graph. when you look at an entity 
and their relationships it's a tree.  entity (LHS) has a set of 
relationships.  that was my reason for even thinking a zipper might help to 
maintain the RHS state.  

i'm trying to pass data between the "business functions" but I need them to 
have access to the latest state.  I was trying not couple/expose the 
business functions to data access ("utility functions") so that's where the 
complexity got introduced.

the embedded functions are doing exactly what you suggest, they look up the 
related entities using the references.  the advantage (i thought) of having 
the functions embedded in the data is that the business functions don't 
have any control logic to choose an appropriate utility function, they just 
invoke the function provided to them.

my concern was that i was missing some clojure idiom for "hiding" whether a 
data structure was fully populated vs. requiring an explicit look ups.  i 
think the answer is no, unless I can figure out some way of changing the 
behavior of (:rels entity) to do the lookup, the business function has to 
know that it's getting a function that must be invoked.

I appreciate your help.

robert


On Tuesday, February 25, 2014 10:18:52 PM UTC-5, David Della Costa wrote:
>
> You are saying a zipper may be a solution--so do you have a tree or 
> graph structure? 
>
> If your RHS value is something that changes over time but has an 
> identity independent of its relationship to other nodes, then retrieving 
> or constructing its value could simply be a function or set of 
> functions--or just a lookup in a table--once you have access to its key, 
> could it not? 
>
> At least based on your description, it seems like you are complicating 
> the design by conflating two different things: accessing the most recent 
> value of the RHS value and establishing ways to look up values based on 
> their node relationships. 
>
> (2014/02/26 1:35), Robert Quinn wrote: 
> > David, 
> > 
> > thanks for the reply.  I started down that path.   
> > 
> > RHS is an entity itself.  Its state changes over time, with Identity 
> > independent of its relationships, it can be related to many entities 
> > (LHS).  So its state has to live in one place or employ synchronization 
> > (complex watchers?).  I remember seeing a reference to zipper 
> > functionality that seemed to imply a possible solution, I'll try to find 
> > that again.. 
> > 
> > Thanks, 
> > 
> > Robert 
> > 
> > 
> > 
> > 
> > 
> > On Tuesday, February 25, 2014 10:26:30 AM UTC-5, David Della Costa 
> wrote: 
> > 
> > Is there no way to simply structure the maps inside your main atom 
> in 
> > such a way that you can look up your entities? 
> > 
> > {lhs-uuid1 {rhs-uuid1 ["values"] rhs-uuid2 ["values"]}} 
> > 
> > (get-in @myatom [lhs-uuid1 rhs-uuid2]) 
> > 
> > You can wrap this in a function that does some other work to look it 
> up 
> > if need be, if the result of the above is nil (for example)...etc. 
> > 
> > Seems like you're making things more complicated than they need to 
> be 
> > here, but it's hard to know without knowing more about your data. 
> > 
> > But if I were you I would start there, as I've found thinking hard 
> > about 
> > the structure of your data and and using the facilities provided by 
> the 
> > standard library usually helps simplify things tremendously. 
> > 
> > (2014/02/25 23:14), Robert Quinn wrote: 
> > > new to clojure, in the process of unlearning years of OO.  sorry 
> > for the 
> > > long post. 
> > > 
> > > struggling with a design/impl and hoping to get some outside 
> > opinions so 
> > > I can understand my options (clojure better) 
> > > 
> > > basic concepts are straightforward and in a nutshell I'm modeling 
> > > entities and relationships  (aren't we all) 
> > > 
> > > --- 
> > > 
> > > created a pool of entities (people and groups) implemented as 
> maps. 
> > >  each map has a :rels which is set of relationships to other 
> > entities. 
> > >  the pool is an atom. 
> > > 
> > > first approach; relationships are in the entity, add RHS entities 
> > into 
> > > the LHS :rels.  the state of the RHS can change, I need the latest 
> > state 
> > > of RHS not as it was when the relationship was created. I decided 
> > not to 
> > > make each entity a ref (ref, atom, agent), it seemed too fine 
> > grained. 
> > > *thoughts?* 
> > > 
> > > each entity has a uuid 
> > > 
> > > second approach, a pool of relationships (:lhs uuid :rhs uuid 
> > :type x). 
> > > pool has all the relationships, also an atom.  the pool has lots 
> of 
> > > benefits it "improves" other parts of the code. 
> > > 
> > > it doesn't solve the original

Re: error in website text

2014-02-26 Thread Janek Warchoł
Then it seems that i have completely misunderstood the point of that 
paragraph - it may be worth rewording it.
Anyway, thanks for explanation.  Best,
Janek

W dniu środa, 26 lutego 2014 15:20:08 UTC+1 użytkownik Fogus napisał:
>
> I do believe that the sentence is correct as written.  That is, 
> Clojure strives to solve the same kinds of problems that Java is 
> typically used to solve. 
>
> On Wed, Feb 26, 2014 at 8:58 AM, Janek Warchoł 
> > wrote: 
> > Hello, 
> > 
> > On clojure.org/rationale there is a sentence 
> > 
> >> It endeavors to be a general-purpose language suitable in those areas 
> >> where Java is suitable 
> > 
> > 
> > It seems that a "not" is missing at the end. 
> > 
> > best, 
> > Janek Warchoł 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> > Note that posts from new members are moderated - please be patient with 
> your 
> > first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com  
> > For more options, visit this group at 
> > http://groups.google.com/group/clojure?hl=en 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Clojure" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to clojure+u...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>
>
>
> -- 
> -- http://blog.fogus.me 
> -- http://github.com/fogus 
> -- 
>

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


Re: Can't start repl with Leiningen

2014-02-26 Thread John Gabriele
On Wednesday, February 26, 2014 3:19:43 AM UTC-5, Matej Fröbe wrote:
>
> It seems that this is independent of where I run the project.
>
>>
>>>
Matej,

What OS (and version) are you using?
 

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


Re: error in website text

2014-02-26 Thread haosdent
I think "not" isn't missing. ;-)


On Wed, Feb 26, 2014 at 9:58 PM, Janek Warchoł <
lemniskata.bernoull...@gmail.com> wrote:

> Hello,
>
> On clojure.org/rationale there is a sentence
>
> It endeavors to be a general-purpose language suitable in those areas
>> where Java is suitable
>
>
> It seems that a "not" is missing at the end.
>
> best,
> Janek Warchoł
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Best Regards,
Haosdent Huang

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


Re: error in website text

2014-02-26 Thread Michael Fogus
I do believe that the sentence is correct as written.  That is,
Clojure strives to solve the same kinds of problems that Java is
typically used to solve.

On Wed, Feb 26, 2014 at 8:58 AM, Janek Warchoł
 wrote:
> Hello,
>
> On clojure.org/rationale there is a sentence
>
>> It endeavors to be a general-purpose language suitable in those areas
>> where Java is suitable
>
>
> It seems that a "not" is missing at the end.
>
> best,
> Janek Warchoł
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- http://blog.fogus.me
-- http://github.com/fogus
--

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


error in website text

2014-02-26 Thread Janek Warchoł
Hello,

On clojure.org/rationale there is a sentence 

It endeavors to be a general-purpose language suitable in those areas where 
> Java is suitable


It seems that a "not" is missing at the end. 

best,
Janek Warchoł

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


Re: Source code reloading with leiningen checkouts

2014-02-26 Thread Sven Richter
Hi,

I tried it with a junction already and tried it now once more with the tool 
you provided as a link. It still does not work.
This are the project.clj of the two projects:

(defproject
  lweb
  "0.1.0-SNAPSHOT"
  :repl-options
  {:init-ns lweb.repl}
  :dependencies
  [[ring-server "0.3.1"]
dependencies
...
   ; own ones
   [friendui "0.1.0-SNAPSHOT"] ;my own project i am linking to
   ; added ones
...]
  :cljsbuild
  {:builds
[
 {:source-paths ["src-cljs/epics"],
  :compiler
{:pretty-print false,
 :output-to "resources/public/js/cljs/epics-cljs.js",
 :externs ["resources/public/js/canvas-externs.js"]
 :optimizations :advanced}}
   }
  :ring
  {:handler lweb.handler/app,
   :init lweb.handler/init,
   :destroy lweb.handler/destroy}
  :profiles
  {:uberjar {:aot :all},
   :production
   {:ring
{:open-browser? false, :stacktraces? false, :auto-reload? false}},
   :dev
   {:dependencies [[ring-mock "0.1.5"] [ring/ring-devel "1.2.1"]],
:env {:dev true}}}
  :url
  "http://example.com/FIXME";
  :main
  lweb.core
  :plugins
  [[lein-ring "0.8.10"] [lein-environ "0.4.0"] [lein-cljsbuild "1.0.2"]]
  :description
  "FIXME: write description"
  :min-lein-version "2.0.0")


The project.clj of the linked project:
(defproject friendui "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME";
  :license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
 [com.datomic/datomic-pro "0.9.4556"]
 [midje "1.6.2" :scope "test"]
 [org.clojure/core.cache "0.6.3"]
 [com.cemerick/friend "0.2.0"]]
  :plugins [[lein-midje "3.1.1"]]
  :test-paths ["test" "test/resources"]
  )


Maybe you see the problem?

Best Regards,
Sven


Am Mittwoch, 26. Februar 2014 10:28:06 UTC+1 schrieb Niels van Klaveren:
>
> Windows (7) has different versions of linking. For checkouts to work on 
> Windows 7 you need to have a *junction* to the directory, not a symbolic 
> link.
> I make mine with Link Shell Extension for Windows 
> Explorer, 
> and have no problems.
>
> On Monday, February 24, 2014 6:46:20 AM UTC+1, Sven Richter wrote:
>>
>> Hi,
>>
>> I already posted this on SO, but as I got no answer there yet I will try 
>> here too.
>>
>> I have two clojure projects, one a luminus project (main) with http-kit 
>> and a second (sub) plain clojure project with a single dependency to 
>> datomic.
>> Now I added the checkouts folder to "main" and inside made a link to 
>> "sub".
>> When I start "main" with "lein run -dev" "sub" is recognized and put on 
>> the classpath, however, every change I do to "sub" source files are not 
>> recognized until I restart my server.
>>
>> I am working on W7 with Oracle JDK7 and created the link with windows 
>> mklink tool. Any Ideas what might be wrong here?
>>
>> Best Regards,
>> Sven
>>
>

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


[ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-02-26 Thread Peter Taoussanis
Hi folks,

Quick post to announce a new lib release: 
https://github.com/ptaoussanis/sente

>From the README:
*Sente* is small client+server library that makes it easy to build *reliable, 
high-performance realtime web applications with Clojure*.

* *Bidirectional a/sync comms* over both *WebSockets* and *Ajax* 
(auto-selecting).
* *Robust*: auto keep-alives, buffering, mode fallback, reconnects.
* edn rocks. So *send edn, get edn*: no json here.
* *Tiny, simple API*: make-channel-socket! and you're good to go.
* Automatic, sensible support for users connected with *multiple clients* 
and/or 
devices simultaneously.
* *Flexible model*: use it anywhere you'd use WebSockets or Ajax.
* *Fully documented, with examples* (more forthcoming).
* Small: *less than 600 lines of code* for the entire client+server 
implementation.
* *Supported servers*: currently only http-kit, but easily extended.

---
Have been using something like this in production since a little after 
core.async came out, and wouldn't want to go back. Note that I tweaked a 
few things for the public release so there may be some rough edges 
initially. 

An example project's included (new as of today) and there's a Leiningen 
alias configured to handle all the fiddly bits like getting the Cljx and 
Cljs to compile: just download, `lein start-dev` at a terminal, and you're 
good to go.

Any questions/problems/whatever, you can reach me here or on GitHub.

That's it! Happy hacking, cheers! :-)
- *Peter Taoussanis*
https://twitter.com/ptaoussanis
https://www.taoensso.com/clojure-libraries

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


Re: How to override the default port on 3000?

2014-02-26 Thread action
It's ok! Think you for all the answer!

在 2014年2月25日星期二UTC+8下午10时21分05秒,action写道:
>
> I do like this:
> #lein new compojure-app guestbook
> #cd guestbook
> #lein ring server
>
> The server runs on port 3000 by default. 
> But how to override the default port?
> Such as runs on port 80?
>
> thinks
>
>
>

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


Re: Clojure / polyglot position at OpinionLab in Chicago

2014-02-26 Thread John Jacobsen
On Monday, February 24, 2014 8:46:58 PM UTC-6, Devin Walters (devn) wrote:
>
> It seems like this comes up with many of the job posts. Perhaps we should 
> have some guidelines around what details should be provided in the average 
> job post to cut down on some of the noise that follows.
>

That might be helpful; I was a little unsure what would be appropriate.  

In any event, I am really encouraged by the number of Clojure positions 
> that are popping up. 
>

Me too!  Though I'm not a recruiter or even a manager, as a passionate 
Clojurian, I like to see what jobs are being posted for this (still 
relatively small) community -- no matter what physical location.

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Comparing Regular Expression pattens for equality?

2014-02-26 Thread Jan Herich
Clojure re-uses java.util.regex.Pattern objects. This object doesn't 
override equals method, 
so object references are always compared. But you can easily get pattern 
string from compiled
pattern and then compare just them: 

user=> (= (.pattern #"test") (.pattern #"test"))
true

Dňa streda, 26. februára 2014 12:55:17 UTC+1 Thomas napísal(-a):
>
> Hi Everyone,
>
> I am creating some regular expressions programmatically with re-pattern. 
> In order to avoid creating the same regex pattern again I want to check if 
> it already exists. But comparing regex pattern doesn't seem to be work:
>
> user=> (= #"test" #"test")
> false
> user=> (identical? #"test" #"test")
> false
>
> Not surprised that identical? doesn't work to be honest, but "=" should 
> have worked IMHO
>
> Is there a way to do this?
>
> TIA
>
> Thomas
>

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


Re: Comparing Regular Expression pattens for equality?

2014-02-26 Thread Michael Gardner
You can compare the output of the .pattern or .toString methods if all you care 
about is finding regexes made from the exact same patterns. There's no simple 
way to detect equivalent regexes made from different patterns, though.

As for why = doesn't do this, you'd have to talk to the Java folks about that 
(since Clojure's = just calls .equals on Java objects). I suspect it has to do 
with the problem of equivalent patterns.

On Feb 26, 2014, at 05:55 , Thomas  wrote:

> Hi Everyone,
> 
> I am creating some regular expressions programmatically with re-pattern. In 
> order to avoid creating the same regex pattern again I want to check if it 
> already exists. But comparing regex pattern doesn't seem to be work:
> 
> user=> (= #"test" #"test")
> false
> user=> (identical? #"test" #"test")
> false
> 
> Not surprised that identical? doesn't work to be honest, but "=" should have 
> worked IMHO
> 
> Is there a way to do this?
> 
> TIA
> 
> Thomas
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

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


Comparing Regular Expression pattens for equality?

2014-02-26 Thread Thomas
Hi Everyone,

I am creating some regular expressions programmatically with re-pattern. In 
order to avoid creating the same regex pattern again I want to check if it 
already exists. But comparing regex pattern doesn't seem to be work:

user=> (= #"test" #"test")
false
user=> (identical? #"test" #"test")
false

Not surprised that identical? doesn't work to be honest, but "=" should 
have worked IMHO

Is there a way to do this?

TIA

Thomas

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


Re: Is there a function to determine if code is run as script or library ?

2014-02-26 Thread Rob Day
'lein run -m ' will run the "main-" function of a
namespace, which otherwise won't be run unless deliberately invoked
(like all functions). Is that what you're looking for?

(See https://github.com/technomancy/leiningen#basic-usage).

On 26 February 2014 09:57, Aaron France  wrote:
>
> Hi,
>
>
> You can implement https://github.com/clojure-cookbook/my-daemon for
> your application. I've had great success with this.
>
> Aaron
>
> On Wed, Feb 26, 2014 at 01:50:43AM -0800, macdevign mac wrote:
>>Hi,
>>is there a function to determine if the clojure code is running as library
>>or as script ?
>>
>>In ruby, there is
>>
>>  if __FILE__==$0
>># this will only run if the script was the main, not load'd or require'd
>>  end
>>
>>  In Java, we could include main method in class, and choose to run it,
>>
>>  How about clojure ?
>>
>>  Is there any function/macro like the following ?
>>
>>  (run-main
>>(code ..))
>>
>>so that it can be run standalone, or it can be ignored running as
>>library.   I find this useful for quick experimenting.
>>
>>thank
>>
>>--
>>You received this message because you are subscribed to the Google
>>Groups "Clojure" group.
>>To post to this group, send email to clojure@googlegroups.com
>>Note that posts from new members are moderated - please be patient with
>>your first post.
>>To unsubscribe from this group, send email to
>>clojure+unsubscr...@googlegroups.com
>>For more options, visit this group at
>>http://groups.google.com/group/clojure?hl=en
>>---
>>You received this message because you are subscribed to the Google Groups
>>"Clojure" group.
>>To unsubscribe from this group and stop receiving emails from it, send an
>>email to clojure+unsubscr...@googlegroups.com.
>>For more options, visit https://groups.google.com/groups/opt_out.

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


Re: Interested in GSOC

2014-02-26 Thread Rohan Prinja
Hi Maik, thanks for the pointers! Will follow up on protocols and the Data 
Set implementation as mentioned.

On Wednesday, 26 February 2014 03:24:00 UTC+5:30, Maik Schünemann wrote:
>
> Hi, 
>
> On Tue, Feb 25, 2014 at 8:59 PM, Rohan Prinja 
> > 
> wrote: 
> > Hi everyone. I'm Rohan Prinja, a third year Computer Science undergrad 
> at 
> > IIT Bombay. I love programming in Lisp-family languages and although I 
> have 
> > only recently begun to use Clojure, I'm already quite familiar with 
> Racket 
> > and Common Lisp. I also have a basic knowledge of the J programming 
> > language. 
> > 
> > I am really interested in furthering my knowledge of Clojure while at 
> the 
> > same time producing some meaningful contributions and in my opinion, 
> > contributing to open source via GSoC is the best way for me to do that! 
> I second you on that. I participated in GSoC last year on the project 
> Algebraic Expressions 
> and it was a very good experience and I definitly learned a lot by doing 
> it. 
> > I went through the project ideas list and I feel that the Linear Algebra 
> for 
> > Clojure project is the best one for me because I have a strong 
> foundation in 
> > Linear Algebra. 
> I would be very happy if you manage to work on this project. Having 
> support for the 
> linear algebra operations is a long standing issue in core.matrix. 
> Also Mike did a fantastic job mentoring me last year ;) 
> > Please give me some suggestions on understanding and learning more about 
> the 
> > project. So far I've seen the Enter the Matrix Clojure conj talk and 
> have 
> > begun browsing the core.matrix source on Github. What other things can I 
> do? 
> I think it is good to contact Mike Anderson (mikera on this 
> list) directly for your gsoc specific questions regarding this project 
> idea and what you can do 
> to prepare yourself for it. Here are some of my ideas of what you could 
> do: 
> You should learn how clojure protocols are working and figure out how 
> the code flows in 
> core.matrix. 
> Also, watch the numerical clojure mailing list and get involved 
> https://groups.google.com/forum/#!forum/numerical-clojure 
> (There is currently an active discussion about a Data Set 
> implementation of core.matrix 
>  which could be a good starting point) 
>
> greetings 
> Maik 
>

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


Re: Is there a function to determine if code is run as script or library ?

2014-02-26 Thread Aaron France

Hi,


You can implement https://github.com/clojure-cookbook/my-daemon for
your application. I've had great success with this.

Aaron

On Wed, Feb 26, 2014 at 01:50:43AM -0800, macdevign mac wrote:
>Hi,
>is there a function to determine if the clojure code is running as library
>or as script ?
> 
>In ruby, there is
> 
>  if __FILE__==$0
># this will only run if the script was the main, not load'd or require'd
>  end
> 
>  In Java, we could include main method in class, and choose to run it,
> 
>  How about clojure ?
> 
>  Is there any function/macro like the following ?
> 
>  (run-main
>(code ..)) 
> 
>so that it can be run standalone, or it can be ignored running as
>library.   I find this useful for quick experimenting.
> 
>thank
> 
>--
>You received this message because you are subscribed to the Google
>Groups "Clojure" group.
>To post to this group, send email to clojure@googlegroups.com
>Note that posts from new members are moderated - please be patient with
>your first post.
>To unsubscribe from this group, send email to
>clojure+unsubscr...@googlegroups.com
>For more options, visit this group at
>http://groups.google.com/group/clojure?hl=en
>---
>You received this message because you are subscribed to the Google Groups
>"Clojure" group.
>To unsubscribe from this group and stop receiving emails from it, send an
>email to clojure+unsubscr...@googlegroups.com.
>For more options, visit https://groups.google.com/groups/opt_out.


pgppAIwuaJSxV.pgp
Description: PGP signature


Is there a function to determine if code is run as script or library ?

2014-02-26 Thread macdevign mac
Hi, 
is there a function to determine if the clojure code is running as library 
or as script ? 

In ruby, there is 

if __FILE__==$0
  # this will only run if the script was the main, not load'd or require'dend

In Java, we could include main method in class, and choose to run it,

How about clojure ?

Is there any function/macro like the following ?

(run-main 
  (code ..))  


so that it can be run standalone, or it can be ignored running as 
library.   I find this useful for quick experimenting.

thank


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


Re: Source code reloading with leiningen checkouts

2014-02-26 Thread Shantanu Kumar


On Wednesday, 26 February 2014 14:58:06 UTC+5:30, Niels van Klaveren wrote:
>
> Windows (7) has different versions of linking. For checkouts to work on 
> Windows 7 you need to have a *junction* to the directory, not a symbolic 
> link.
> I make mine with Link Shell Extension for Windows 
> Explorer, 
> and have no problems.
>

This is useful information. I think it would be useful to mention this on 
the Leiningen Wiki page that explains checkouts.

Shantanu

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


Re: Source code reloading with leiningen checkouts

2014-02-26 Thread Niels van Klaveren
Windows (7) has different versions of linking. For checkouts to work on 
Windows 7 you need to have a *junction* to the directory, not a symbolic 
link.
I make mine with Link Shell Extension for Windows 
Explorer, 
and have no problems.

On Monday, February 24, 2014 6:46:20 AM UTC+1, Sven Richter wrote:
>
> Hi,
>
> I already posted this on SO, but as I got no answer there yet I will try 
> here too.
>
> I have two clojure projects, one a luminus project (main) with http-kit 
> and a second (sub) plain clojure project with a single dependency to 
> datomic.
> Now I added the checkouts folder to "main" and inside made a link to "sub".
> When I start "main" with "lein run -dev" "sub" is recognized and put on 
> the classpath, however, every change I do to "sub" source files are not 
> recognized until I restart my server.
>
> I am working on W7 with Oracle JDK7 and created the link with windows 
> mklink tool. Any Ideas what might be wrong here?
>
> Best Regards,
> Sven
>

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


Re: Can't start repl with Leiningen

2014-02-26 Thread Matej Fröbe
It seems that this is independent of where I run the project. It happens 
with default project, which has no ":eval-in :trampoline" in it:













*$ lein new my-project$ cat my-project/project.clj (defproject my-project 
"0.1.0-SNAPSHOT"  :description "FIXME: write description"  :url 
"http://example.com/FIXME";  :license {:name "Eclipse Public 
License":url "http://www.eclipse.org/legal/epl-v10.html"}  
:dependencies [[org.clojure/clojure "1.5.1"]])$ cd my-project/$ lein 
replREPL server launch timed out.*
And it also happens if I run lein repl outside of any project.

I have already used repl on this machine in the past and I noticed the 
problem when I tried to use cider. I just assumed that the problem was in 
emacs packages (I think I tried cider instead of nrepl at the time) but 
didn't have time to check. Now I see that I can't even run repl with 
leiningen.

I suspect some update of some package (jdk maybe?). I didn't find anything 
in apt-get and dpkg logs, but they might not cover long enough time range. 
The problem is that I don't know when did this start, as I almost didn't 
use clojure in the last two months.



Am Dienstag, 25. Februar 2014 21:16:31 UTC+1 schrieb Zach Oakes:
>
> Matej, does this happen to you when you run "lein repl" outside of a 
> project? If so, can you show us what your project.clj file looks like? I 
> know for a fact that if you have ":eval-in :trampoline" in it, the repl 
> will fail with that error.
>
> On Tuesday, February 25, 2014 2:56:04 PM UTC-5, Matej Fröbe wrote:
>>
>> Hi John,
>>
>> Thank you for your answer. I have tried this already, but it doesn't help.
>>
>> Any other suggestions, how to find the cause of the problem?
>>
>> Matej
>>
>>
>> Am Dienstag, 25. Februar 2014 19:51:51 UTC+1 schrieb John Gabriele:
>>>
>>> On Sunday, February 23, 2014 4:32:54 PM UTC-5, Matej Fröbe wrote:

 Hello Clojure users!

 I have a problem with running
 *$lein repl*
 After some time I get: *REPL server launch timed out.*

 *$lein run myproject* works fine

 Leiningen and Java versions are:

 *$lein versionLeiningen 2.3.4 on Java 1.7.0_21 OpenJDK Client VM*

 I tried deleting stuff in ~/.lein but it doesn't help.

 Any suggestions how to solve this?

 Thanks,

 Matej


>>> Hi Matej,
>>>
>>> Have never seen this problem. You might try starting fresh by deleting 
>>> your local repo (~/.m2) too, and re-downloading the `lein` script.
>>>
>>> -- 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.