Re: [ANN][book] Clojure Reactive Programming

2015-03-26 Thread Russell Christopher
So far I'm finding the book instructive! Good job. As far as the detour, I'd keep in mind that in general Rich likely isn't in favor of it on this list but on the other hand I didn't find that the criticism was personal as no names were mentioned and I commiserate about so called "architects" cau

Re: Contributors needed for Rouge (Clojure on Ruby)

2014-01-05 Thread Russell Christopher
I wonder if Go could be a good substrate for native-compiled Clojure. On Sun, Jan 5, 2014 at 5:27 PM, Mikera wrote: > On Sunday, 5 January 2014 18:18:22 UTC, John Gabriele wrote: >> >> On Saturday, January 4, 2014 1:12:12 PM UTC-5, Michael Gardner wrote: >> >>> >>> > Hopefully the landscape for

Re: core.async repl :reload-all issue?

2013-09-27 Thread Russell Christopher
uts you may be awaiting on but I > think that is probably the desired effect since you are trying to get a > clean state of the system. > > HTH, > Ben > > > On 9/27/13 11:49 AM, Russell Christopher wrote: > >> Anyone encountered after a few reloads at the repl

core.async repl :reload-all issue?

2013-09-27 Thread Russell Christopher
Anyone encountered after a few reloads at the repl core.async stops working.? Thanks (ns repl.core (:require [clojure.core.async :refer :all])) ;;0.1.0-SNAPSHOT (defn producer[c] (Thread/sleep 1000) (go (>! c true)) (println "sleeping") (Thread/sleep 1)) (defn consumer [c] (let

Re: Marshal 1.0.0

2012-02-05 Thread Russell Christopher
ld surely slip by me when implementing my own binary- > encoding library, but which has already been addressed by Gloss. By > choosing a mature and well-known library instead of making your own, > you get more features and fewer bugs. > > On Feb 5, 4:09 pm, Russell Christopher > wr

Re: Marshal 1.0.0

2012-02-05 Thread Russell Christopher
I did look at Gloss before writing Marshal and decided against using it in our application suite, I wanted something more focused utilizing InputStream/OutputStream interface and able to handle variable sized arrays/strings (size of array or string specified in packet). On Sun, Feb 5, 2012 at 6:1

Re: Can anyone create a simpler version of prime factors in Clojure?

2010-06-12 Thread Russell Christopher
On 12 Jun 2010, at 16:18, Russell Christopher wrote: > > > You're right. Hope I haven't offended with the fail, I thought I had > tested it - by iterating over a range and comparing it to Uncle Bob's but > obviously I didn't do that right and then realized that fac

Re: Can anyone create a simpler version of prime factors in Clojure?

2010-06-12 Thread Russell Christopher
t time. Regards, Russell On Sat, Jun 12, 2010 at 5:11 AM, Steve Purcell wrote: > On 11 Jun 2010, at 20:35, Russell Christopher wrote: > > > didn't need the assoc in my previous try > > > > (defn of [n] > > (letfn [(f [res k] > > (if (= 0

Re: Can anyone create a simpler version of prime factors in Clojure?

2010-06-11 Thread Russell Christopher
didn't need the assoc in my previous try (defn of [n] (letfn [(f [res k] (if (= 0 (rem (:n res) k)) {:n (/ (:n res) k) :fs (conj (:fs res) k)} res))] (:fs (reduce f {:n n :fs []} (range 2 n) On Fri, Jun 11, 2010 at 3:15 PM, russellc wrote:

Re: 1.2 letfn/reduce bug?

2010-06-11 Thread Russell Christopher
I couldn't see it! Thanks On Fri, Jun 11, 2010 at 12:25 PM, Krešimir Šojat wrote: > Hi, > > > (defn foo [] > > (letfn (bar [acc val] > >acc) > > (reduce bar {} (range 1 10 > > > > doesn't compile > > java.lang.IllegalArgumentException: Don't know how to crea

Re: a default value for get-in?

2010-05-19 Thread Russell Christopher
slight error w/ the previous, local-get-in should have been local-get (defn get-in ([m ks] (get-in m ks nil)) ([m ks not-found] (letfn [(local-get [nf m ks] (get m ks nf))] (reduce (partial local-get not-found) m ks On Wed, May 19, 2010 at 9:21 AM, Russell Christopher

Re: a default value for get-in?

2010-05-19 Thread Russell Christopher
Try #2, change the order of arguments to "get" using partial (defn get-in ([m ks] (get-in m ks nil)) ([m ks not-found] (letfn [(local-get-in [nf m ks] (get m ks nf))] (reduce (partial local-get-in not-found) m ks On Tue, May 18, 2010 at 5:23 PM, Meikel Brandmeyer wrote: > H

Re: a default value for get-in?

2010-05-18 Thread Russell Christopher
Although that would return the default for a key with a nil value. So you're probably right reduce would have to change. On Tue, May 18, 2010 at 3:49 PM, Russell Christopher < russell.christop...@gmail.com> wrote: > (defn get-in > ([m ks] > (reduce get m ks))

Re: a default value for get-in?

2010-05-18 Thread Russell Christopher
(defn get-in ([m ks] (reduce get m ks)) ([m ks not-found] (if-let [res (get-in m ks)] res not-found))) Longer but still uses reduce On Tue, May 18, 2010 at 12:20 PM, Stefan Kamphausen wrote: > Hi, > > On May 17, 9:34 pm, braver wrote: > > If get-in is to be consistent with get, i

Re: defrecord question

2010-04-30 Thread Russell Christopher
Why does this work? (defrecord R [k]) (extend-protocol P R (p [{:keys [k]}] k)) On Fri, Apr 30, 2010 at 2:52 PM, Sean Devlin wrote: > I think you have your destructuring backwards. > > You fn should probably be (fn [{k :keys}] k) > > For example, > > user=> ((fn [{k :keys}] k) {:keys "Awesome"})

Re: iterating over a nested vector

2010-04-09 Thread Russell Christopher
http://rosettacode.org/wiki/Matrix_transposition#Clojure Does anyone know if transpose exists in core or contrib? A cursory check doesn't reveal it, seems like it should be available. Thanks On Thu, Apr 8, 2010 at 10:27 PM, Per Vognsen wrote: > Or you can separate concerns a bit more: > > (def

Re: iterating over a nested vector

2010-04-08 Thread Russell Christopher
Another one using for (defn col-widths [arr] (for [i (range (count arr))] (apply max (map #(nth % i) arr On Thu, Apr 8, 2010 at 1:55 PM, John Sanda wrote: > Thanks for the explanation. I did see in the docs that the map function can > take multiple collections, but I guess I did not quite u

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Russell Christopher
In general I think the STM solution to most concurrency issues looks promising, however in the case of dining philosophers I found that Java locking was easier than a ref, atom or agent solution. ;; (import java.util.concurrent.locks.ReentrantReadWriteLock) (defn nth-chopstick [chopsticks i side]

Re: parsing program for nested parens and square brackets

2009-07-04 Thread Russell Christopher
(def matches {\( \) \[ \]}) (defn balanced? [s] (empty? (reduce #(if (= (matches (peek %1)) %2) (pop %1) (conj %1 %2)) [] s))) Learning Clojure. So far I'm really liking it. This is the first time I've tried anything outside of some REPL incantations from books, blogs, this list, etc thus it wo