Re: core.async implemented on top of Pulsar

2013-07-01 Thread Mark Engelberg
I'd love to try this out, but when I follow the getting started directions and add [co.paralleluniverse/pulsar "0.1.1"] to my dependencies, I seem to get a completely different API and namespace layout than what is given in the documentation. Is there a "snapshot" release that contains the latest

Re: core.async implemented on top of Pulsar

2013-07-01 Thread pron
Oh, yeah. It's 0.2-SNAPSHOT. On Monday, July 1, 2013 11:24:40 AM UTC+3, puzzler wrote: > > I'd love to try this out, but when I follow the getting started directions > and add [co.paralleluniverse/pulsar "0.1.1"] to my dependencies, I seem to > get a completely different API and namespace layout

Clojure 1.5.1 head holding

2013-07-01 Thread Gerrard McNulty
Suppose I had code like: ((fn [rs] (take-last 3 rs)) (range 2000)) This seems to run fine with no head holding. But if I write something like: (defn- log [f] (println "start") (f) (println "end")) ((fn [rs] (log #(take-last 3 rs))) (range 2000)) Then this seems to hold on to the

Re: Clojure 1.5.1 head holding

2013-07-01 Thread Meikel Brandmeyer (kotarak)
Hi, I did a slight variation which does not close over the head and it seems to work fine. (defn log [f & args] (println "start") (apply f args) (println "stop")) ((fn [xs] (log take-last 3 xs)) (range 2)) Kind regards Meikel -- -- You received this message because you are s

Re: Clojure 1.5.1 head holding

2013-07-01 Thread Gerrard McNulty
Hi Meikel, That works for me too. I can use that when I control the definition of that function. However sometimes I don't e.g. when I use with-redefs, which calls with-redefs-fn. On Monday, July 1, 2013 12:23:34 PM UTC+1, Meikel Brandmeyer (kotarak) wrote: > > Hi, > > I did a slight variati

Re: lein repl and missing yank

2013-07-01 Thread Manuel Sugawara
On Sat, Jun 29, 2013 at 1:30 PM, Cedric Greevey wrote: > OTOH, your readline can't handle inserting text you've just copied in some > other application, such as copy snippet from web browser window (e.g. > Clojuredocs example) and paste in REPL. > This is an enhacement to JLine, not a replacemen

Re: core.async implemented on top of Pulsar

2013-07-01 Thread Timothy Baldridge
It's my opinion that core.async shouldn't be used a concurrency mechanism, or as a new programming paradigm. Instead, it should be used as a communication method between sequential processes, and as a de-coupling method between modules. Let's go back to Rich's original post on the library: "There

Re: core.async - question about close!

2013-07-01 Thread Brandon Bloom
close! is a control signal from producer to consumers. It's how you say "Nothing else follows". It is not necessary for garbage collection. On Monday, July 1, 2013 2:43:02 AM UTC-4, puzzler wrote: > > Is close! merely a convenience function to ensure that future puts to a > channel will not be

Build fails with any IBM JDK above 6.0.x

2013-07-01 Thread Sherif Ali
Hello all, I am having a problem building any Clojure version (1.1, 1.2, 1.3, 1.5) with any IBM JDK over 6.0.x. My main interest is for version 1.1 but I will take anything above as well. Is there a fix, certain setup, configuration, pre-built version, etc. that can get me running on IBM JDK 62

Sharing result of macro's calculation with the body

2013-07-01 Thread Sean Johnson
Hello, If a macro calculates something and wants to make that result available to the body, what's the right way to do that? So far I've tried these ways which don't work (this is not really my macro, it's just a simplified example to demonstrate the issue): 1) lexical scope doesn't work, the

Re: Sharing result of macro's calculation with the body

2013-07-01 Thread Baishampayan Ghose
Hi, What you need is called an anaphoric macro (via symbol capture). Clojure makes it hard to do a symbol capture in macros since it qualifies all symbols automatically unless you use the auto gensym feature. This is done for hygiene purposes and to avoid any unintended side-effects. However inde

Re: core.async implemented on top of Pulsar

2013-07-01 Thread Ben Wolfson
On Mon, Jul 1, 2013 at 7:10 AM, Timothy Baldridge wrote: > It's my opinion that core.async shouldn't be used a concurrency mechanism, > or as a new programming paradigm. Instead, it should be used as a > communication method between sequential processes, and as a de-coupling > method between modul

Re: Sharing result of macro's calculation with the body

2013-07-01 Thread Gary Trakhman
Whenever I make a macro like this, I pass the symbol to be captured as an argument to the macro. Any collisions would be more explicit and less surprising. On Mon, Jul 1, 2013 at 11:21 AM, Baishampayan Ghose wrote: > Hi, > > What you need is called an anaphoric macro (via symbol capture). > Clo

Re: Sharing result of macro's calculation with the body

2013-07-01 Thread Baishampayan Ghose
+1 totally agree. Eg. clojure.core/with-open Sent from phone. Please excuse brevity. On 1 Jul 2013 20:58, "Gary Trakhman" wrote: > Whenever I make a macro like this, I pass the symbol to be captured as an > argument to the macro. Any collisions would be more explicit and less > surprising. > >

Re: core.async implemented on top of Pulsar

2013-07-01 Thread Timothy Baldridge
Ben, you make a good point. I guess I was stating was something more along the lines of the following. We have really really good concurrency primitives (atom, ref, agent) and I think it would be a mistake to reach for channels when one of those would do. core.async is pretty fast, but reducers wi

Re: Build fails with any IBM JDK above 6.0.x

2013-07-01 Thread Andy Fingerhut
Sherif: The last time I tried a few months ago, Clojure 1.5.1 plus the patch clj-967-disable-failing-io-copy-tests-on-ibm-jdk-16-patch1.txt built and passed all tests with IBM JDK 1.6. http://dev.clojure.org/jira/browse/CLJ-967 The main change in that patch is to disable a couple of unit tes

Re: I'm starting to wonder if I'm the only person using clooj ...

2013-07-01 Thread Plinio Balduino
For those who use Clooj, looks like Mr Edelstein fixed the problem. On Friday, June 28, 2013 1:43:03 PM UTC-3, Plinio Balduino wrote: > > Yup. It's the same problem. That lib is only available on OSX. > -- -- You received this message because you are subscribed to the Google Groups "Clojure" g

Question on passing clojure objects in OSGI

2013-07-01 Thread Rama Shenai
Hi, I have an OSGI (Karaf) setup where I have two isolated instances of Clojure deployed & running in two bundles (within the same JVM), and I am seeing a problem where passing Clojure Objects (such as PersistentArrayMaps) from one clojure bundle to another, breaks clojure interfaces at the

Re: Question on passing clojure objects in OSGI

2013-07-01 Thread Laurent PETIT
2013/7/1 Rama Shenai : > Hi, > > I have an OSGI (Karaf) setup where I have two isolated instances of Clojure > deployed & running in two bundles (within the same JVM), > and I am seeing a problem where passing Clojure Objects (such as > PersistentArrayMaps) from one clojure bundle to another, break

Re: Question on passing clojure objects in OSGI

2013-07-01 Thread Rama Shenai
Laurent, Thanks for the pointers. This is helpful and reinforces what I was wondering to do (repackage clojure or use serialization) I'll evaluate the different approaches Thanks, Rama On Monday, July 1, 2013 10:00:07 AM UTC-7, Laurent PETIT wrote: > > 2013/7/1 Rama Shenai >: > > Hi, > > >

clojure.set/union bug?

2013-07-01 Thread Goldritter
I wanted to create a union of the keys from two maps. When I write (clojure.set/union (keys {:a 1 :b 2 :c 3}) (keys {:a 1 :b 2 :c 3})) I get a result of (:b :c :a :a :c :b). When I write (set (clojure.set/union (keys {:a 1 :b 2 :c 3}) (keys {:a 1 :b 2 :c 3}))) the result is #{:a :c :b}. The doc

Re: [ANN] byte-streams: a rosetta stone for all the byte representations the jvm has to offer

2013-07-01 Thread Zach Tellman
The library defines two protocols, ByteSource and ByteSink. They expose a 'take-bytes!' and 'send-bytes!' method, respectively. An unoptimized transfer involves shuttling bytes between these two methods, which in most cases means one copy and one allocation (ByteBuffer can act as a ByteSource

Re: clojure.set/union bug?

2013-07-01 Thread Jim - FooBar();
HI there, It's pretty obvious what is happeningyou are not providing sets to union but rather seqs. in other words 'keys' return a seq not a set. union will simply conj all the elements from the first set into the second (or vice versa). if they are not sets they won't behave like sets...

Re: Clojure 1.5.1 head holding

2013-07-01 Thread Kevin Downey
On 7/1/13 3:49 AM, Gerrard McNulty wrote: > Suppose I had code like: > > ((fn [rs] (take-last 3 rs)) (range 2000)) > > This seems to run fine with no head holding. But if I write something like: > > (defn- log [f] > (println "start") > (f) > (println "end")) > > ((fn [rs] (log #(take

Re: clojure.set/union bug?

2013-07-01 Thread Pablo Nussembaum
Hi, This is pretty strange behavior to me, why is the case that keys function don't return a set like java? That could lead to a big penalty in performance if you don't realize this difference. I don't say that this is bug, although I would like to believe that a nice explanation exists ;-) Regard

Re: clojure.set/union bug?

2013-07-01 Thread Jim - FooBar();
On 01/07/13 20:02, Pablo Nussembaum wrote: This is pretty strange behavior to me, why is the case that keys function don't return a set like java? It doesn't need to be, does it?...the map itself ensures that there are no duplicate keys anyway. I guess it's one of those 'less is more' cases...

Re: clojure.set/union bug?

2013-07-01 Thread Mark Engelberg
Expanding on what Jim said, you don't usually need to convert the keys of a map into a set, because the map pretty much acts like a set of its keys if you use contains? For example, (contains? {:a 1, :b 2} :a) tests whether :a is among the set of keys in the map. I believe that clojure.set's unio

Re: lein repl and missing yank

2013-07-01 Thread Cedric Greevey
You know, I *had* just been wondering what might possibly be worse than the amount of mental state juggling one of them "kill ring" things must demand of the user, and now you've furnished an excellent candidate: having to keep track of a "kill ring" *and* a normal clipboard, *and* two sets of keyb

Re: Sharing result of macro's calculation with the body

2013-07-01 Thread Cedric Greevey
(defmacro test-it [sym addend & body] `(let [~sym (+ ~addend 1)] ~@body)) would be the usual preferred Clojure way to handle this sort of situation, but anaphoric is also an option. You can also make macros expand to a def in the caller's namespace this way -- it's how defn works: (defmacro defn [

Re: Core Logic Reference Documentation

2013-07-01 Thread Benjamin Peter
Hi xavriley, On Friday, June 7, 2013 2:52:33 PM UTC+2, xavriley wrote: > > I went ahead and made a start here: > > http://corelogicdocs.herokuapp.com/ > that looks so cool. I have had good experiences with the clojuredocs.org folks, are you thinking about integrating it with clojuredocs or keep

Re: clojure.set/union bug?

2013-07-01 Thread Cedric Greevey
It's likely that "keys" returns a seq because you might care about the order in the case that you call it in a sorted map, and you can always convert it to a set with "into #{}" or whatever. What bugs me is that "sorted-set-by" needs "apply" to convert a coll into a sorted set; there's no short-an

Re: clojure.set/union bug?

2013-07-01 Thread Jim - FooBar();
On 01/07/13 21:39, Cedric Greevey wrote: It's likely that "keys" returns a seq because you might care about the order in the case that you call it in a sorted map, and you can always convert it to a set with "into #{}" or whatever. yes, of course! I completely forgot the ordering issue..

Re: Core Logic Reference Documentation

2013-07-01 Thread Benjamin Peter
Hello again, On Monday, July 1, 2013 10:23:49 PM UTC+2, Benjamin Peter wrote: > > Hi xavriley, > > I just forked the cljoure cheatsheet and gonna try to group some functions > and add links to your project. > seems like the cheatsheet is pretty flexible. Here is a first prototype. https://raw

Linux Journal July "Intro to Clojure on the Web"

2013-07-01 Thread greg r
by Reuven Lerner. 10 pages. Compojure is next. http://www.linuxjournal.com/content/july-2013-issue-linux-journal-networking Regards, Greg -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: clojure.set/union bug?

2013-07-01 Thread Marcus Lindner
As it seems clojure.set/union can be used with maps as parameters too. =>(clojure.set/union {:a 1 :b 2 :c 3 :d 4} {:a 1 :b 4 :c 4}) {:a 1, :c 4, :b 4, :d 4} So it is possible to get a union of keys of a map with => (keys (clojure.set/union {:a 1 :b 2 :c 3 :d 4} {:a 1 :b 4 :c 4})) (:a :c :b :d) I

-> macro and accessing context

2013-07-01 Thread pmf
Hi, I sometimes (in fact quite often) want to use the -> macro like this: (-> {} (assoc :a "a") (assoc :b (some-fn CTX))) where CTX should be the current value of the threaded element. Currently, I'm forced to write a helper function (defn add-some-fn [ctx] (assoc ctx :b (some-fn ctx)))

Re: -> macro and accessing context

2013-07-01 Thread Meikel Brandmeyer (kotarak)
Hi, since 1.5 there is as->> : (as-> {} ctx (assoc ctx :a "a") (assoc ctx :b (some-fn ctx))) Kind regards Meikel -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To po

Re: -> macro and accessing context

2013-07-01 Thread pmf
That looks like it can do the job; thanks! On Tuesday, July 2, 2013 8:12:04 AM UTC+2, Meikel Brandmeyer (kotarak) wrote: > > Hi, > > since 1.5 there is > as-> > : > > (as-> {} ctx > (assoc ctx :a "a") > (assoc ctx :b

Re: clojure.set/union bug?

2013-07-01 Thread Ray Miller
On 1 July 2013 21:39, Cedric Greevey wrote: > > What bugs me is that "sorted-set-by" needs "apply" to convert a coll into > a sorted set; there's no short-and-pithy "into" for that case, and no > coll-taking and varargs version pair like vec/vector either. > (into (sorted-set) coll) -- -- You