Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Mars0i
I'm not anywhere near as deep into spec as would be needed to fully understand this thread, but I will say that I agree with those who object to the guitar analogy. That argument would work just as well as a response to someone who complained about the difficulty of C++, or assembler, or APL.

[ANN] data.avl 0.0.16 – bugfix to one-sided subrange

2016-08-23 Thread Michał Marczyk
Hi, data.avl 0.0.16 is now available with a bugfix to the "one-sided subrange past end of collection" case of subrange partly fixed in 0.0.15. [org.clojure/data.avl "0.0.16"] org.clojure data.avl 0.0.16 org.clojure:data.avl:0.0.16 Cheers, Michał -- You received this

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Colin Fleming
> > But creating error messages that are optimal for a user with no knowledge > or Clojure or spec is just not the goal. This is a totally false dichotomy. No-one in this thread is asking for that. This thread has several examples of expert Clojure users for whom the error messages are

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Beau Fabry
While I think the spec errors are pretty unfriendly, it's probably worth remembering that most of the times you'll get one you would have got an inscrutable ClassCastException or incorrect behaviour from a totally different place in the codebase prior to spec. It's definitely a huge

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Alex Miller
The path is the series of tags you've traversed through the spec (when there are parts in :or :alt :cat etc). We will have more documentation on it but we've held off because it was changing pretty regularly in early alphas. A spec for the current explain-data is something like this (I'm just

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Mark Engelberg
On Tue, Aug 23, 2016 at 7:45 AM, Alex Miller wrote: > We expect Clojure users to become familiar with spec and its output as it > is (now) an essential part of the language. You will see specs in error > messages. > Is there any documentation to help users understand how to

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Timothy Baldridge
>> It certainly doesn't require a 200MB jar, more like 300 lines of code, including the parser itself. I completely agree, what I'm saying is, if you start supporting my laundry list of phonetic, spelling, and structural suggestions, your codesize will quickly get much larger than 300 lines. On

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Colin Fleming
The error message I posted earlier comes right out of the parser with very little infrastructure on top of it. It certainly doesn't require a 200MB jar, more like 300 lines of code, including the parser itself. On 24 August 2016 at 02:21, Timothy Baldridge wrote: > So

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Sean Corfield
On 8/23/16, 7:45 AM, "Alex Miller" wrote: > I'm absolutely not talking about making something hard on purpose > and I'm not saying that making things easy to learn is bad. I'm > stating an ordering of priorities. …and this is why I

[ANN] data.avl 0.0.15 – BUGFIX to subrange

2016-08-23 Thread Michał Marczyk
Hi, I am pleased to announce the 0.0.15 release of data.avl, a Clojure Contrib library providing highly performant drop-in replacements for Clojure(Script)'s built-in sorted maps and sets that support O(log n) nth, rank-of, first-class submaps/subsets (like subseq, but preserving collection type;

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread kovas boguta
As some other people have stated: Its way, way premature to start worrying about the exact format of error messages. Given the facilities spec provides, its clear as day that vastly better messages can be built on top. Or even forget messages: syntax highlighting or source-code presentation can

Re: ref strange behavior

2016-08-23 Thread Gary Trakhman
On Tue, Aug 23, 2016 at 10:59 AM Sergei Koledov wrote: > Thank you! I know about Java's thread pools, but I want to do my job in > clojure-idiomatic way and possibly less using java interop. > > I think many of the use-cases for refs/agents are supplanted by core.async. In

Re: ref strange behavior

2016-08-23 Thread Sergei Koledov
Thank you! I know about Java's thread pools, but I want to do my job in clojure-idiomatic way and possibly less using java interop. вторник, 23 августа 2016 г., 20:21:23 UTC+7 пользователь tbc++ написал: > > This really seems like a good use case for Java's Executors: >

Re: ref strange behavior

2016-08-23 Thread Sergei Koledov
Thank you very much! I suspected that I using the agents in wrong way. I ran your code and it worked great. Also I little changed your example to a worker keep only the last task and run it on very large number of tasks (I had problem only on huge collections): (def tasks (ref (into [] (range

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Alex Miller
I do not have an idea of what the final end point will look like exactly. I don't get the feeling that there is any answer that you will find satisfying, so I'm not sure what else I can do for you. We expect Clojure users to become familiar with spec and its output as it is (now) an essential

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Timothy Baldridge
So personally, I don't want extremely accurate suggestions in the core of Clojure. Why? Because I think they will never go far enough and I have a ton of features I want to see that can't (shouldn't) be in the core of a language. I'll never forget the first undefined symbol I got in Clang after

Re: [ANN] data.avl 0.0.14 – BUGFIX to splits, faster map/set reductions

2016-08-23 Thread Alex Miller
IReduce is a Java interface that can be used to allow a data structure to directly indicate participation in being self-reducible. In cases where you control the type (ie you are making the data structure), implementing IReduce (or really IReduceInit) is usually better as it is checked first.

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Brian Marick
> On Aug 22, 2016, at 7:50 PM, Alex Miller wrote: > You've complained in other channels about the "learning to read" error > messages part and I think you've taken it entirely the wrong way or maybe I > just disagree. There are benefits from reporting errors in a generic,

Re: ref strange behavior

2016-08-23 Thread adrian . medina
The lazy sequence works with the code I provided as well. On Tuesday, August 23, 2016 at 9:29:08 AM UTC-4, Sergei Koledov wrote: > > Yes, you are absolutely right. After i modify the code as you advised, it > worked correctly. Thank you very much! > Does it mean that is necessary to avoid the

Re: [ANN] data.avl 0.0.14 – BUGFIX to splits, faster map/set reductions

2016-08-23 Thread Francis Avila
I wasn't aware Clojure had an IReduce protocol! I thought CollReduce was just what IReduce is called in Clojure. -- 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

Re: ref strange behavior

2016-08-23 Thread adrian . medina
Here is working example code demonstrating how you might do this without agents: (in-ns 'user) (def tasks (ref (into clojure.lang.PersistentQueue/EMPTY (range 1 1000 (defn get-task [tasks] (dosync (let [task (first @tasks)] (alter tasks pop) task))) (defn worker-loop

Re: ref strange behavior

2016-08-23 Thread Sergei Koledov
Yes, you are absolutely right. After i modify the code as you advised, it worked correctly. Thank you very much! Does it mean that is necessary to avoid the use of lazy data structures within the STM? вторник, 23 августа 2016 г., 19:57:58 UTC+7 пользователь hitesh написал: > > Taking a quick

Re: ref strange behavior

2016-08-23 Thread Timothy Baldridge
This really seems like a good use case for Java's Executors: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int) You can specify the number of worker threads, then enqueue runnable jobs. But wait! There's more! Clojure functions implement

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Alex Miller
On Tuesday, August 23, 2016 at 2:58:42 AM UTC-5, Andy Fingerhut wrote: > > In the data representing fragments of the user's code returned with these > macro errors, does it include metadata with :line and :column keys in it? > No, although the exception itself from macroexpansion will have the

Re: ref strange behavior

2016-08-23 Thread adrian . medina
I haven't run your code yet, but it's bad form to use Clojure's reference types inside other reference types. They should store persistent data structures to really make any sense in a concurrent context. On Tuesday, August 23, 2016 at 8:22:00 AM UTC-4, Sergei Koledov wrote: > > Hello, > > I

Re: ref strange behavior

2016-08-23 Thread hitesh
Taking a quick look at this, I *think* the problem crops up in your tasks being a lazy sequence. Modify this (def tasks (ref (range 1 1000))) to this (def tasks (ref (doall (range 1 1000 Running that with your large endpoint was taking a lot of time, so I'd suggest running it

ref strange behavior

2016-08-23 Thread Sergei Koledov
Hello, I had a problem when I run the following code: (defn get-task [tasks] (dosync (let [task (first @tasks)] (alter tasks rest) task))) (defn worker [& {:keys [tasks]}] (agent {:tasks tasks})) (defn worker-loop [{:keys [tasks] :as state}] (loop [last-task nil]

Re: Generate a million file from a template

2016-08-23 Thread Moritz Ulrich
Abhinav Gogna writes: > (defn run-in-parallel > "run-in-parallel runs 500 different threads. > you can give each thread number of files you want to generate > Eg: run-in-parallel 100 will generate 500*100 = 5 files" > [y] > (dotimes [_ 500] > (future >

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Andy Fingerhut
In the data representing fragments of the user's code returned with these macro errors, does it include metadata with :line and :column keys in it? Perhaps that would be one way to give errors localized to particular places in the user's code. It isn't always available, e.g. keyword cannot have

Re: [ANN] data.avl 0.0.14 – BUGFIX to splits, faster map/set reductions

2016-08-23 Thread Michał Marczyk
All credit to Francis for the reduce patch! The perf win is really great. Re: IReduce – thanks, indeed, I forgot about the special-casing in reduce. I guess I'll tweak that for the next release. Incidentally, I notice I left out the final result in the after-patch 1.5.1 benchmark run in the