Re: How to create a core.async channel that will drop messages if no consumer is currently reading from the channel?

2015-01-01 Thread Jozef Wagner
Implement a custom buffer type, or use mult. With mult, use tap/untap to control reading. Items sent to mult are dropped if there are no taps. Jozef On Mon, Dec 29, 2014 at 12:38 PM, Yehonathan Sharvit wrote: > Hello, > > > I would like to create a channel that will drop messages if no consumer

Re: lazy-seq performance

2015-01-01 Thread Timothy Baldridge
Benchmarks like this are often considered red herrings by language developers. Mostly because they are testing the wrong thing. In this case you are basically testing the performance of big ints in Python to the performance of big ints in Clojure (and Java). Since no one really ever uses big intege

Using transducers in a new transducing context

2015-01-01 Thread shintotomoe
I was wondering how to apply a transducer inside a go process. What I've so far is the following (defn pipe-xform [in-ch out-ch xform] (let [tr (let [tr (xform (fn ([result] result) ([result input] (conj! result input] (f

Re: Using transducers in a new transducing context

2015-01-01 Thread Timothy Baldridge
Core.async already has pipeline, pipeline-blocking and pipeline-async. In addition you can use a transducer inside a channel. Use those instead. Timothy On Thu, Jan 1, 2015 at 6:55 PM, shintotomoe wrote: > I was wondering how to apply a transducer inside a go process. What I've > so far is the

Re: lazy-seq performance

2015-01-01 Thread Jens Bendisposto
Here is an experiment to figure out what causes the problem. If this is an issue of the lazy sequence, then this code should be equally bad: (defn lazy-seq-fibo ([] (concat [0 1] (lazy-seq-fibo 0N 1N))) ([a b] (let [n (+ (mod a 1000) (mod b 1000))] (lazy-seq

Re: Using transducers in a new transducing context

2015-01-01 Thread shintotomoe
Thank you for the superfast response. I take it implementing your own transducing process is not something you would usually do unless you have a unique use case (my own use case being already implemented by chan taking a transducer). Still, I was wondering about the use of ArrayList in partiti

Re: How to handle fn args in a macro ?

2015-01-01 Thread Michael Blume
If it were me I'd avoid making 'topic a "magic symbol" and let the user choose a symbol to bind. It'd look something like (defmacro listen [[topic-sym topic-name] & body] `(on-message ~topicname (fn [~topic-name] (~@body) (listen [topic "topic-test"] (println topic "test)) this way

Re: How to handle fn args in a macro ?

2015-01-01 Thread Michael Blume
Sorry, that should be (defmacro listen [[topic-sym topic-name] & body] `(on-message ~topic-name (fn [~topic-sym] (~@body) On Thu Jan 01 2015 at 11:01:53 PM Michael Blume wrote: > If it were me I'd avoid making 'topic a "magic symbol" and let the user > choose a symbol to bind. It'd

Lein-SableCC 1.0.0 is released

2015-01-01 Thread Ralph Ritoch
This is the first release of the lein-sablecc leiningen plugin. This project is on github at https://github.com/rritoch/lein-sablecc It has been released to clojars at https://clojars.org/lein-sablecc Description: This plugin integrates the SableCC Compiler Compiler with a leiningen project. T