Re: What's clojure killer app? I don't see any.

2014-06-15 Thread gamma235
Hi Paulo, 

I saw this question a while back and for some reason it became lodged in my 
mind. If you are concerned about whether Clojure is a good practical 
language to learn, I can understand your worries and say, resoundingly, go 
for it. Why? because after learning Clojure, and perhaps answering the 
question of "what is special about it?" rather than "what is the killer 
app" you will understand the underpinnings and inner-workings of so many 
important but very opaque concepts: data, language design principles, 
identity and state. I used many languages before I came to Clojure but I 
would say that it was through Clojure that I really learned computer 
science, making me a more valuable programmer. Clojure is a language for 
people who are interested in "sane", pragmatic approaches to language 
design in terms of mutability, primitives and the relationship between the 
data and its code representation (spoiler, in Lisps they are elegantly one 
and the same thing). Rich Hickey, at every step of the way thoughtfully 
designed a language for programmers to be effective with. So to reiterate, 
learning Clojure is not just about learning how to use Clojure, but also 
about learning why it is designed how it is. And that is groovy.

The reason I picked up Clojure was not to get a job, but because I thought 
it was cool. People who are focussed on industry from the beginning just 
take what they hear and run with it. They ignore Clojure because it is not 
on the top of the popular usage charts. If you can get past industrial 
adoption of Clojure apps and look at things from the perspective of a 
learner, you will see that Clojure has many "stories": a concurrency story, 
a Lisp story, a logic programming story, an asynchronous story. Name a 
feature and Clojure has it going on. This makes learning it an efficient 
use of your time: you can learn one language, write a 10th of the code you 
would otherwise, and tackle an incredibly wide range of problems that you 
would be using multiple languages to do otherwise. It has a front end 
story, a back end story, a dynamic story, a functional story... And all of 
these "stories" are possible due to the incredible library ecosystem that 
Clojure has, as well as the enthusiastic and creative people that make up 
the Clojure community. These are people who love to learn and have fun 
through coding. Which brings me to my next point:

Clojure has an AMAZING community. Most of the time, when I have a dumb 
newbie question, if I ask it here, the very people who wrote the books I am 
reading will come clarify things for me, patiently helping me out. In other 
languages, however, if the question requires a non-trivial understanding of 
the way the language itself is implemented, those grandmasters are a lot 
less accessible. As a learner, why pass up this opportunity? I am not 
saying that other languages don't have great communities, but I am saying 
that I think Clojure has something special in this department. In fact, I 
was recommended to learn Clojure by a Haskell programmer for this very 
reason. Which is telling, because Haskell programmers really love and 
actively promote that language.

Now with all that said, the question was specifically about apps. I think 
that Datomic and Storm are both pretty freaking cool. Check them out. 
Twitter is heavy into Storm. I also know that Citibank is using Clojure, 
though for what exactly, I am not sure. But in light of the above, is this 
really what is attractive about learning the language? 

I hope you can get something out of my response. And best of luck learning 
one of the coolest languages out there!

J


On Friday, May 2, 2014 12:43:49 PM UTC+9, Paulo Suzart wrote:
>
> Really thanks. Great talk. 
> On 1 May 2014 21:21, "Ustun Ozgur" > 
> wrote:
>
>> Paulo, I understand your concerns, you are basically taking a bet in 
>> choosing Clojure and you want some confirmation that you will not be 
>> wasting time/money during the process.
>>
>> Please watch Jay Fields' talk on this topic. I think he presents the 
>> upsides and downsides of his journey very well. One remark is that it was 
>> very tiring, it has been like having a second job (he remarks that he 
>> luckily didn't have any children during the process IIRC) but it was worth 
>> it in the end.
>>
>>
>> http://yow.eventer.com/yow-2013-1080/lessons-learned-from-adopting-clojure-by-jey-fields-1397
>>
>> Ustun
>>
>> --
>> 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 unsubs

Re: Joy of Clojure example not working

2014-05-20 Thread gamma235
This did it Greg,

Thanks a lot.


On Wednesday, May 21, 2014 2:18:08 AM UTC+9, Greg D wrote:
>
> Yes, the examples in the book are missing some lines. I think the 
> following log shows what they were going for:
>
> joy.udp=> (remove-method compiler ::osx)
> joy.udp=> (def unix (into unix {::c-compiler "/usr/bin/gcc"}))
> joy.udp=> (def osx (into osx {:c-compiler "gcc"}))
> oy.udp=> osx
> {:home "/Users", :llvm-compiler "clang", :os :joy.udp/osx, 
> :joy.udp/prototype {:home "/home", :os :joy.udp/unix, :c-compiler "cc", 
> :dev "/dev"}, :c-compiler "gcc"}
> joy.udp=> unix
> {:home "/home", :joy.udp/c-compiler "/usr/bin/gcc", :os :joy.udp/unix, 
> :c-compiler "cc", :dev "/dev"}
> joy.udp=> (compiler osx)
> "gcc"
> joy.udp=> (compile-cmd osx)
> "/usr/bin/gcc"
>
> About your question:
>
>> Isn't there a core function/macro where I can derive and set hierarchy 
>> all at once?
>>
> Such a function would need to know in advance what hierarchy you want to 
> construct. If you have a desired pattern of hierarchy that you want to 
> reuse, you could define a function to create it using "derive" and 
> optionally "make-hierarchy". 
>
>
> On Monday, May 19, 2014 4:38:00 PM UTC-7, gamma235 wrote:
>>
>> I actually just wanna know why I need to use derive so many times. Isn't 
>> there a core function/macro where I can derive and set hierarchy all at 
>> once? I'm just looking for a more efficient way. My bad for not stating 
>> that more clearly in the original post. 
>>
>> The real problem though is the last two calls to compile-cmd. I've been 
>> messing with it for a couple of days so any help there would be well 
>> appreciated.
>>
>> Thanks
>>
>> J
>>
>>

-- 
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: Joy of Clojure example not working

2014-05-19 Thread gamma235
I actually just wanna know why I need to use derive so many times. Isn't there 
a core function/macro where I can derive and set hierarchy all at once? I'm 
just looking for a more efficient way. My bad for not stating that more clearly 
in the original post. 

The real problem though is the last two calls to compile-cmd. I've been messing 
with it for a couple of days so any help there would be well appreciated.

Thanks

J

-- 
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: Joy of Clojure example not working

2014-05-19 Thread gamma235
I actually just wanna know why I need to use derive so many times. Isn't there 
a core function/macro where I can derive and set hierarchy all at once? I'm 
just looking for a more efficient way. My bad for not stating that more clearly 
in the original post. 

The real problem though is the last two calls to compile-cmd. I've been messing 
with it for a couple of days so any help there would be well appreciated.

Thanks

J

-- 
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: Joy of Clojure example not working

2014-05-19 Thread gamma235

>
> It looks like it expects the keyword :osx, not the symbol osx. Could 
> that be the issue? 


Thanks for the suggestion, but when I try that instead, I get this error:

java.lang.IllegalArgumentException: No method in multimethod 'compiler' for 
dispatch value: null


I kind of feel it might be a typo in the compile-cmd function, cause 
instead of a sybol it is listing a vector with a name-spaced symbol and a 
string: * [::osx "gcc"]*. I think this form might have to do something with 
juxt in  *(defmulti compile-cmd (juxt :os compiler)) *. 
But I admit that I don't really understand what is going on here, as the 
book doesn't go all that far in explaining juxt, using keys as functions 
and how it relates to the defmethod syntax taking a vector in the beginning.

J 

On Monday, May 19, 2014 10:44:12 PM UTC+9, Rob Day wrote:
>
> It looks like it expects the keyword :osx, not the symbol osx. Could 
> that be the issue? 
>
> On 19 May 2014 16:39, gamma235 > wrote: 
> > Hi guys, I am working through the pre-release second edition of Joy of 
> > Clojure's section on multi-methods (section 9.2.~ : pg. 313), and am 
> getting 
> > different outputs from what they have printed in the book. I could just 
> skip 
> > over it, but I really want to understand this stuff. Could someone tell 
> me 
> > how to get the (compile-cmd osx) call at the end of the code to produce 
> the 
> > expected output:  "/usr/bin/gcc" ? I have commented out redundancy and 
> moved 
> > a couple of lines for readability. Thanks in advance! 
> > 
> > J 
> >> 
> >> (ns joy.udp 
> >>   (:refer-clojure :exclude [get])) 
> >> 
> >> (defn beget [this proto] 
> >>   (assoc this ::prototype proto)) 
> >> 
> >> (defn get [m k] 
> >>   (when m 
> >> (if-let [[_ v] (find m k)] 
> >>   v 
> >>   (recur (::prototype m) k 
> >> 
> >> (def put assoc) 
> >> 
> >> ;;; compiler 
> >> (defmulti compiler :os) 
> >> (defmethod compiler ::unix [m] (get m :c-compiler)) 
> >> (defmethod compiler ::osx [m] (get m :llvm-compiler)) 
> >> 
> >> (def clone (partial beget {})) 
> > 
> > 
> >> 
> >> (def unix {:os ::unix, :c-compiler "cc", :home "/home", :dev "/dev"}) 
> > 
> > 
> >> 
> >> (def osx (-> (clone unix) 
> >>  (put :os ::osx) 
> >>  (put :llvm-compiler "clang") 
> >>  (put :home "/Users"))) 
> >> 
> >> ;;; home 
> >> (defmulti home :os) 
> >> (defmethod home ::unix [m] (get m :home)) 
> >> (defmethod home ::bsd [m] "/home") 
> > 
> > 
> >> 
> >> ;; the error on the call to (home osx) is contingent upon toggling the 
> >> following lines. 
> >> 
> >> ;(derive ::osx ::unix) 
> >> ;(derive ::osx ::bsd) 
> >> (prefer-method home ::unix ::bsd) 
> >> ;(remove-method home ::bsd) 
> >> (derive (make-hierarchy) ::osx ::unix) 
> >> 
> >> ;;; compile-cmd 
> >> (defmulti compile-cmd (juxt :os compiler)) 
> >> 
> >> (defmethod compile-cmd [::osx "gcc"] [m] 
> >>   (str "/usr/bin/" (get m :c-compiler))) 
> >> 
> >> (defmethod compile-cmd :default [m] 
> >>   (str "Unsure where to locate " (get m :c-compiler))) 
> >> ;; 
> >> 
> >> (home osx) 
> >> 
> >> ;=> java.lang.IllegalArgumentException: No method in multimethod 'home' 
> >> for dispatch value: :joy.udp/osx … 
> >> 
> >>  ;; Should be: ;=> "/Users" 
> > 
> > 
> >> (compile-cmd osx) 
> >> 
> >> ;=> "Unsure where to locate cc" 
> >> 
> >>  ;; Should be: ;=> "/usr/bin/gcc" 
> > 
> > 
> >> 
> >> (compile-cmd unix) 
> >> 
> >> ;=> "Unsure where to locate cc" 
> >> 
> >> ;; this is the expected output 
> > 
> > -- 
> > 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 

Joy of Clojure example not working

2014-05-19 Thread gamma235
Hi guys, I am working through the pre-release second edition of Joy of 
Clojure's section on multi-methods (section 9.2.~ : pg. 313), and am 
getting different outputs from what they have printed in the book. I could 
just skip over it, but I really want to understand this stuff. Could 
someone tell me how to get the *(compile-cmd osx) *call at the end of the 
code to produce the expected output:  *"/usr/bin/gcc" *? I have commented 
out redundancy and moved a couple of lines for readability. Thanks in 
advance! 

J

> (ns joy.udp
>   (:refer-clojure :exclude [get]))
>
> (defn beget [this proto]
>   (assoc this ::prototype proto))
>
> (defn get [m k]
>   (when m
> (if-let [[_ v] (find m k)]
>   v
>   (recur (::prototype m) k
>
> (def put assoc)
>
> ;;; compiler
> (defmulti compiler :os)
> (defmethod compiler ::unix [m] (get m :c-compiler))
> (defmethod compiler ::osx [m] (get m :llvm-compiler))
>
> (def clone (partial beget {}))
>
 

> (def unix {:os ::unix, :c-compiler "cc", :home "/home", :dev "/dev"})
>
 

> (def osx (-> (clone unix)
>  (put :os ::osx)
>  (put :llvm-compiler "clang")
>  (put :home "/Users")))
>
> ;;; home
> (defmulti home :os)
> (defmethod home ::unix [m] (get m :home))
> (defmethod home ::bsd [m] "/home")
>
 

> ;; the error on the call to (home osx) is contingent upon toggling the 
> following lines. 

;(derive ::osx ::unix)
> ;(derive ::osx ::bsd)
> (prefer-method home ::unix ::bsd)
> ;(remove-method home ::bsd)   
> (derive (make-hierarchy) ::osx ::unix) 
>
> ;;; compile-cmd
> (defmulti compile-cmd (juxt :os compiler))
>
> (defmethod compile-cmd [::osx "gcc"] [m]
>   (str "/usr/bin/" (get m :c-compiler)))
>
> (defmethod compile-cmd :default [m]
>   (str "Unsure where to locate " (get m :c-compiler)))
> ;;
>
> (home osx) 
>
;=> java.lang.IllegalArgumentException: No method in multimethod 'home' for 
> dispatch value: :joy.udp/osx …
>
 ;; Should be: ;=> "/Users"


(compile-cmd osx)

;=> "Unsure where to locate cc" 

 ;; Should be: ;=> "/usr/bin/gcc"

 

> (compile-cmd unix)

;=> "Unsure where to locate cc"

;; this is the expected output 

-- 
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: Joy of Clojure question

2014-05-13 Thread gamma235
Okay, both these answers make lots of sense. thank you for your help. 

J

On Wednesday, May 14, 2014 11:47:51 AM UTC+9, Guru Devanla wrote:
>
> The call to (index) returns this vector 
>
> ([0 \:] [1 \a] [2 \space] [3 \4] [4 \space] [5 \:] [6 \b] [7 \space] [8 
> \1] [9 \space] [10 \:] [11 \c] [12 \space] [13 \3] [14 \space] [15 \:] [16 
> \d] [17 \space] [18 \4])
>
> And, 3 here is in the 13th position. Your (cond) in index function is 
> picking up the :else branch.
>
>
> On Tue, May 13, 2014 at 6:44 PM, gamma235 
> > wrote:
>
>> I am reading The Joy of Clojure now and am finishing chapter 5 on 
>> sequence abstractions. There is an example given that demonstrates how to 
>> locate the index of an element in a sequence by value, but I don't 
>> understand why the character lookup here is returning 13. Can somebody 
>> please explain this to me?
>>
>> (defn index [coll]
>>>   (cond
>>>(map? coll) (seq coll)
>>>(set? coll) (map vector coll coll)
>>>:else (map vector (iterate inc 0) coll)))
>>>
>>> (defn pos [pred coll]
>>>   (for [[i v] (index coll) :when (pred v)] i))
>>>
>>  
>>
>>> (pos \3 ":a 4 :b 1 :c 3 :d 4")   
>>
>>  
>>
>> => 13
>>
>>
>> J 
>>
>> -- 
>> 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/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.


Joy of Clojure question

2014-05-13 Thread gamma235
I am reading The Joy of Clojure now and am finishing chapter 5 on sequence 
abstractions. There is an example given that demonstrates how to locate the 
index of an element in a sequence by value, but I don't understand why the 
character lookup here is returning 13. Can somebody please explain this to 
me?

(defn index [coll]
>   (cond
>(map? coll) (seq coll)
>(set? coll) (map vector coll coll)
>:else (map vector (iterate inc 0) coll)))
>
> (defn pos [pred coll]
>   (for [[i v] (index coll) :when (pred v)] i))
>
 

> (pos \3 ":a 4 :b 1 :c 3 :d 4")   

 

=> 13


J 

-- 
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: using atoms as logs for channels in core.async

2014-05-13 Thread gamma235
Hi Gary, 

Your function looks interesting and succinct, but I am still new to this 
subject so am not sure how it would be used. Could you give some examples?

Jesse

On Wednesday, May 14, 2014 3:34:17 AM UTC+9, Gary Verhaegen wrote:
>
> What about the following? (as is bound to clojure.core.async ns) 
>
> (defn decorate-channel 
>   [chan at] 
>   (as/map> (fn [x] (swap! at conj x) x) 
>(as/map< (fn [x] (swap! at pop) x) 
>chan))) 
>
> As far as I can tell, it should do what you want, without introducing 
> global vars. It also returns a "normal" async channel that can be used 
> anywhere a channel is expected, without special handling. This could 
> be very handy for debugging. 
>
>
> On 13 May 2014 06:02, gamma235 > 
> wrote: 
> > 
> > Hey guys, I took your suggestions and just wanna deliver the finished 
> > product. I included the macro in there for practice, but agree it is 
> > probably not necessary. Thanks for all your help. 
> > 
> > p is for pretty :) 
> > 
> >> 
> >> (defn pchan [ch] 
> >> 
> >>   {:channel ch, :buffer (atom [])}) 
> > 
> > 
> >> 
> >> (defn pbuff [{:keys [ch buffer]}] 
> >>(println @buffer)) 
> > 
> > 
> >> 
> >> (defn pput [{:keys [channel buffer]} v] 
> >>   (do 
> >> (go 
> >>  (>! channel v)) 
> >> (swap! buffer conj v) 
> >> (println "put " v))) 
> > 
> > 
> >> 
> >> (defn ptake [{:keys [channel buffer]}] 
> >> (go 
> >>  (let [v ( >>(if-not (empty? @buffer) 
> >> (do 
> >>(swap! buffer pop) 
> >>(println "took " v) 
> >> (println "take pending ...")) 
> > 
> > 
> >> 
> >> (defmacro def-pchan 
> >>   ([name] 
> >>`(def ~name (pchan (chan 
> >>   ([name buff] 
> >>`(def ~name (pchan (chan ~buff) 
> > 
> > 
> >> 
> >> (defn clear-buffer [{:keys [buffer]}] 
> >>   (reset! buffer [])) 
> >> 
> > it works! 
> >> 
> >> (def-pchan pc) 
> >> (:buffer pc) 
> >> (pbuff pc) 
> >> (ptake pc) 
> >> (pput pc 42) 
> >> (clear-buffer pc) 
> > 
> > -- 
> > 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/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: go-circuit for clojure

2014-05-13 Thread gamma235
I get the feeling that Cognitect has about  four or five secret projects 
that they are going to unleash on the world, a ridonculously distributed 
asynchronous  networking system being one of them. Datomic is kind of a 
step in that direction, is it not?

-- 
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: using atoms as logs for channels in core.async

2014-05-12 Thread gamma235

Hey guys, I took your suggestions and just wanna deliver the finished 
product. I included the macro in there for practice, but agree it is 
probably not necessary. Thanks for all your help. 

p is for pretty :)
 

> (defn pchan [ch]
>   {:channel ch, :buffer (atom [])})
>
 

> (defn pbuff [{:keys [ch buffer]}]
>(println @buffer))
>
 

> (defn pput [{:keys [channel buffer]} v]
>   (do 
> (go 
>  (>! channel v))
> (swap! buffer conj v)
> (println "put " v)))
>
 

> (defn ptake [{:keys [channel buffer]}]
> (go 
>  (let [v ((if-not (empty? @buffer)
> (do 
>(swap! buffer pop)
>(println "took " v)
> (println "take pending ..."))
>
 

> (defmacro def-pchan
>   ([name]
>`(def ~name (pchan (chan
>   ([name buff]
>`(def ~name (pchan (chan ~buff)
>
 

> (defn clear-buffer [{:keys [buffer]}]
>   (reset! buffer []))
>
> it works!  

> (def-pchan pc)
> (:buffer pc)
> (pbuff pc)
> (ptake pc)
> (pput pc 42)
> (clear-buffer pc)

-- 
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: using atoms as logs for channels in core.async

2014-05-12 Thread gamma235
Ok the destructuring is clear to me now. And yes Jay Field article was great :)

So the only thing that remains now is to get the symbol being passed into my 
original transparent-put function to stop evaluating to either ch-log or 
clojure.core.async.impl.channels.ManyToManyChannel@5096B86b-log

I'm using your macro David but it still won't put with an update to the atom.


Jesse

-- 
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: using atoms as logs for channels in core.async

2014-05-12 Thread gamma235
m like this. 
> > 
> >> Later I was thinking about incorporating it into a gui to see 
> >> if it's possible to design an asynchronous message passing system 
> >> using drag and drop icons that represent pubs and subs, channels with 
> >> a drop-down contents tab, and running listening processes. 
> >> I know this is probably out of my league, but I was just asking 
> >> myself how something like that might be implemented. 
> > 
> > I think it's totally possible and there's no reason it would be out of 
> > your league. Just keep trying and asking questions here (and on IRC too 
> > if you want to jump on, plenty of folks there willing to help out). 
> > 
> > DD 
> > 
> > (2014/05/12 17:26), gamma235 wrote: 
> >> Thank you for your answer David. 
> >> 
> >> I think I am confused about how to distinguish between a symbol and a 
> >> variable, as I thought that the symbol being derefed pointed to the 
> atom 
> >> that it was made to define when transparent-chan was called. 
> >> 
> >> Also, I am trying to specifically solve the logging problem  to 
> >> understand how I might use stored values or state outside the scope of 
> >> the channel as a means of creating the illusion of referencing its 
> >> contents. Later I was thinking about incorporating it into a gui to see 
> >> if it's possible to design an asynchronous message passing system using 
> >> drag and drop icons that represent pubs and subs, channels with a 
> >> drop-down contents tab, and running listening processes. I know this is 
> >> probably out of my league, but I was just asking myself how something 
> >> like that might be implemented. I will of course continue to learn and 
> >> reinforce the basics though on my own. 
> >> 
> >> Jesse 
> >> 
> >> On Monday, May 12, 2014 1:26:57 PM UTC+9, David Della Costa wrote: 
> >> 
> >> I apologize, apparently you can't use go-loop how I did below, 
> >> 
> >> => (def my-go-loop (async/go-loop [msg (async/ >> msg " 
> >> msg " from channel " 'c))) 
> >> 
> >> ...try this instead: 
> >> 
> >> (def my-go-loop (async/go-loop [] (let [msg (async/ "got 
> >> msg " msg " from channel " 'c 
> >> 
> >> Sorry about that! 
> >> 
> >> DD 
> >> 
> >> (2014/05/12 13:21), Dave Della Costa wrote: 
> >> > 
> >> >> 1) I feel like it is a redundant to define bindings multiple 
> >> times in 
> >> >> my go's let exprs when the params have already been passed in as 
> >> >> arguments. Is there a more idiomatic way to do this? 
> >> > 
> >> > I think the fact that you are re-binding in a let should show you 
> >> that 
> >> > these variables are already in scope: that let is wholly 
> >> redundant, just 
> >> > remove it. 
> >> > 
> >> > 
> >> >> 2) Whenever I try to create a generic process to automatically 
> >> >> generate a log-name for each channel and then call update, I get 
> a 
> >> >> 'symbol cannot be cast to atom' error. How can I get around 
> this? It 
> >> >> seems to happen even if I don't use the log-name function. 
> >> > 
> >> > It's simple: a symbol is not an atom.  It's telling you exactly 
> >> what you 
> >> > need to know: you cannot call swap! on a symbol.  Make sure your 
> >> atom is 
> >> > the first argument to swap! wherever you use it. 
> >> > 
> >> > 
> >> >> 3) Is there a better way to keep track of what's on a channel 
> that 
> >> >> doesn't use macros? 
> >> > 
> >> > You cannot look inside of a channel, but to do what you want and 
> >> get a 
> >> > sense of how core.async works, I think you are on the right track 
> by 
> >> > logging as you put stuff in and take it out. 
> >> > 
> >> > That said, I would start by getting rid of the log and the 
> >> macro--these 
> >> > are unnecessary complications--and do things very simply: 
> >> > 
> >> > => (require '[clojure.core.async :

Re: using atoms as logs for channels in core.async

2014-05-12 Thread gamma235
When I try this using your code above I get a stack-trace that I can't 
understand. Am I using it wrong?

(transparent-chan c)
> (transparent-put c 42)
> (transparent-take c)



   - 
>
>"Exception in thread \"async-dispatch-64\" "
>"java.lang.IllegalArgumentException: No implementation of method: 
>:take! of protocol: #'clojure.core.async.impl.protocols/ReadPort found for 
>class: nil"
>"\tat clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:541)"
   
   





On Monday, May 12, 2014 1:16:19 PM UTC+9, James Reeves wrote:
>
> On 12 May 2014 03:41, gamma235 > wrote:
>
>>
>> (defn log-name [ch] (symbol (str ch '-log)))
>>>  
>>>  ;; Is this efficiently written?
>>> (defmacro transparent-chan [ch]   
>>>   (do
>>> `(def ~ch (chan))
>>> `(def (log-name ~ch) (atom []))
>>> `(println "new transparent channel created!")))
>>>
>>
> This looks like you're replicating the functionality of maps using defs. 
> Instead, consider something like:
>
> (defn transparent-chan [ch]
>   {:channel ch, :buffer (atom [])})
>
> Another improvement you may wish to consider is to use a queue, rather 
> than a vector. Immutable queues exist in Clojure, but are something of a 
> hidden feature.
>
> (defn transparent-chan [ch]
>   {:channel ch, :buffer (atom clojure.lang.PersistentQueue/EMPTY)})
>
> Queues act more like channels, in that popping a queue strips off the 
> oldest item, whereas popping a vector strips off the newest.
>
> With this in mind, you could write functions like:
>
> (defn transparent-put [{:keys [channel buffer]} x]
>   (go
> (>! channel x)
> (swap! buffer conj x)))
>
> (defn transparent-take [{:keys [channel buffer]} x]
>   (go
> (let [x (   (swap! buffer pop)
>   x)))
>
> (defn transparent-buffer [{keys [buffer]}]
>   (vec @buffer))
>
> - James
>

-- 
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: using atoms as logs for channels in core.async

2014-05-12 Thread gamma235
Thanks James,

I played around with the persistent queues before I started this exercise, 
but opted for atoms, after seeing this behavior (a la JOC): 

<https://lh6.googleusercontent.com/-4u0XBfNvbv4/U3CMpigLRoI/BjE/HDjKbcvSgAM/s1600/Screen+Shot+2014-05-12+at+5.55.27+PM.png>


I never considered sticking the persistent queue in the atom and your code 
above made me realize that maps are a way better way to do this. 

Rock on, 

Jesse

On Monday, May 12, 2014 1:16:19 PM UTC+9, James Reeves wrote:
>
> On 12 May 2014 03:41, gamma235 > wrote:
>
>>
>> (defn log-name [ch] (symbol (str ch '-log)))
>>>  
>>>  ;; Is this efficiently written?
>>> (defmacro transparent-chan [ch]   
>>>   (do
>>> `(def ~ch (chan))
>>> `(def (log-name ~ch) (atom []))
>>> `(println "new transparent channel created!")))
>>>
>>
> This looks like you're replicating the functionality of maps using defs. 
> Instead, consider something like:
>
> (defn transparent-chan [ch]
>   {:channel ch, :buffer (atom [])})
>
> Another improvement you may wish to consider is to use a queue, rather 
> than a vector. Immutable queues exist in Clojure, but are something of a 
> hidden feature.
>
> (defn transparent-chan [ch]
>   {:channel ch, :buffer (atom clojure.lang.PersistentQueue/EMPTY)})
>
> Queues act more like channels, in that popping a queue strips off the 
> oldest item, whereas popping a vector strips off the newest.
>
> With this in mind, you could write functions like:
>
> (defn transparent-put [{:keys [channel buffer]} x]
>   (go
> (>! channel x)
> (swap! buffer conj x)))
>
> (defn transparent-take [{:keys [channel buffer]} x]
>   (go
> (let [x (   (swap! buffer pop)
>   x)))
>
> (defn transparent-buffer [{keys [buffer]}]
>   (vec @buffer))
>
> - James
>

-- 
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: using atoms as logs for channels in core.async

2014-05-12 Thread gamma235
Thank you for your answer David. 

I think I am confused about how to distinguish between a symbol and a 
variable, as I thought that the symbol being derefed pointed to the atom 
that it was made to define when transparent-chan was called. 

Also, I am trying to specifically solve the logging problem  to understand 
how I might use stored values or state outside the scope of the channel as 
a means of creating the illusion of referencing its contents. Later I was 
thinking about incorporating it into a gui to see if it's possible to 
design an asynchronous message passing system using drag and drop icons 
that represent pubs and subs, channels with a drop-down contents tab, and 
running listening processes. I know this is probably out of my league, but 
I was just asking myself how something like that might be implemented. I 
will of course continue to learn and reinforce the basics though on my own. 

Jesse

On Monday, May 12, 2014 1:26:57 PM UTC+9, David Della Costa wrote:
>
> I apologize, apparently you can't use go-loop how I did below, 
>
> => (def my-go-loop (async/go-loop [msg (async/ msg " from channel " 'c))) 
>
> ...try this instead: 
>
> (def my-go-loop (async/go-loop [] (let [msg (async/ msg " msg " from channel " 'c 
>
> Sorry about that! 
>
> DD 
>
> (2014/05/12 13:21), Dave Della Costa wrote: 
> > 
> >> 1) I feel like it is a redundant to define bindings multiple times in 
> >> my go's let exprs when the params have already been passed in as 
> >> arguments. Is there a more idiomatic way to do this? 
> > 
> > I think the fact that you are re-binding in a let should show you that 
> > these variables are already in scope: that let is wholly redundant, just 
> > remove it. 
> > 
> > 
> >> 2) Whenever I try to create a generic process to automatically 
> >> generate a log-name for each channel and then call update, I get a 
> >> 'symbol cannot be cast to atom' error. How can I get around this? It 
> >> seems to happen even if I don't use the log-name function. 
> > 
> > It's simple: a symbol is not an atom.  It's telling you exactly what you 
> > need to know: you cannot call swap! on a symbol.  Make sure your atom is 
> > the first argument to swap! wherever you use it. 
> > 
> > 
> >> 3) Is there a better way to keep track of what's on a channel that 
> >> doesn't use macros? 
> > 
> > You cannot look inside of a channel, but to do what you want and get a 
> > sense of how core.async works, I think you are on the right track by 
> > logging as you put stuff in and take it out. 
> > 
> > That said, I would start by getting rid of the log and the macro--these 
> > are unnecessary complications--and do things very simply: 
> > 
> > => (require '[clojure.core.async :as async]) 
> > nil 
> > => (def c (async/chan)) 
> > #'user/c 
> > => (def my-go-loop (async/go-loop [msg (async/ > msg " from channel " 'c))) 
> > #'user/my-go-loop 
> > => (defn put-and-print! [c msg] (println "putting msg " msg " onto 
> > channel " 'c) (async/put! c msg)) 
> > #'user/put-and-print! 
> > => (put-and-print! c "I am a message!") 
> > putting msg  I am a message!  onto channel  c 
> > got msg  I am a message!  from channel  c 
> > nil 
> > => 
> > 
> > Printing out "channel c" is kind of silly since there is only one, but 
> > it sounds like you may want to do this with multiple channels so this is 
> > one way to print out the variable name--simply quote it. 
> > 
> > DD 
> > 
> > (2014/05/12 11:41), gamma235 wrote: 
> >> Hi everyone, 
> >> 
> >> I am getting my feet wet with core.async and am trying to attach atoms 
> >> to channels that update automatically and print out to the console as 
> >> you take and put. This is not for anything serious, just a way to get 
> >> familiar with the behavior and functionality of the library and 
> practice 
> >> my Clojure skills. Thanks in advaan 
> >> 
> >> Here is my code: 
> >> 
> >> (defn log-name [ch] (symbol (str ch '-log))) 
> >>   
> >>  ;; Is this efficiently written? 
> >> (defmacro transparent-chan [ch]   
> >>   (do 
> >> `(def ~ch (chan)) 
> >> `(def (log-name ~ch) (atom [])) 
> >> `(println "new transparent channel created!"))) 
> >>   
> >> (defn-

using atoms as logs for channels in core.async

2014-05-11 Thread gamma235
Hi everyone,

I am getting my feet wet with core.async and am trying to attach atoms to 
channels that update automatically and print out to the console as you take 
and put. This is not for anything serious, just a way to get familiar with 
the behavior and functionality of the library and practice my Clojure 
skills. Thanks in advaan

Here is my code: 

(defn log-name [ch] (symbol (str ch '-log)))
>  
>  ;; Is this efficiently written?
> (defmacro transparent-chan [ch]   
>   (do
> `(def ~ch (chan))
> `(def (log-name ~ch) (atom []))
> `(println "new transparent channel created!")))
>  
> (defn- update [log v]
>   (do
> (swap! log conj v)
> (println "log test passed: " v " has been logged")
> (println "channel contents: " @log)))
>  
>  (defn transparent-put [ch v]
>(let [log (log-name ch)]
>  (go
>   (let [ch ch
> v v]
> (>! ch v)
> (println v " has been successfully moved through the channel")))
>  (update log v)
>  (println "put test passed: " v " has been put on the channel")
>  (println " rechecking channel contents: " @log)))
>  
> (defn transparent-take [ch]
>   (go
>(let [v (  log-name (symbol (str ch '-log))]
>  (swap! log-name #(remove #{v} %))
>(println v "has been removed from channel")))
>   (println " removal pending"))
>
 

> ;; tests
> (transparent-chan c)
> c
> c-log
> @c-log
> (transparent-put c 42)
> (transparent-take c)



My main questions are regarding variable scope: 
1) I feel like it is a redundant to define bindings multiple times in my 
go's let exprs when the params have already been passed in as arguments. Is 
there a more idiomatic way to do this?

2) Whenever I try to create a generic process to automatically generate a 
log-name for each channel and then call update, I get a 'symbol cannot be 
cast to atom' error. How can I get around this? It seems to happen even if 
I don't use the log-name function.

3) Is there a better way to keep track of what's on a channel that doesn't 
use macros?

-- 
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.


Can somebody help trouble-shoot my core.async code?

2014-05-11 Thread gamma235
I am getting my feet wet with core.async and am trying to attach atoms to 
channels that update automatically and print out to the console as you take 
and put. This is not for anything serious, just a way to get familiar with 
the behavior and functionality of the library and practice my Clojure 
skills. Thanks in advaan

Here is my code: 

(defn log-name [ch] (symbol (str ch '-log)))
>
 

> (defmacro transparent-chan [ch]  ;; This is probably not correct, but 
> I wanna do something like this
>   (do
> `(def ~ch (chan))
> `(def (log-name ~ch) (atom []))
> `(println "new transparent channel created!")))
>
 

> (defn- update [log v]
>   (do
> (swap! log conj v)
> (println "log test passed:  v " has been logged")
> (println "channel contents: " @log)))
>
 

> (defn transparent-put [ch v]
>   (let [log (log-name ch)]
> (update log v)
> (println "put test passed: " v " has been put on the channel")
> (println " rechecking log: "@log)
> (go
>  (let [ch ch
>v v]
>(>! ch v)
>(println v " has been successfully put/read from the channel!")
>
 

> (defn transparent-take [ch]
>   (go
>(let [v (  log-name (symbol (str ch '-log))]
>  (swap! log-name #(remove #{v} %))
>(println v "has been removed from channel")))
>   (println " removal pending"))


My main questions are regarding variable scope: 
1) I feel like it is a redundant to define bindings multiple times in my go 
and let exprs for params that are already passed in as arguments. Is there 
a more idiomatic way to do this?

2) Whenever I try to create a generic process to automatically generate a 
log-name for each channel and then call update, I get a 'symbol cannot be 
cast to atom' error. How can I get around this? It seems to happen even if 
I don't use the log-name function. 

3) Is this a useful thing to be doing: is there a way to query and keep 
track of what's on a channel without using a macro or atoms?

-- 
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: core.async and Joy of Clojure

2014-05-07 Thread gamma235

>
> Hey Timothy, I just finished working through the code from your talk and 
> have a question. In the code there is this code:


(go (loop []
>   (when-let [v ( (println v)
> (recur 

 


I wanted to expand it into something like a logger that writes out to a 
file though, so I made the relevant test.txt file, stuck it in resources 
and  changed the code to look like this: 

(use 'clojure.java.io)
> (use 'clojure.core.async)
>
 

> (def print-chan (chan))
>
 

> (go (loop []
>   (when-let [v ( (with-open [wrtr (writer "resources/test.txt" :append true)]

  (.write wrtr v))
> (recur 
>
> (>!! print-chan 42)


But when I do this, I find that it will only replace what is in the file, 
and not append to it. Sometimes also, the output that ends up in the file 
is a little odd, too. I tried to put 42 and I got * instead. When I use the 
writer without the  core.async functions, it works as expected. I am using 
light table. 

Jesse

-- 
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: core.async and Joy of Clojure

2014-05-02 Thread gamma235


Wow! I had no idea about the daily specials mailing list. I have joined now 
though, so if I see a JOC special pop up I'll snatch it up. 

I don't have an e-reading platform that I like, so I have only been reading 
> bits and pieces of either edition. 


I find using my laptop with ibooks and a repl to be really helpful in, 
because I can copy and paste to test the code, and when I have questions I 
can meander and see what makes things break. 



On Friday, May 2, 2014 11:49:50 PM UTC+9, Mars0i wrote:
>
> Nice to know about the 7 models book.  I wasn't aware of it.  I can't give 
> you an opinion about JoC 2nd vs. 1st ed., though.  I haven't read either 
> thoroughly.  I only got the first edition when I bought the pre-release 2nd 
> edition package last fall.  I don't have an e-reading platform that I like, 
> so I have only been reading bits and pieces of either edition.  I'll read 
> it seriously when the paper edition comes (unless I buy a tablet first).
>
> (Are you on the Manning Publishing daily specials mailing list?  That's 
> how I got the pre-release package for 1/2 price, and I have seen that offer 
> more than once since I bought the package.  It may that at this point they 
> won't offer any further 1/2 price deals on JoC, but if they do, you could 
> buy it that way.)
>
> On Friday, May 2, 2014 1:07:36 AM UTC-5, gamma235 wrote:
>>
>> Thank you Mars0i!!
>>
>> I have a first edition copy of JOC and really like the way it just lays 
>> things out for you. I am hesitating to buy the 2nd edition, though, due to 
>> the hefty price-tag, though I am curious about logic programming and data. 
>> Would you say it is worth the money?
>>
>> I am now reading the 7 concurrency models in 7 weeks beta version 
>> (recommended by Alex Ott, above) and am finding it thoroughly enjoyable. It 
>> masquerades as language agnostic, but the first half is virtually a Clojure 
>> book in the way it introduces Java's concurrency solutions (or lack 
>> thereof), priming you for the subsequent chapters that go into Clojure's 
>> primitives, core.async, and even Clojurescript. There is a chapter on 
>> actors, using Elixir, and then the latter half gets more  general talking 
>> about how concurrency relates to big data and Hadoop, using Java. In 
>> general, I think all of the information is pertinent for a Clojure 
>> programmer who wants to become more well-rounded on the subject.
>>
>> J
>>
>> On Friday, May 2, 2014 1:07:00 PM UTC+9, Mars0i wrote:
>>>
>>> On Monday, April 28, 2014 9:42:06 AM UTC-5, gamma235 wrote:
>>>>
>>>> I heard that Joy of Clojure would be adding a lot in the 2nd edition, 
>>>> including a section on core.logic; is core.async also on that list? 
>>>>
>>>
>>> I bought the pre-release + final release *Joy of Clojure* 2nd ed. 
>>> package, so I have the v10 prerelease version.  This seems to be the final 
>>> version before the regular release.  I did a search through the v10 pdf, 
>>> and found no instances of "core.async", and the string "async" appeared 
>>> only in the word "asynchronous".  By contrast, there are indeed many 
>>> instances of "core.logic".
>>>
>>> The eBook version is supposed to come out in mid-May, and the print and 
>>> other electronic versions some time after that.  The last email that I got 
>>> says that the book "is now in production where it will get a thorough 
>>> polishing before publication."  So it sounds as if the authors and 
>>> publisher are only fixing typos and doing other small changes at this 
>>> point, and that core.async will not be discussed in the book.
>>>
>>

-- 
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: core.async and Joy of Clojure

2014-05-01 Thread gamma235
Thank you Mars0i!!

I have a first edition copy of JOC and really like the way it just lays 
things out for you. I am hesitating to buy the 2nd edition, though, due to 
the hefty price-tag, though I am curious about logic programming and data. 
Would you say it is worth the money?

I am now reading the 7 concurrency models in 7 weeks beta version 
(recommended by Alex Ott, above) and am finding it thoroughly enjoyable. It 
masquerades as language agnostic, but the first half is virtually a Clojure 
book in the way it introduces Java's concurrency solutions (or lack 
thereof), priming you for the subsequent chapters that go into Clojure's 
primitives, core.async, and even Clojurescript. There is a chapter on 
actors, using Elixir, and then the latter half gets more  general talking 
about how concurrency relates to big data and Hadoop, using Java. In 
general, I think all of the information is pertinent for a Clojure 
programmer who wants to become more well-rounded on the subject.

J

On Friday, May 2, 2014 1:07:00 PM UTC+9, Mars0i wrote:
>
> On Monday, April 28, 2014 9:42:06 AM UTC-5, gamma235 wrote:
>>
>> I heard that Joy of Clojure would be adding a lot in the 2nd edition, 
>> including a section on core.logic; is core.async also on that list? 
>>
>
> I bought the pre-release + final release *Joy of Clojure* 2nd ed. 
> package, so I have the v10 prerelease version.  This seems to be the final 
> version before the regular release.  I did a search through the v10 pdf, 
> and found no instances of "core.async", and the string "async" appeared 
> only in the word "asynchronous".  By contrast, there are indeed many 
> instances of "core.logic".
>
> The eBook version is supposed to come out in mid-May, and the print and 
> other electronic versions some time after that.  The last email that I got 
> says that the book "is now in production where it will get a thorough 
> polishing before publication."  So it sounds as if the authors and 
> publisher are only fixing typos and doing other small changes at this 
> point, and that core.async will not be discussed in the book.
>

-- 
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: core.async and Joy of Clojure

2014-04-29 Thread gamma235

Thanks for the recommendation. This book looks awesome. Why haven't I heard 
of it?! 

Jesse


On Tuesday, April 29, 2014 12:16:20 AM UTC+9, Alex Ott wrote:
>
> The "Seven Concurrency Models in Seven Weeks: When Threads Unravel" (
> http://pragprog.com/book/pb7con/seven-concurrency-models-in-seven-weeks) 
> has the description of the core.async in the CSP chapter...
>
>
> On Mon, Apr 28, 2014 at 4:42 PM, gamma235 
> > wrote:
>
>>
>> Hey guys,
>>
>> I have studied the sample code snippets on the github page, read through 
>> several tutorials and watched many talks on core.async, but am still unable 
>> to effectively implement this library in my programs. I am trying to level 
>> up here with this subject, but feel like the existing documentation is kind 
>> of lacking in the middle. Are there any good resources out there that can 
>> bridge the gap between code snippets and show how the concepts of this 
>> library pertain to system design? I heard that Joy of Clojure would be 
>> adding a lot in the 2nd edition, including a section on core.logic; is 
>> core.async also on that list? 
>>
>> J
>>
>> -- 
>> 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/d/optout.
>>
>
>
>
> -- 
> With best wishes,Alex Ott
> http://alexott.net/
> Twitter: alexott_en (English), alexott (Russian)
> Skype: alex.ott 
>

-- 
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: core.async and Joy of Clojure

2014-04-29 Thread gamma235
Thank you Timothy, 

I did watch that talk! In fact, it was one of the videos that really piqued 
my enthusiasm in core.async. I had no idea that the code was available on 
github. Good news. I am thinking now about how I could use core.async to do 
useful/fun things: web-service or browser game, simulation, etc. It will be 
exciting to see how things develop in the next couple of years. Do you 
think you might put out a book about some of the stuff you've been working 
on? 

Jesse

On Tuesday, April 29, 2014 12:23:14 AM UTC+9, tbc++ wrote:
>
> I'm not sure if you have watched it yet, but my Clojure/Conj talk includes 
> quite a few examples: https://www.youtube.com/watch?v=enwIIGzhahw
>
> The code from all the examples is available here: 
> https://github.com/halgari/clojure-conj-2013-core.async-examples
>
> Timothy
>
>
> On Mon, Apr 28, 2014 at 8:42 AM, gamma235 
> > wrote:
>
>>
>> Hey guys,
>>
>> I have studied the sample code snippets on the github page, read through 
>> several tutorials and watched many talks on core.async, but am still unable 
>> to effectively implement this library in my programs. I am trying to level 
>> up here with this subject, but feel like the existing documentation is kind 
>> of lacking in the middle. Are there any good resources out there that can 
>> bridge the gap between code snippets and show how the concepts of this 
>> library pertain to system design? I heard that Joy of Clojure would be 
>> adding a lot in the 2nd edition, including a section on core.logic; is 
>> core.async also on that list? 
>>
>> J
>>
>> -- 
>> 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/d/optout.
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>

-- 
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.


core.async and Joy of Clojure

2014-04-28 Thread gamma235

Hey guys,

I have studied the sample code snippets on the github page, read through 
several tutorials and watched many talks on core.async, but am still unable 
to effectively implement this library in my programs. I am trying to level 
up here with this subject, but feel like the existing documentation is kind 
of lacking in the middle. Are there any good resources out there that can 
bridge the gap between code snippets and show how the concepts of this 
library pertain to system design? I heard that Joy of Clojure would be 
adding a lot in the 2nd edition, including a section on core.logic; is 
core.async also on that list? 

J

-- 
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.