Re: Priority Map with efficient search on values?

2017-04-07 Thread Andy Fingerhut
My first quick take is that you would be served well by creating your own data structure that wraps a priority queue for efficient access by minimum value, and a sorted map for efficient access by key, including subseq's of keys. That combination won't give you subseq's on values, but you could to

Re: Could not locate clojure/tools/namespace/find__init.class or clojure/tools/namespace/find.clj on classpath.

2017-03-04 Thread Andy Fingerhut
The clojure-1.8.0.zip file should also contain a pre-built JAR file named clojure-1.8.0.jar, if you want to just use that and run with it. I do not know if it is intentional or a mistake that some of the files necessary to build are not included in that zip file. It may be intentional, with the i

Re: if nil is true

2017-01-30 Thread Andy Fingerhut
Sayth, check out these examples and see if they clarify anything for you. user=> nil nil user=> (if nil "nil is truthy" "nil is falsey") "nil is falsey" user=> (nil? nil) true user=> (if (nil? nil) "(nil? nil)=true is truthy" "(nil? nil)=true is falsey") "(nil? nil)=true is truthy" user=> (num

Re: Private multimethods possible?

2017-01-12 Thread Andy Fingerhut
At least a few tools built on top of Clojure (not part of the base language implementation) might not work with multiple namespaces defined in the same file. The library tools.namespace, for one, looks for only the first ns form in each source file, and assumes there are no more after that. I do

Re: Order preservation and duplicate removal policy in `distinct`

2016-12-29 Thread Andy Fingerhut
If it helps anyone sleep better at night, were the behavior of distinct ever to change in a way that breaks one's application, the original one is right there in the git history, available for everyone's copying and use, with whatever promises in the doc string you choose to add. Andy On Thu, Dec

Re: what does (seq) in zipmap do?

2016-11-29 Thread Andy Fingerhut
I can't answer for the author, but the answer you gave would be a good sufficient reason to call seq in those places, yes? If you create a function zipmap2 that is identical to zipmap, except it does not have any calls to seq, you get these results: user=> (zipmap [] [1]) {} user=> (zipmap2 []

Re: Help me understand what part of this code is slow, and how to make it faster?

2016-11-22 Thread Andy Fingerhut
More likely, records being just as slow with Clojure 1.9.0-alpha14 probably mean that recalculating of record hashes was not a significant amount of the time your program was taking. Thanks for trying it out. Andy On Mon, Nov 21, 2016 at 5:03 PM, Didier wrote: > I tried it with the safe equals

Re: Help me understand what part of this code is slow, and how to make it faster?

2016-11-21 Thread Andy Fingerhut
Not sure which version of Clojure you are using, but in all versions up to the latest 'official' release, Clojure 1.8.0, records have their hash value calculated every time they are needed, with no caching of the calculated value. The hash value is needed every time an operation is done in a Cloju

Re: Clarification on # as valid symbol character

2016-11-08 Thread Andy Fingerhut
Steven: Regarding Alex Miller's "Voting" message of today, you could consider voting on this related ticket if you are so inclined: http://dev.clojure.org/jira/browse/CLJ-1527 I just realized that having a warning in a lint tool like Eastwood for using characters other than those explicitly endor

Re: Make core.spec value printing more customisable.

2016-09-14 Thread Andy Fingerhut
Anyone with a free account can create issues in Clojure's JIRA tracker. Just go to the link below, and if you see a "Log In" link near the top right of the page, click it and create an account on the next page that appears. http://dev.clojure.org/jira/browse/CLJ Andy On Wed, Sep 14, 2016 at

Re: Newbie question

2016-09-05 Thread Andy Fingerhut
On Mon, Sep 5, 2016 at 9:25 AM, hiskennyness wrote: > > In other languages you might see: > > (defn himom [] ..) > (defn himom [x] ...) > (defn himom [x y z] ...) > > > Come to think of it, maybe Clojure does that, too, (nooby myself) but the > Clojure syntax for overloading I know puts each defi

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

2016-08-24 Thread Andy Fingerhut
A suggestion for making all errors better would be to give not only the precise file and line _of the beginning of the top level form containing the problem_, but a more precise line and column of _the part of the form that spec is complaining about_. Multi-line forms are the biggest and hardest t

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 m

Re: Multiple key-value pairs in assoc-in (old issue)

2016-08-18 Thread Andy Fingerhut
Anyone who has created a free JIRA account can vote on Clojure tickets. High-voted tickets get Alex Miller's attention so he can try to make progress on them, with some level of priority over tickets without votes. Note that in some cases, 'making progress' can simply mean 'declined sooner, rather

Re: Multiple key-value pairs in assoc-in (old issue)

2016-08-14 Thread Andy Fingerhut
d now. Thanks for explaining! > > Łukasz Kożuchowski > > >> On Aug 13, 2016 4:56 PM, "Andy Fingerhut" wrote: >> That ticket is in a state called "Triaged", which means that a screener >> (most likely Alex Miller) thinks the issue is good enough

Re: Multiple key-value pairs in assoc-in (old issue)

2016-08-13 Thread Andy Fingerhut
That ticket is in a state called "Triaged", which means that a screener (most likely Alex Miller) thinks the issue is good enough for Rich Hickey to take a look at it some time. Rich probably hasn't looked at it yet, because if he had, it would have likely been changed to Declined or Vetted. As f

Re: Is this behavior of clojure.core/pr a bug?

2016-08-06 Thread Andy Fingerhut
The user-provided examples and comments at ClojureDocs.org are not official Clojure documentation, but in many cases contain useful additional info. I have just added examples to clojure.core/pr similar to those that motivated this thread, and Timothy Baldridge's suggestion to use transit in cases

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-07 Thread Andy Fingerhut
crossclj.info lists 63 projects with core.incubator as a dependency. Not sure how widely used those projects are themselves: https://crossclj.info/ns/org.clojure/core.incubator/0.1.3/project.clj.html Andy On Tue, Jun 7, 2016 at 12:01 PM, Alex Miller wrote: > I'm not opposed to it but can't s

Re: CCW stopped working. How do I fix it?

2016-05-04 Thread Andy Fingerhut
On Wed, May 4, 2016 at 5:46 AM, Fluid Dynamics wrote: > > Also, nothing you wrote addresses the other complaint I have, which is > that stuff shouldn't just magically stop working one day while it's sitting > in a drawer unused, and that there's not even an *excuse* for it to do so > if it's *sof

Re: Tiny fix for LispReader

2016-04-26 Thread Andy Fingerhut
Frank: I am pretty sure that the intent is that strings like 077 are read as octal, and in Clojure 1.8.0 this is what happens, e.g. (read-string "077") evaluates to the integer 63 (decimal), not 77. Thus it is intentional that (read-string "08") and (read-string "09") throw exceptions. Andy On

Re: Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread Andy Fingerhut
This is a special case behavior of clojure.core/get, as you can see in the RT.java source file at these lines: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L750-L755 I have no idea if a JIRA would be accepted for any change on this or not, but if one was, I suspect i

Re: Memory Locality - Maps vs. Vectors vs. Transient Maps & Vectors

2016-04-20 Thread Andy Fingerhut
Transients are a performance optimization that can give quite significant performance increases when you know you will be doing many updates to a Clojure vector or map. A long sequence of updates on a transient tends to allocate much less memory than the corresponding sequence of updates on a non-

Re: Possible to override assoc-in or update-in?

2016-04-20 Thread Andy Fingerhut
I don't know if assoc-in etc. work on the clojure.data.priority-map data structures, but your questions at least reminded me of the implementation of that data structure, which uses two maps internally to maintain the priority map, and keeps their contents consistent with each other [1]. It also i

Re: find shorter clojure code automatically

2016-03-03 Thread Andy Fingerhut
Eastwood doesn't try to find syntax sugar. It is meant to be a linter, i.e. to find suspicious things in your code that might be bugs, or left-over cruft. Kibit, mentioned earlier in this thread, might be the project you are thinking of, also by Jonas Enlund: https://github.com/jonase/kibit

Re: Implementing Clojure

2016-02-27 Thread Andy Fingerhut
The reference documentation is available here, starting with the Reader at this link, but continuing on with all of the other topics you see on the left hand side of this page, such as Evaluation, Special Forms, Macros, etc. http://clojure.org/reference/reader Any questions not answered there

Re: Welcome the new maintainer of Loom: Paul Snyder

2016-02-14 Thread Andy Fingerhut
I had never seen JUNG before. I've not looked at its implementation at all, but the demos are pretty impressive. As you say, graphviz is nice for what it does, but I did not realize there was an open source 'graphical graph manipulator' like this. Andy On Sun, Feb 14, 2016 at 12:38 PM, Paul L.

Re: Undocumented reader macros?

2016-02-10 Thread Andy Fingerhut
It may be as finished as it will ever be. Andy On Wed, Feb 10, 2016 at 8:35 AM, James Elliott wrote: > Ah, I see that part of the reason it’s not yet documented is that it’s not > really finished; you can’t, for example, use a keyword as a function with > it. Trying to use #=(:tap-tempo control

Re: Common runtime errors in clojure

2016-02-06 Thread Andy Fingerhut
I don't know if it works well with Clojure 1.8 or not, but dynalint is intended to give clearer error messages for some things like this, at the cost of some performance. https://github.com/frenchy64/dynalint I am not sure how beginner-friendly the install instructions are, but you can try th

Anyone use Eastwood lint tool on a Clojure project managed by boot?

2016-01-25 Thread Andy Fingerhut
I haven't used boot yet, so haven't discovered any issues that might exist with using Eastwood [1] on a project where boot is used. There might not be any, which would be great, but if there are I'd like to hear about them. Even better, if you have some short instructions on how to use Eastwood o

Re: Clojure beyond Java 6 ?

2016-01-22 Thread Andy Fingerhut
The only person who can say for sure whether there will be Clojure features added that require newer versions of the JVM is Rich Hickey. Alex Miller may happen to know his thoughts on this matter, if they have discussed it. I recall seeing a few discussions a few years back in the Clojure Dev Goo

Re: Heard about clojure today. is it one of the big tecnologies for the future? or is it becoming deprecated?

2016-01-20 Thread Andy Fingerhut
That repository you did the Pulse graph on contains basically what you would think of in the core implementation of Python/Ruby/etc. with only the most minimal of libraries included. No extra modules/gems/etc. The libraries of Clojure are all spread across many other repositories, and Clojure was

[ANN] Updated Clojure cheatsheet, including new vars in Clojure 1.8.0

2016-01-19 Thread Andy Fingerhut
http://jafingerhut.github.io I'm jumping the gun a little bit by announcing this, as the links for the new Clojure 1.8.0 vars like clojure.string/index-of and last-index-of, etc. do not link to any place useful on ClojureDocs.org or Grimoire yet, but I am guessing they will in not too long from no

Re: [ANN] Clojure 1.8.0-RC5

2016-01-13 Thread Andy Fingerhut
Results of some testing done on 1.8.0-RC5: Ran 'mvn clean test' on a few OS/JDK combos that are not tested as often. Reason: there have been (or still are) build or test failures with some of them. All JDKs listed below were 64-bit. Windows 7 Enterprise SP1 + Oracle JDK 1.7.0_80: ok 3/3 trials U

[ANN] Eastwood, the Clojure lint tool, version 0.2.3 released

2015-12-15 Thread Andy Fingerhut
Eastwood, the Clojure lint tool, version 0.2.3 has been released. See install instructions and complete documentation at [1]. Below are some of the changes since version 0.2.2. A complete list is at [2]. Go squash some bugs! Jonas Enlund, Nicola Mometto, and Andy Fingerhut [1] https

Re: stack overflow

2015-12-13 Thread Andy Fingerhut
You can increase the maximum stack size in your JVM with command line options when you start it. You can reduce the amount of stack memory required per recursive iteration. I don't know if let-bound symbols like modulo, trunc, mult-m, and add-m require separate stack space per recursive call in y

Re: [ANN] Clojure 1.8.0-RC3

2015-12-07 Thread Andy Fingerhut
I have done my usual 'mvn clean test' on multiple OS/JDK combos not tested on build.clojure.org, and found nothing amiss with 1.8.0-RC3. Is http://dev.clojure.org/jira/browse/CLJ-1863 considered problematic enough to fix before 1.8.0 goes out? Andy On Mon, Dec 7, 2015 at 1:36 PM, Alex Miller wr

Re: Poor parallelization performance across 18 cores (but not 4)

2015-11-19 Thread Andy Fingerhut
(swap! a long-operation-on-score some-param >>>>> >>>>> >>>>> In this case long-operation-on-score will need to be re-run every time >>>>> a thread modifies the atom. However if our function only needs the state >>>>&g

Re: Poor parallelization performance across 18 cores (but not 4)

2015-11-17 Thread Andy Fingerhut
David, you say "Based on jvisualvm monitoring, doesn't seem to be GC-related". What is jvisualvm showing you related to GC and/or memory allocation when you tried the 18-core version with 18 threads in the same process? Even memory allocation could become a point of contention, depending upon how

Re: Poor parallelization performance across 18 cores (but not 4)

2015-11-16 Thread Andy Fingerhut
There is no STM involved if you only have atoms, and no refs, so it can't be STM-related. I have a conjecture, but don't yet have a suggestion for an experiment that would prove or disprove it. The JVM memory model requires that changes to values that should be visible to all threads, like swap!

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-15 Thread Andy Fingerhut
nearly the same -- about 2% longer with 1.8.0-RC1, but I only ran each set of tests once, and that could be within the range of variability across runs. Andy On Wed, Nov 11, 2015 at 12:02 PM, Andy Fingerhut wrote: > Results of some testing done on 1.8.0-RC1: > > Ran 'mvn clean test&#x

Re: [ANN] Eastwood, the Clojure lint tool, version 0.2.2 released

2015-11-15 Thread Andy Fingerhut
Sorry, that link to the docs on the new wrong pre/post-condition linter should have been: https://github.com/jonase/eastwood#wrong-pre-post Andy On Sun, Nov 15, 2015 at 1:25 PM, Andy Fingerhut wrote: > Eastwood, the Clojure lint tool, version 0.2.2 has been released. See > i

[ANN] Eastwood, the Clojure lint tool, version 0.2.2 released

2015-11-15 Thread Andy Fingerhut
Eastwood, the Clojure lint tool, version 0.2.2 has been released. See install instructions and complete documentation at [1]. Below are some of the changes since version 0.2.1. A complete list is at [2]. Go squash some bugs! Jonas Enlund, Nicola Mometto, and Andy Fingerhut [1] https

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-11 Thread Andy Fingerhut
Results of some testing done on 1.8.0-RC1: Ran 'mvn clean test' on a few OS/JDK combos that are not tested as often. Reason: there have been (or still are) build or test failures with some of them. All JDKs listed below were 64-bit. Windows 7 Enterprise SP1 + Oracle JDK 1.7.0_80-b15: ok 3/3 tria

Re: ArithmeticException while using unchecked-multiply

2015-10-25 Thread Andy Fingerhut
ojure.core/unchecked-subtract Describing the odd behavior in only one of those entries, and then cross-referencing it explicitly in the examples of the others to the 'detailed one', can save redundancy in writing. Andy On Sun, Oct 25, 2015 at 11:17 PM, Andy Fingerhut wrote: > I cr

Re: ArithmeticException while using unchecked-multiply

2015-10-25 Thread Andy Fingerhut
I created this ticket: http://dev.clojure.org/jira/browse/CLJ-1832 I don't know what will become of it, e.g. perhaps a change in behavior to the unchecked functions, perhaps a clarification to the documentation, perhaps nothing. I wouldn't be surprised if the Clojure core team judged the existing

Re: ArithmeticException while using unchecked-multiply

2015-10-24 Thread Andy Fingerhut
I can't answer whether Clojure should do that. It is doing it because unchecked-multiply falls back to normal multiply, i.e. *, unless both of its arguments are primitive long values. Even boxed Long values cause it to fall back to the behavior of *. The same goes for unchecked-add and unchecked

Re: Apparent bug with more than 5000 command line arguments

2015-10-15 Thread Andy Fingerhut
James: This sounds to me likely to be known and expected behavior of xargs. Any OS has maximum limitations on either number and/or total size of command line arguments, and xargs is probably invoking multiple JVMs. Here is a portion of the man page for xargs on my Mac: Any arguments specified o

Re: deprecation warnings?

2015-10-14 Thread Andy Fingerhut
Try out the Eastwood Clojure lint tool [1] and see if it gives deprecation warnings where you hope to see them. Andy [1] https://github.com/jonase/eastwood On Wed, Oct 14, 2015 at 9:31 AM, William la Forge wrote: > OK, but > > 1. Still no warning from cursive or lein test and > 2. I think the

Re: "Clojure Javadoc API Documentation" needs to be rebuilt.

2015-09-29 Thread Andy Fingerhut
Others can confirm, but I think that is the entire API, callable from Java, that is documented and supported by Clojure. Everything is reachable from there if you know which Clojure Vars you want to use. Andy On Tue, Sep 29, 2015 at 7:31 AM, crocket wrote: > http://clojure.github.io/clojure/ja

Re: cl-format bug?

2015-09-24 Thread Andy Fingerhut
It is definitely the case that this behavior of cl-format you demonstrate does not match the behavior of Common Lisp's format when given the same arguments. It doesn't capitalize the keyword name, either, but I think leaving it lower case is more in keeping with Clojure's case-sensitive symbol nat

Re: clojure.core/run! doc string is incorrect

2015-09-21 Thread Andy Fingerhut
Should be fixed in Clojure 1.8.0-alpha2 and later, due to this ticket and its attached patch: http://dev.clojure.org/jira/browse/CLJ-1761 Change was to force run! to return nil always. Andy On Mon, Sep 21, 2015 at 2:36 PM, Mike Rodriguez wrote: > The doc string for clojure.core/run! is: > "R

Re: Ratio implementation questions

2015-08-26 Thread Andy Fingerhut
On Wed, Aug 26, 2015 at 3:26 PM, waffletower wrote: > Would someone care to rationalize the implementation of (rationalize)? > Sorry, I don't have an answer of the form "Rich Hickey's rationale for this behavior is X", because I don't know what X is for this behavior. I can point out a few thin

Re: Clojure bootstrap, what am I missing here?

2015-08-24 Thread Andy Fingerhut
William: Nicola Mometto has done a lot of work implementing Clojure in Clojure, but there is no time frame proposed anywhere that I am aware of for this implementation to become the one that is most widely used, if that ever happens. The reader and analyzer are pretty much complete, as far as I a

Re: some guidance sought

2015-08-10 Thread Andy Fingerhut
I had not heard of AA trees before, but according to Wikipedia they sound like a variant of red-black trees. Clojure's built-in sorted-map and sorted-set implementations are called by the class name PersistentTreeMap in its Java implementation [1], and it implements a persistent version of a red-b

Re: Is the following behavior of into function a bug or the intended result?

2015-08-09 Thread Andy Fingerhut
array-map preserving order is a property of its implementation, but not a promise to those who use them. Adding a key/value pair to an array-map that takes it over a certain threshold size changes its implementation to a hash-map, which in general changes the seq order completely. This is by desi

Re: Parsing Unicode character with Clojure

2015-08-09 Thread Andy Fingerhut
recommend that you do not rely on any behavior you have not tested extensively yourself there. Andy On Sun, Aug 9, 2015 at 9:22 AM, Andy Fingerhut wrote: > Java uses UTF-16 encoding in memory for String objects. Characters in the > Basic Multilingual Plane are represented as a single 16-

Re: Parsing Unicode character with Clojure

2015-08-09 Thread Andy Fingerhut
Java uses UTF-16 encoding in memory for String objects. Characters in the Basic Multilingual Plane are represented as a single 16-bit character in memory, but anything outside the BMP is represented as a sequence of 2 16-bit characters. Clojure's \u syntax can only be used to directly represent a

Re: 0.1.0 core.async release?

2015-08-08 Thread Andy Fingerhut
Mike, Sean: I don't know if there are deficiencies with this approach, but if you make project.clj the 'original source of truth', and generate pom.xml via 'lein install', does the auto-generated pom.xml contain everything you would need? Andy On Sat, Aug 8, 2015 at 1:02 AM, Mikera wrote: > He

Re: Should the Cheat Sheet mention assoc-in for vectors?

2015-08-06 Thread Andy Fingerhut
I have added assoc-in to the Vectors/'Change' section of the cheat sheet that is available here: http://jafingerhut.github.io That is where the latest version is published. The version at clojure.org/cheatsheet gets updated less frequently -- typically a couple of times a year, when there are mor

Re: Clojure Development jobs?

2015-07-30 Thread Andy Fingerhut
This is not an 'official' answer, but there have been multiple job postings here in the past. I believe they are reasonably welcome if they are from the development team itself that is doing the hiring. I have personally rejected many attempts to post recruiting messages here and on the Clojure D

Re: [ANN] Clojure 1.8.0-alpha2

2015-07-20 Thread Andy Fingerhut
Very likely that was the change for this ticket: http://dev.clojure.org/jira/browse/CLJ-703 Andy On Mon, Jul 20, 2015 at 7:19 PM, Adam Krieg wrote: > Wow, I've upgraded a couple of projects and builds are roughly 50% faster > over 1.7.0. Is that to be expected? > > > On Saturday, July 18, 2015

Re: #{:rant} Questions about contribution policy and clojure compiler source.

2015-07-18 Thread Andy Fingerhut
Andrey: Pull requests have come up many times before, but since it has been quite some time since the last time, perhaps most people have not seen Rich's answer the last time he responded to it. Below is a direct link, if you want to read it. The short answer is that he prefers the work flow of

Re: #{:rant} Questions about contribution policy and clojure compiler source.

2015-07-18 Thread Andy Fingerhut
I don't think the tweets you link are the 'normal approach'. I would call them pretty unusual in several aspects. For one, I think that for the vast majority of Clojure tickets created, no on asks and gets Rich's comments on them before they are created. Second, most end up being committed as the

Re: Updated Clojure cheatsheet, including new vars in Clojure 1.7.0

2015-07-12 Thread Andy Fingerhut
u can find the tooltip-enabled versions, with Clojure 1.7.0 doc strings, and links to either ClojureDocs.org or Grimoire (conj.io). Both of those sites have been updated for Clojure 1.7.0. Andy On Thu, Jun 18, 2015 at 5:36 PM, Andy Fingerhut wrote: > http://jafingerhut.github.io > >

Re: Deprecation library

2015-07-12 Thread Andy Fingerhut
Eastwood warns about deprecated Clojure functions and Java methods (among other things). https://github.com/jonase/eastwood#deprecations Andy On Sun, Jul 12, 2015 at 2:17 PM, Brian Marick wrote: > Is there a library out there for deprecating functions? I'm looking for > something that prin

Re: An elegant implementation of if-all-let

2015-07-11 Thread Andy Fingerhut
Disclaimer: I do not make decisions on what gets into clojure.core. Here is a page that gives some reasons why most things don't get into clojure.core: http://dev.clojure.org/display/design/Why+Feature+X+Was+Declined More specifically on if-all-let and things like it, many people seem to disagree

Re: [ANN] lein-collisions: a plugin to find classpath collisions

2015-07-09 Thread Andy Fingerhut
Herwig: Great examples of why lein-collisions is useful. I think it would be helpful to include that text in your README on Github somewhere. Andy On Thu, Jul 9, 2015 at 9:00 AM, Herwig Hochleitner wrote: > 2015-07-08 18:41 GMT+02:00 Kevin Corcoran : > >> >> The projects on which I work alrea

Re: zipmap different ordering in 1.7

2015-07-01 Thread Andy Fingerhut
Unsorted hash maps changed their seq order from Clojure 1.5.1 to Clojure 1.6.0, and some unsorted maps changed their seq order from Clojure 1.6.0 to Clojure 1.7.0. If you are relying on the seq order of unsorted maps, your program is at risk of breaking across Clojure versions. Andy On Wed, Jul

Re: [ClojureScript] [ANN] Clojure 1.7.0-beta3

2015-06-30 Thread Andy Fingerhut
Is anyone interested in filing a bug against IBM JDK 1.8.0 where it appears that its JIT compiler fails about half of the time when doing 'mvn clean test' in a Clojure 1.7.0 source tree? You can find some attachments in an earlier message of this thread that can get you started, but producing your

Re: equality checking of clojure data structures

2015-06-27 Thread Andy Fingerhut
, June 27, 2015 at 10:44:44 AM UTC-4, Jacob Goodson wrote: >> >> Thanks. >> >> What about the perf of something like this... >> >> ({{:x 1 :y 2} :point} {:x 1 :y 2}) >> >> vs >> >> ({1 2} 1) >> >> and what if the map was

Re: equality checking of clojure data structures

2015-06-27 Thread Andy Fingerhut
(let [foo {:x 1}] (= foo foo)) is fast, because they are identical, and = is fast for things that are identical. In general, two maps that are = are often not identical. If two maps have different numbers of elements, = should quickly return false because of the way equiv() is implemented for

Re: Calling an overloaded Scala function

2015-06-25 Thread Andy Fingerhut
Sorry, I do not know whether Clojure can or cannot determine the correct overload in this situation. All I have is a weak suggestion that work well enough: have you considered creating wrapper functions, e.g. in Scala or Java, that have different enough function signatures that Clojure can easily

Updated Clojure cheatsheet, including new vars in Clojure 1.7.0

2015-06-18 Thread Andy Fingerhut
http://jafingerhut.github.io I'm jumping the gun a little bit by announcing this, as the links for the new Clojure 1.7.0 vars like update, run!, dedupe, etc. do not link to any place useful on ClojureDocs.org or Grimoire yet, but I am guessing they will in not too long from now, when those sit

Re: `rational?` `decimal?` Am I misunderstanding these? (also `float?`)

2015-06-15 Thread Andy Fingerhut
If your definition of a mathematical decimal number is 'one that when written in decimal has a decimal point in it', do you want the answer 'true' or 'false' for the floating point number 1.0? I don't see how that definition of decimal number makes a lot of sense, or why you would want a function

Re: defrecord, equality, hashing, and performance

2015-06-11 Thread Andy Fingerhut
, Mars0i wrote: > > > On Thursday, June 11, 2015 at 2:19:56 PM UTC-5, Andy Fingerhut wrote: >> >> You can override hashCode and/or hasheq methods in deftype. >> > > I've been unable to do it. Is there something special needed to allow > this to work? >

Re: `rational?` `decimal?` Am I misunderstanding these? (also `float?`)

2015-06-11 Thread Andy Fingerhut
Some related facts, but not sure if they offer a perfect justification for _why_ rational? and decimal? return what they do. (source rational?) reveals that it returns true for integers, ratios, and decimal?, where (source decimal?) reveals it is true if it is of type BigDecimal. Arithmetic opera

Re: defrecord, equality, hashing, and performance

2015-06-11 Thread Andy Fingerhut
://dev.clojure.org/jira/browse/CLJ-1224 On Thu, Jun 11, 2015 at 12:19 PM, Andy Fingerhut wrote: > You can override hashCode and/or hasheq methods in deftype. > > If the reason that defrecord hashing is slow in your application is > because hashed recalculates the hash values from scrat

Re: defrecord, equality, hashing, and performance

2015-06-11 Thread Andy Fingerhut
You can override hashCode and/or hasheq methods in deftype. If the reason that defrecord hashing is slow in your application is because hashed recalculates the hash values from scratch each time, without hashing, consider voting for this ticket so that is improved in the future: http://dev.clojure

Re: Question regarding java array

2015-06-10 Thread Andy Fingerhut
Add this line at the top of your file where you try areduce and loop, and look for any reflection warnings that occur when loading the file: (set! *warn-on-reflection* true) If there are none, probably best to post a link to your code, or paste it in a message here if it is short enough, so other

Re: Single-atom update ordering guarantees

2015-06-09 Thread Andy Fingerhut
thread. Other threads might see those instructions as executing > out-of-order. What I'm wondering is whether atoms are subject to this as > well. > > > On Jun 9, 2015, at 10:16 AM, Andy Fingerhut > wrote: > > > > I am not sure why Atamert says "No". >

Re: Single-atom update ordering guarantees

2015-06-09 Thread Andy Fingerhut
I am not sure why Atamert says "No". If the (swap! a inc) and (swap! a dec) are executed in different threads, and they can occur in either order because there is no synchronization between those threads that prevents one of the two possible orders from occurring, then another thread *could* see a

Re: Where should 'if-let-all' macro go?

2015-06-09 Thread Andy Fingerhut
There are several 'utility' libraries for Clojure that may have something like this already, or their authors might be willing to add such a thing: https://github.com/Prismatic/plumbing https://github.com/amalloy/useful Andy On Tue, Jun 9, 2015 at 5:00 AM, crocket wrote: > It evaluates true-c

Re: Is there a cheet sheet for some of the pure symbolic functions like #'

2015-06-08 Thread Andy Fingerhut
I have just updated the Clojure cheat sheet to add most of the characters described in the "Weird and Wonderful Characters of Clojure" article. Many of them were already in the "Reader Macros" section, but I have renamed that section to "Special Characters" and added most of them. http://jafinger

Re: [ANN] Time-Bombed Open License - thoughts?

2015-06-05 Thread Andy Fingerhut
I don't have any comment on the license, except to say that the escrow approach suggested by Franklin Siler seems like it should address this concern, and I believe has been frequently used by large companies wanting a small don't-know-how-long-they'll-exist company to escrow their source code in c

Re: namespace scope

2015-06-04 Thread Andy Fingerhut
A single file can define multiple namespaces, and a single namespace's definition can be spread across multiple files. However, I have not seen either of those things done very often in Clojure projects. By far the most common approach is to have one file per namespace, and each namespace defined

Re: [ANN] Clojure 1.7.0-RC1 now available

2015-06-04 Thread Andy Fingerhut
I'd appreciate a ticket in jira if only to consider >> this again before release. >> >> Thank goodness Stu H screened that one so I can blame him. ;) >> >> >> On Wednesday, June 3, 2015 at 4:00:35 PM UTC-6, Andy Fingerhut wrote: >>> >>&

Re: [ANN] Clojure 1.7.0-RC1 now available

2015-06-03 Thread Andy Fingerhut
Just to provide slightly more info, that change was made because of this ticket: http://dev.clojure.org/jira/browse/CLJ-1169 Andy On Wed, Jun 3, 2015 at 6:34 AM, Mike Rodriguez wrote: > Sorry for the delay in getting back with a response to this. I think it > is fairly clear in the Clojure Com

Re: (clojure.java.io/resource "no-such-file")

2015-06-03 Thread Andy Fingerhut
Unofficial answer from the sidelines. I am in no way associated with the folks who make decisions like this, other than that some of them know my name. Throwing an exception in that case sounds like reasonable behavior to me, but of course any code written now that uses clojure.java.io/resource a

Re: When should defrecord be slower than deftype?

2015-06-02 Thread Andy Fingerhut
I am not sure if this is the root cause of the performance difference you are seeing, but Clojure records do not cache their hash values: http://dev.clojure.org/jira/browse/CLJ-1224 I don't know what the default .hashCode method is for deftypes that do not specify one -- perhaps it is very fast be

Re: non-incanter statistical tests?

2015-06-02 Thread Andy Fingerhut
It may require conversion to/from Java arrays to use them, but there are Apache Commons Math implementations of the computations you mention, and many others: http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/stat/inference/ChiSquareTest.html http://commons.apache.org/

Re: [ANN] Clojure 1.7.0-RC1 now available

2015-05-28 Thread Andy Fingerhut
Tassilo, the issue with flatland.ordered.set/ordered-set was that library had never been updated to match the change in hash function that occurred when Clojure 1.6.0 was released. Alan Malloy released a new version of the ordered library today that fixes that. That has no effect on the other CLJ

Re: clojure edn function reader

2015-05-27 Thread Andy Fingerhut
I am not sure I understand your question. I will answer some questions with some of the same key words in them, and then you can decide if one of them was close to yours :) Clojure includes clojure.core/read [1] and clojure.core/read-string, which can read any Clojure code, but they can be danger

Re: [ClojureScript] [ANN] Clojure 1.7.0-RC1 now available

2015-05-21 Thread Andy Fingerhut
Alex, doing a quick sweep of new public Vars in 1.7.0-RC1 that were not in Clojure 1.6.0 (complete list of all 21 below), I noticed that the following two do not have any doc strings. Intentional, or oversight? *suppress-read* Throwable->map Andy *suppress-read* ->Eduction Throwable->map cat c

Re: Why isn't definterface in the cheatsheet?

2015-05-21 Thread Andy Fingerhut
s0i wrote: > Ah, OK, thanks. I probably depend too mcuh on the cheatsheets. But I'll > go ahead and file an issue for definterface; I think it should be there as > an alternative to gen-interface. > > > On Wednesday, May 20, 2015 at 10:24:16 PM UTC-5, Andy Fingerhut wr

Re: [ANN] Clojure 1.7.0-RC1 now available

2015-05-21 Thread Andy Fingerhut
That may not be the right ticket. Nicola Mometto may have the number memorized, if there is one :-) Here is a workaround that avoids the reflection warning: (let [^java.util.Collection x []] (java.util.ArrayList. x)) Andy On Thu, May 21, 2015 at 11:37 AM, Andy Fingerhut wrote: > I beli

Re: [ANN] Clojure 1.7.0-RC1 now available

2015-05-21 Thread Andy Fingerhut
I believe this issue has been reported in this ticket: http://dev.clojure.org/jira/browse/CLJ-1093 Currently it is not planned to be fixed in Clojure 1.7.0. Maybe a later release will fix it. Andy On Thu, May 21, 2015 at 11:24 AM, Sergey Didenko wrote: > As I mentioned in another thread, how

Re: Why isn't definterface in the cheatsheet?

2015-05-20 Thread Andy Fingerhut
The cheat sheet doesn't include everything. Most things in Clojure, yes, but not all. Looking at the log of the last time I generated the latest version of the cheat sheet, it does not include the 172 Vars listed below. You can file an issue if there are any you think especially ought to be adde

Re: Accessing static fields

2015-05-20 Thread Andy Fingerhut
Java interop _with method names known at compile time_ is pretty simple, and is the most common case I have seen. Why do you think it is supposed to be simple to select Java methods based upon the values of variables at run time? Andy On Wed, May 20, 2015 at 7:31 PM, Pierre Thibault wrote: > T

Re: Why does the following Clojure code take 10x the time the C# version does? How to improve the Clojure version?

2015-05-14 Thread Andy Fingerhut
In general, running any kind of JVM via Leiningen, using the 'ps' command with lots of '' on the end of the command line options should give full command line options used to start the JVM, so you can see what is happening. Understanding exactly which options are good or bad for performance, I

Re: What does ^:internal mean?

2015-05-12 Thread Andy Fingerhut
There are other sources for this information, too (perhaps better ones), but the cheat sheet has a section with many of these special symbols: clojure.org/cheatsheet Andy On Tue, May 12, 2015 at 1:49 PM, Raoul Duke wrote: > knowing how to break down Clojure's syntax a bit helps, too. which > m

<    1   2   3   4   5   6   7   8   9   10   >