Re: Using transducers in a new transducing context

2017-04-08 Thread Alexander Gunnarson
EDIT: Transducers are actually not safe in `fold` contexts as I thought: (let [f (fn [i x] (println (str "i " i " " (Thread/currentThread))) (flush) x) r-map-indexed #(r/folder %2 (map-indexed %1))] (->> [6 7 8 9 10] (r-map-indexed f) (r/fold 1 (fn ([] (vector)) ([x] x) ([a

Re: Use of volatile! in stateful transducers

2017-04-08 Thread Alexander Gunnarson
EDIT: Transducers are not safe in `fold` contexts either: (let [f (fn [i x] (println (str "i " i " " (Thread/currentThread))) (flush) x) r-map-indexed #(r/folder %2 (map-indexed %1))] (->> [6 7 8 9 10] (r-map-indexed f) (r/fold 1 (fn ([] (vector)) ([x] x) ([a b] (into a b)))

Re: Use of volatile! in stateful transducers

2017-04-08 Thread Alexander Gunnarson
I was wondering the same thing, Jörg. This thread talks about it as well. I posted a note there which I will reproduce here for your convenience: I think it's safe to assume that since `ArrayList` uses unsynchronized mutability inte

Re: Using transducers in a new transducing context

2017-04-08 Thread Alexander Gunnarson
I was wondering the same thing, shintotomoe. This thread talks about it as well. I think it's safe to assume that since `ArrayList` uses unsynchronized mutability internally (a quick review of the GrepCode entry for `ArrayList` confi

Re: was Re: ANN: Orchestra, complete instrumentation for clojure.spec

2017-04-08 Thread Didier
After a bit of digging, it appears that dependent types, at least the Liquid Haskell kind, could catch it, but could also miss it. If you've constrained everything very tightly, it would catch it, if not, it could miss it. In this regard, generative testing could still end up being practically m

Re: was Re: ANN: Orchestra, complete instrumentation for clojure.spec

2017-04-08 Thread Didier
Sorry, I didn't mean fraction type, I meant fraction literal. All I can say is neither Java, Kotlin or Ceylon have a non zero type. Not sure about heck or frege. Also, I was eventually leading to more than just the literal 10/0. If the zero in this division comes from another formula, or is dy

Re: was Re: ANN: Orchestra, complete instrumentation for clojure.spec

2017-04-08 Thread Gregg Reynolds
On Apr 8, 2017 3:47 PM, "Gregg Reynolds" wrote: On Apr 7, 2017 9:57 PM, "Didier" wrote: | I think you missed my point, which is only "Spec is great as we have the power of Clojure" - sure, just don't forget you have the power of ANOther language in that language as well. Hum, I've probably

Re: was Re: ANN: Orchestra, complete instrumentation for clojure.spec

2017-04-08 Thread Gregg Reynolds
On Apr 7, 2017 9:57 PM, "Didier" wrote: | I think you missed my point, which is only "Spec is great as we have the power of Clojure" - sure, just don't forget you have the power of ANOther language in that language as well. Hum, I've probably missed your point sorry, I'm still not following.

Re: Priority Map with efficient search on values?

2017-04-08 Thread Brian Beckman
"Much appreciated" to all answerers. Looks like priority-map has maps in both directions that I can use quickly. I'll write a protocol with the API I need, implement it with priority-map's non-superficial features to get going, then investigate more advanced data structures if / when I need to.

Re: was Re: ANN: Orchestra, complete instrumentation for clojure.spec

2017-04-08 Thread Colin Yates
They look great. My main reservation about Kotlin (and Fantom?) is the mutability. I fear Clojure has spoiled mutable data structures for me :-). On Saturday, 8 April 2017, Didier wrote: > I have longed for a statically compiled language with type inference with >>> the simplicity and consistenc

Re: Priority Map with efficient search on values?

2017-04-08 Thread Erik Assum
This is way out of my league, but have you had a look at Michals priority search queues? https://github.com/michalmarczyk/psq.clj He had a presentation about them at Euroclojure in 2016 Priority Search Queues: 1.5 dimensional Tree Search - Michał Marc

Re: Priority Map with efficient search on values?

2017-04-08 Thread Mark Engelberg
If you need to do subseq on the key space, you could do the following: (def pm-empty (PersistentPriorityMap. (sorted-map) (sorted-map) {} nil)) This sets up the priority map to use sorted maps for both associating keys to values and values to keys. Use this as your base priority map to pour new k