Re: [ANN] edn.el

2015-04-15 Thread Bozhidar Batsov
Using EDN instead of bencode with nREPL  CIDER comes to mind. Leveraging
the socketed REPL in Clojure 1.7 from Emacs would be another idea.

On 14 April 2015 at 00:25, Blake Miller blak3mil...@gmail.com wrote:

 Cool! May I ask what your motivation was for this?


 On Saturday, April 11, 2015 at 3:09:28 AM UTC-7, Lars Andersen wrote:

  https://github.com/expez/edn.el

 is a library for reading an writing edn from emacs lisp.

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


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


Re: [ANN] edn.el

2015-04-15 Thread Lars Andersen
In addition to what Bozhidar mentioned:

I also work on https://github.com/clojure-emacs/clj-refactor.el which 
communicates with a backend, 
https://github.com/clojure-emacs/refactor-nrepl, which is written in 
clojure.  For now we've been limiting ourselves to data structures which 
are eaily readable in emacs lisp (strings, lists, association lists etc) 
but for more complex values I'd like to use edn and edn.el.

I've also realized that when I need a 'client' for something, hacking 
together something in emacs is incredibly easy.  I often feel like I get 
more than the proverbial 80% when I invest 20% of my efforts on top of 
emacs :)  Take a look at this incredibly cool demo of a REST client written 
in emacs: http://emacsrocks.com/e15.html

On Monday, April 13, 2015 at 11:25:20 PM UTC+2, Blake Miller wrote:

 Cool! May I ask what your motivation was for this?

 On Saturday, April 11, 2015 at 3:09:28 AM UTC-7, Lars Andersen wrote:

  https://github.com/expez/edn.el 

 is a library for reading an writing edn from emacs lisp.



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


Re: [ANN] edn.el

2015-04-15 Thread Blake Miller
Lars, Bozhidar,

Thank you so much for the explanation, and for the excellent libs, I
appreciate it! I am using clj-refactor ... and it's rad. I will have to
read about the socketed REPL.

On Wed, Apr 15, 2015 at 10:37 AM, Lars Andersen ex...@expez.com wrote:

 In addition to what Bozhidar mentioned:

 I also work on https://github.com/clojure-emacs/clj-refactor.el which
 communicates with a backend,
 https://github.com/clojure-emacs/refactor-nrepl, which is written in
 clojure.  For now we've been limiting ourselves to data structures which
 are eaily readable in emacs lisp (strings, lists, association lists etc)
 but for more complex values I'd like to use edn and edn.el.

 I've also realized that when I need a 'client' for something, hacking
 together something in emacs is incredibly easy.  I often feel like I get
 more than the proverbial 80% when I invest 20% of my efforts on top of
 emacs :)  Take a look at this incredibly cool demo of a REST client written
 in emacs: http://emacsrocks.com/e15.html


 On Monday, April 13, 2015 at 11:25:20 PM UTC+2, Blake Miller wrote:

 Cool! May I ask what your motivation was for this?

 On Saturday, April 11, 2015 at 3:09:28 AM UTC-7, Lars Andersen wrote:

  https://github.com/expez/edn.el

 is a library for reading an writing edn from emacs lisp.

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


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


Re: Composing Stuart Sierra's components

2015-04-15 Thread Dan Kee
Sorry to resurrect an old thread with a somewhat tangential question but...

I'm seeing strange behavior in nesting systems that I am hoping someone can 
explain.  I have two independent systems as components of a super system, 
with an artificial dependency to attempt to enforce ordering of starting 
them.  When I start the super system, the first system starts, then the 
second, then first system is started again and I don't understand why. 
 I've since realized much simpler, more obvious ways to accomplish this, 
but I'd like to understand what I'm seeing.

Code (apologies for the macro, but it keeps things brief):

```
(ns component-debug   
  (:require [com.stuartsierra.component :as c]) ) 
  
(defn capitalize-symbol [s]   
  (symbol (clojure.string/capitalize (str s))) )  
  
(defmacro make-example-component [name]   
  (let [capitalized-name (capitalize-symbol name)]
`(do  
   (defrecord ~capitalized-name []
 c/Lifecycle  
 (start [~name]   
   (println (str Starting  '~name)) 
   (assoc ~name :started true) )  
  
 (stop [~name]
   (println (str Stopping  '~name)) 
   (assoc ~name :started false) ) )   
  
   (defn ~(symbol (str new- name)) []   
 (~(symbol (str map- capitalized-name)) {}) ) ) ) )
  
(make-example-component foo)  
(make-example-component bar)  
(make-example-component baz)  
(make-example-component qux)  
  
(defn new-system []   
  (c/system-map   
   :foo (new-foo) 
   :bar (c/using  
 (new-bar)
 [:foo] ) ) ) 
  
(defn new-system2 []  
  (c/system-map   
   :baz (new-baz) 
   :qux (c/using  
 (new-qux)
 [:baz] ) ) ) 
  
(defn new-super-system [] 
  (c/system-map   
   :system (new-system)   
   :system2 (c/using  
 (new-system2)
 [:system] ) ) )  
  
(defn -main [ args]  
  (c/start (new-super-system)) )  
```

Output:

```
Starting foo
Starting bar
Starting baz
Starting qux
Starting foo
Starting bar
```

Thank you!

--Dan

On Wednesday, March 18, 2015 at 8:51:17 AM UTC-5, platon...@gmail.com wrote:

 A possible implementation for the idea expressed in the previous post - 
 https://github.com/stuartsierra/component/pull/25


 On Wednesday, March 18, 2015 at 2:41:46 PM UTC+1, platon...@gmail.com 
 wrote:

 I've also been investigating the nested system approach/problem.

 The primary use case that I have is composing subsystems which are mostly 
 independent modules using a higher order system to run in one process. The 
 modules themselves can be easily extracted into separate applications thus 
 becoming their own top level systems which makes it desirable to keep their 
 system maps intact. 

 Components inside modules might depend on the *whole* modules, not their 
 constituent parts. This allows to have modules call each other through the 
 API's in-process as well as being easily replaced by remote endpoints when 
 separated into multiple processes.

 This mostly works except for the components depending on other 
 modules/systems, e.g.:

 (require '[com.stuartsierra.component :as cmp])

 (defrecord X [x