Re: Future of clojure.contrib.core/-?> macro

2013-06-10 Thread Nicola Mometto
They're in the core.incubator contrib repository https://github.com/clojure/core.incubator shlomivak...@gmail.com writes: > Hey, its been a while since this discussion ended.. > > I read through it and now i am fully confused, where did -?> and -?>> end > up being in? > > Thanks, > Shlomi > > On

Re: Lazy seq race condition?

2013-06-24 Thread Nicola Mometto
Realizing a lazy-seq is done through a synchronized method see: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java#L37 No race conditions. Cedric Greevey writes: > What, precisely, happens if two threads sharing a reference to a single > lazy sequence try to realiz

Re: Can we please deprecate the :use directive ?

2013-07-25 Thread Nicola Mometto
Gary Trakhman writes: > You could also do (use 'clojure.test) below the ns form. One thing that > generally annoys me with 'ns' is that people feel it's some magical thing > that has to be in the head of every file, like java imports, but it's > really just a macro. > > It just goes to show that

Re: Invalid token exception on a / operator

2013-07-30 Thread Nicola Mometto
It's going to be possible in clojure-1.6 see: https://github.com/clojure/clojure/commit/88cad2510243289d2bbe28cf8bd14007d9df5fc3 Maik Schünemann writes: > Is / a valid clojure function name (valid, but not recommended)? > I tought so because of clojure.core// > in the repl there is also no prob

[GSoC] CinC mid-term evaluation status

2013-07-31 Thread Nicola Mometto
For the last month or so I've been working on completing Aaron Cohen's CinC. As planned, this first period has been spent working extensively on the analyzer improving it to the point where it's competitive with the analysis done in Compiler.java while keeping it clojurescript-like and extensible

Re: should contains? throw an exception on sorted maps?

2013-08-03 Thread Nicola Mometto
http://dev.clojure.org/jira/browse/CLJ-1242 Jay Fields writes: > This: (contains? (sorted-map 1 2 3 4) :a) > Results in this: ClassCastException java.lang.Long cannot be cast to > clojure.lang.Keyword clojure.lang.Keyword.compareTo (Keyword.java:102) > > -- -- -- You received this message be

Re: How to pass clojure.core/read-str reader-forms to clojure.tools.reader.edn/read-str?

2013-09-09 Thread Nicola Mometto
Hi, The EDN reader (both clojure.tools.reader.edn and clojure.edn) don't read record/type literals by design. You need to use the clojure reader for that or read them as tagged literals. Joachim De Beule writes: > Hi List, > > As documented at http://clojure.org/reader, defining a record with >

Re: How to pass clojure.core/read-str reader-forms to clojure.tools.reader.edn/read-str?

2013-09-09 Thread Nicola Mometto
You could use the :default option of the edn-reader e.g (import 'clojure.lang.Reflector) (defn- read-extended-ctor [class map] (Reflector/invokeStaticMethod (Class/forName (name class)) "create" (object-array [map]))) (defrecord x [a b]) (edn/read-string {:defau

Re: [ANN] Clojure 1.7.0-alpha5 now available

2015-01-14 Thread Nicola Mometto
There actually is a dependency cycle in manifold, it's just not in the ns macro: manifold.stream.graph depends on manifold.graph here: https://github.com/ztellman/manifold/blob/master/src/manifold/stream/graph.clj#L5 maniphold.stream depends on manifold.stream.graph here: https://github.com/ztell

Re: Set equality bug?

2015-01-22 Thread Nicola Mometto
Looks like it's a bug in PersistentHashMap: user=> (contains? (hash-map {:a (float 0.5)} 1) {:a (double 0.5)}) false user=> (contains? (array-map {:a (float 0.5)} 1) {:a (double 0.5)}) true Immo Heikkinen writes: > (= (float 0.5) (double 0.5)) > => true > (= #{(float 0.5)} #{(double 0.5)}) > =>

Re: Set equality bug?

2015-01-22 Thread Nicola Mometto
Looking at the PHM impl, this looks like it's caused by (float 0.5) and (double 0.5) hashing differently. user=> (= (float 0.5) (double 0.5)) true user=> (map hash [(float 0.5) (double 0.5)]) (1056964608 1071644672) Nicola Mometto writes: > Looks like it's a bug in Persis

Re: Set equality bug?

2015-01-22 Thread Nicola Mometto
the current behaviour seems odd to me. Jozef Wagner writes: > More on this behavior http://dev.clojure.org/jira/browse/CLJ-1036 > > On Thu, Jan 22, 2015 at 2:00 PM, Nicola Mometto wrote: > >> >> Looking at the PHM impl, this looks like it's caused by (float 0.5) and >

Re: [ANN] Clojure 1.7.0-alpha5 now available

2015-01-29 Thread Nicola Mometto
k in until CLJ-1499 is committed in the >> future. >> See CLJ-1546 and CLJ-1618 for more details. >> >> 3) Two particularly troublesome AOT classloading bugs have been addressed >> - >> CLJ-979 and CLJ-1544. Many other tickets were found to be duplicates of >

Re: heaps in clojure vs SML

2015-01-30 Thread Nicola Mometto
If you set! *warn-on-reflection* to true, you'd see a lot of reflection warnings from your code. Type-hinting the code like this: http://sprunge.us/ATiV makes your example execute in 120ms on my machine. Maris writes: > I implemented leftist heap (from Purely Functional Data Structures book) >

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-13 Thread Nicola Mometto
Clojure 1.5.1 user=> (def bar (cons 1 (map #(do (println %) (+ (nth bar %) %)) (range #'user/bar user=> (take 10 bar) (0 1 IndexOutOfBoundsException clojure.lang.RT.nthFrom (RT.java:795) It is possible that it is lein/REPLy that's causing the output not to be print, I've seen it done a num

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-13 Thread Nicola Mometto
Clojure 1.6.0 user=> (def foo (delay (str @foo))) #'user/foo user=> @foo StackOverflowError clojure.lang.Delay.deref (Delay.java:37) user=> same with Clojure 1.7.0-master-SNAPSHOT, I don't see it returning nil as you said. On Fri, Feb 13, 2015 at 7:53 AM, Fluid Dynamics wrote: > On Friday, Feb

Re: [ANN] Clojure 1.7.0-alpha6 released

2015-04-02 Thread Nicola Mometto
Not a bug imho, you're invoking reduce with no init arg so you're forcing the realization of at least two elements in the coll, one for init and one for step -- the step one causes the exception. Ambrose Bonnaire-Sergeant writes: > Here's some weird behaviour I found from 1.6. > > user=> (take 1

Re: [ANN] Clojure 1.7.0-alpha6 released

2015-04-02 Thread Nicola Mometto
The recent changes to iterate come with an interesting consequence: reducing an iterate multiple times will cause the entire chain of x, (f x), (f (f x)) .. to be recalculated every time. I'd argue that this is not desiderable and a regression (even though probably one considered by design), and

Re: [ANN] Clojure 1.7.0-alpha6 released

2015-04-02 Thread Nicola Mometto
(take 1000 a))) "Elapsed time: 1.589569 msecs" nil Clojure 1.7.0-master-SNAPSHOT user=> (def a (iterate inc 0)) #'user/a user=> (time (reduce (fn [_ x]) nil (take 1000 a))) "Elapsed time: 4.831726 msecs" nil user=> (time (reduce (fn [_ x]) nil (take 1000 a)))

Re: Strange behaviour of a callable record

2015-04-23 Thread Nicola Mometto
You're not implementing IFn.applyTo, you should. Why applyTo is used in the second example while invoke is used in the other cases has to do with implementation details of how def expressions are compiled/evaluated. Alexey Cherkaev writes: > Hi, > > I have encountered the problem with Clojure 1

Re: Strange behaviour of a callable record

2015-04-23 Thread Nicola Mometto
I've opened an enhancement ticket with a patch that changes this behaviour btw: http://dev.clojure.org/jira/browse/CLJ-1715 Alexey Cherkaev writes: > Hi, > > I have encountered the problem with Clojure 1.6.0, when I create the record > that implements IFn. > > For example, > > (defrecord Foo [x]

Re: Meaning of part of the doc string for `ns-resolve`

2015-04-23 Thread Nicola Mometto
It's talking about fully qualified symbols that map to an actual var. E.g user=> (ns-resolve *ns* 'clojure.string/join) #'clojure.string/join Brian Marick writes: > The last sentence of the `ns-resolve` documentation reads: > >Note that >if the symbol is fully qualified, the var/Class t

Re: [ANN] Clojure 1.7.0-beta2

2015-05-01 Thread Nicola Mometto
The type-hint on init-state is wrong. It has to be either (defn {:tag 'longs} init-state [] (long-array 1)) or (preferred) (defn init-state ^longs [] (long-array 1)) shlomivak...@gmail.com writes: > I tried playing around with the new primitive type hints and got the > following weird behavio

Re: [ANN] Clojure 1.7.0-beta2

2015-05-01 Thread Nicola Mometto
Fluid Dynamics writes: > That's weirdly inconsistent with e.g. (defn ^String prefix [s n]...). It can be surprising behaviour, but it's not an inconsistency. As per the documentation, metadata on the symbol being def'd *is* evaluated, metadata on the argvec isn't. Evaluating `String` produces th

Re: [ANN] Clojure 1.7.0-beta2

2015-05-01 Thread Nicola Mometto
Alex Miller writes: > On Fri, May 1, 2015 at 2:53 PM, Nicola Mometto wrote: >> >> >> Now, if you want to argue that the compiler should immediately throw an >> error as soon as the wrong type hint is used rather than silently ignore >> it and fail when the typ

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

2015-07-20 Thread Nicola Mometto
I take it you have never worked on a patch for clojure. I have, and I can tell you that it's not the indentation style the issue -- everybody likes his own and it's definitely in the maintainer's rights to chose what indentation style should be used and for contributors to adapt, I don't have a pro

Re: Is clojars down?

2014-07-29 Thread Nicola Mometto
There seem to be problems with clojars.org, early this morning and for the past few days clojars.org has been responding with a black page for me and it was confirmed in #clojure by a number of different people. I opened a ticket https://github.com/ato/clojars-web/issues/235 and found out that a s

Re: CLJS Function clobbering js function of same name

2014-08-04 Thread Nicola Mometto
Try with (fn document [] js/document) Thomas Heller writes: > I was not able to reproduce Sam's initial problem. > > "eval" as I said does not appear in the :js-globals which seems like a > mistake. -- You received this message because you are subscribed to the Google Groups "Clojure" group. T

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2301, Transducers!

2014-08-09 Thread Nicola Mometto
I can confirm, there seem to be problem fetching clojurescript versions 0.0-2301 and 0.0-2307. Browsing the Central repo the files are there: http://repo1.maven.org/maven2/org/clojure/clojurescript/0.0-2301/ http://repo1.maven.org/maven2/org/clojure/clojurescript/0.0-2307/ But the maven-metadata

tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-13 Thread Nicola Mometto
As some of you might know, I've been working contiuously on my various tools.* contrib libraries for the past months and I've recently added tools.analyzer.js to the list of contrib libraries I maintain. Since I don't blog/tweet much about those libraries, I thought I'd write a report to let the

Re: CtorReader bug?

2014-08-16 Thread Nicola Mometto
It's by design, see the section on ctor literals http://clojure.org/reader#toc1 "The elements in the vector part are passed unevaluated to the relevant constructor." Nicola dennis zhuang writes: > user=> #java.lang.String["hello world"] > "hello world" > > user=> #java.lang.String[(byte-array)

Re: alter-var-root, what am I doing wrong?

2014-08-16 Thread Nicola Mometto
Because in the repl you're using a thread-local value of *data-readers*, not the var root, this is because the repl is executed under (binding [*data-readers ..] ..) If you try to set! *data-readers* instead, you'll see what you expect. Consider: user=> (def ^:dynamic x nil) #'user/x user=> x ni

Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-19 Thread Nicola Mometto
-handler specifically, > which is very useful to me. > > It seems that analyzer refuses keywords in the form ::a/b, which are used > in some projects > (e.g. [org.clojure/core.typed] clojure.core.typed.check.fn contains > ::t/cmethods at line 21). > > Francesco > > &g

Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-21 Thread Nicola Mometto
David, I personally have no plans to port tools.analyzer.jvm to a tools.analyzer.clr, not for disinterest but simply because I don't know anything about the .NET platform nor about clojureCLR. That said, it shouldn't be hard to port it at all, the main file to port would be https://github.com/cl

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-05 Thread Nicola Mometto
Since tools.analyzer, tools.analyzer.jvm and tools.emitter.jvm are all multimethod intensive, I wondered if the multimethod default value caching commit had any significant impact in their performance. After stress testing tools.emitter.jvm using clojure 1.7.0-alpha1 (no multimethod patch) and cl

[ANN] tools.analyzer[.jvm] 0.6.0 release, pass scheduler

2014-09-18 Thread Nicola Mometto
Today I released version 0.6.0 of the tools.analyzer[1] and tools.analyzer.jvm[2] contrib libraries. With this release comes a new feature I'm really excited about and that I believe will help users of this library significantly: a pass scheduler. Previous to this release, tools.analyzer passes

Re: [ANN] tools.analyzer[.jvm] 0.6.0 release, pass scheduler

2014-09-19 Thread Nicola Mometto
7;m just interested. It's unusual to see #' > > Dave > > On Friday, 19 September 2014 05:07:08 UTC+10, Nicola Mometto wrote: >> >> >> Today I released version 0.6.0 of the tools.analyzer[1] and >> tools.analyzer.jvm[2] contrib libraries. >> >> W

Re: help with tools.emitter.jvm

2014-10-17 Thread Nicola Mometto
Hi Francesco, I just tried evaluating `(println "a")` with c.t.e.jvm using both -beta5 and -SNAPSHOT and it works as expected for me. Are you by any chance using a different tools.analyzer.jvm version than the one -beta5 requires? (0.5.2) If so, that's why it's failing for you. If you need to us

Re: tools.analyzer.jvm clojure.lang.Var$Unbound cannot be cast to clojure.lang.DynamicClassLoader

2014-10-27 Thread Nicola Mometto
Hi Nick, I looked into it, I'm not sure if this should be considered a clojure bug, a lein bug or a t.a.jvm one (I'd expect Compiler/LOADER to always be bound during compilation) but in the meantime I've pushed a workaround that should fix this and a 0.6.2 version is on its way to Maven Central.

Re: tools.analyzer.jvm clojure.lang.Var$Unbound cannot be cast to clojure.lang.DynamicClassLoader

2014-10-27 Thread Nicola Mometto
Version 0.6.2 introduced a bug in analyze+eval, I just released 0.6.3 which also includes a significant preformance improvement. Nicola Mometto writes: > Hi Nick, > I looked into it, I'm not sure if this should be considered a clojure > bug, a lein bug or a t.a.jvm one (I

Re: Namespace metadata

2014-10-29 Thread Nicola Mometto
Might be an instance of http://dev.clojure.org/jira/browse/CLJ-130 Haim Ashkenazi writes: > Sorry, I pressed "send" too soon :) Here it is from the start: > > > When I first wrote ayler (a > simple namespace browser) I used to get the doc for namespace

Re: Namespace metadata

2014-10-29 Thread Nicola Mometto
Also I encountered it in riemann in a namespace that is not AOT at > all. > > > On Wed, Oct 29, 2014 at 3:03 PM, Nicola Mometto wrote: > >> >> Might be an instance of http://dev.clojure.org/jira/browse/CLJ-130 >> >> Haim Ashkenazi writes: >>

Re: how clojure infers types.

2014-11-04 Thread Nicola Mometto
Actually `set` and a lot of other clojure.core functions are neither inlineable nor have type hints. Phillip Lord writes: > I have a piece of code that looks like this > > (.getOWLEquivalentClassesAxiom > (owl-data-factory) > (set classlist) > (union-annotations classlist)) > >

Re: how clojure infers types.

2014-11-04 Thread Nicola Mometto
y to disambiguate. > > I guess even if set was type hinted (to IPersistentSet) it would still > not work since, IPersistentSet is not assignable from java.util.Set. > > Phil > > > > Nicola Mometto writes: > >> Actually `set` and a lot of other clojure.core

Re: thread-any macro "%>"

2014-11-15 Thread Nicola Mometto
as-> only binds the specified expression rather than each result in step and only works from within -> Timothy Baldridge writes: > That was added to clojure.core in 1.6 and is known as "as->" > https://clojuredocs.org/clojure.core/as-%3E > > > > On Sat, Nov 15, 2014 at 6:55 AM, Krzysiek Herod >

Re: reduced doesn't work inside reductions

2014-11-28 Thread Nicola Mometto
This has already been fixed, and reductions will support reduced in 1.7.0. In the meantime you can use 1.7.0-alpha4. Nicola myguidingstar writes: > > > (reduce (fn [acc x] > (if (> acc 10) > (reduced acc) > (+ acc x))) > 0 > (range 100)) > ;; =>

Re: Potential bug in trampoline

2015-01-07 Thread Nicola Mometto
This looks like a serious bug in PersistentList, it has nothing to do with trampoline. Here's a minimal case: user=> ((fn [& args] (apply (fn [a & b] (apply list b)) args)) 1 2 3) (1 2 3) Hongseok Yang writes: > Hi, > > While trying to use trampoline to optimise tail recursion in my Clojure >

Re: Potential bug in trampoline

2015-01-07 Thread Nicola Mometto
I created http://dev.clojure.org/jira/browse/CLJ-1633 with a patch implementing the proposed fix in the stackoverflow answer by the user " d.j.sheldrick". Hongseok Yang writes: > Hi, > > While trying to use trampoline to optimise tail recursion in my Clojure > project, I came across some strange

Re: [ANN] Clojure 1.7.0-alpha5 now available

2015-01-12 Thread Nicola Mometto
Can you try a custom version of clojure 1.7.0-alpha5 with commit e5a104e894ed82f244d69513918d570cee5df67d reverted and see if you still get the exception? Nicola Sean Corfield writes: > Here’s what I see reproducing this in the REPL - this main project doesn't > use core.async (but does use a

Re: lazy-seq and somewhat greedy apply

2016-06-02 Thread Nicola Mometto
Two things at play here: 1- concat is defined to have 4 different arities: 0-arg, 1-arg, 2-arg, 3+args. In order to figure out which arity to use, apply has to realize at least as many elements as the minimum number of args required by the largest arity, which in this case is 3 2- apply has a s

Re: [ANN] Clojure 1.9.0-alpha4

2016-06-04 Thread Nicola Mometto
How is this a regression? It doesn't cause any code that used to work to stop working. The fact that tail destructuring now causes non-sequential collections to be destructured by sequential destructuring should be just considered an instance of GIGO and an implementation detail. > On 4 Jun 20

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-09 Thread Nicola Mometto
I commented about this in the #clojure-dev slack channel, I believe http://dev.clojure.org/jira/browse/CLJ-1874 to be the cause of this issue > On 9 Jun 2016, at 14:32, Alex Miller wrote: > > I think it's quite likely that you have multiple copies of tools.analyzer > (and possibly other libs)

Re: [ANN] Clojure 1.9.0-alpha9

2016-07-06 Thread Nicola Mometto
I'd say that's a bug with 1.8 rather than 1.9 > On 6 Jul 2016, at 13:01, Leon Grapenthin wrote: > > @Alex Miller: Please reconsider. What you state does not apply to 1.8, i. e. > the ns is required in :or and such code is broken in 1.9 > > 1.8/1.9 differences: > (let [{:keys [a/b] :or {b 42}}

Re: [ANN] Clojure 1.9.0-alpha11

2016-08-20 Thread Nicola Mometto
I've used `:alias` to alias clojure.core in the past, I've seen it being used in more than one project On 20 Aug 2016 8:32 a.m., "Colin Fleming" wrote: > (ns ... (require ...) (import ...) ) instead of (ns ... (:require ...) >> (:import ...) ) > > > Is this not intended to be allowed? The docst

Re: Reducing non-Clojure maps may not behave as expected

2016-12-21 Thread Nicola Mometto
Something like what I proposed in http://dev.clojure.org/jira/browse/CLJ-1807 would help solve this ambiguity On 21/12/16 15:22, Mike Rodriguez wrote: On Wednesday, December 21, 2016 at 9:02:36 AM UTC-6, Alex Miller wrote: On Wednesday, December 21, 2016 at 7:24:17 AM UTC-6, Mike R

Re: Destructing lists using &keys -> Difference between '(:opt1 true) and [:opt1 true]

2017-01-02 Thread Nicola Mometto
AFAIK treating kv lists as maps in destructuring was only introduced to support kwargs destructuring, hence why it's not supported for vectors. On 02/01/17 18:00, Sean Corfield wrote: This one had me scratching my head a bit too… here’s what I _/think/_ is going on: First off, note that the

Re: 'get' behaviors

2017-05-29 Thread Nicola Mometto
Issue #1 had been logged in CLJ-1242, but it was later decided to just focus on making equality not throw as contains/get throwing is consistent with java behaviour, see comments from Stu and Alex here https://dev.clojure.org/jira/browse/CLJ-1242?focusedCommentId=40612&page=com.atlassian.jira.pl

Re: [ANN] Primitive Operator

2017-07-03 Thread Nicola Mometto
Hi Phillip, I've had a very quick look at the code and I've spotted a few issues, here's my feedback: 1- all your functions will cause input args and return value to be boxed. There's a few ways to avoid it, none of which are particularly pretty. If your library is not worried about performanc

Re: Bizzarre cond-> behavior

2017-07-21 Thread Nicola Mometto
I have a patch that fixes this, will open a ticket later today. > On 21 Jul 2017, at 10:07, James Reeves wrote: > > I can also confirm, tested on Clojure 1.8.0. The macro doesn't seem to take > long at all; it's the expanded code that takes a significant time to compile. > > On 21 July 2017 at

Re: Bizzarre cond-> behavior

2017-07-21 Thread Nicola Mometto
Ticket with patch + explanation: https://dev.clojure.org/jira/browse/CLJ-2210 <https://dev.clojure.org/jira/browse/CLJ-2210> > On 21 Jul 2017, at 11:06, Nicola Mometto wrote: > > I have a patch that fixes this, will open a ticket later today. > >> On 21 Jul 2017

Re: Bizzarre cond-> behavior

2017-07-21 Thread Nicola Mometto
correct > On 21 Jul 2017, at 12:11, Peter Hull wrote: > > That was quick! So, if I understand it, the problem is not with cond->, it's > the chain of let-bindings it expands to? > Pete > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To

Re: [ANN] Clojure 1.9.0-alpha20

2017-09-08 Thread Nicola Mometto
That looks like a cljs issue, it shouldn't emit NaNs at all there, not relevant to the clojure change around how they are printed. On 8 Sep 2017 8:03 a.m., "Tommi Reiman" wrote: Hi. The combo: [org.clojure/clojure "1.9.0-alpha20"] [org.clojure/clojurescript "1.9.660"] seems to be emitting bro

Re: Help ship Clojure 1.9!

2017-09-29 Thread Nicola Mometto
Yes, clojurescript makes use of a previous experimental feature of tools.reader that allowed Infinity and -Infinity to be read as Double/POSITIVE_INFINITY and Double/NEGATIVE_INFINITY, without special casing how the compiler emitted infinity literals, as clojure previously printed them as "Infi

Re: [ANN] Clojure 1.9.0 is now available!

2018-01-02 Thread Nicola Mometto
The code that caused this issue is https://github.com/clojure/clojure/commit/a1c3dafec01ab02fb10d91f98b9ffd3241e860c0?diff=unified#diff-03234b041c0917ec98f2ad9477a0a014R260 But this is not a bug in the clojure code nor a regression, in fact you can reproduce this in any clojure version with the fol

Re: macroexpand in uberjar

2018-02-15 Thread Nicola Mometto
Use ` instead of ' > On 15 Feb 2018, at 08:45, 'Burt' via Clojure wrote: > > Here is something strange, and I don't see why! > Can anybody help? > > This is the code in m.clj > > (ns m > (:gen-class)) > > (defmacro mx > [x] > (list 'y)) > > (defn -main [] > (println (macroexpand-1 '(

Re: concat and mapcat not sufficiently lazy

2018-07-18 Thread Nicola Mometto
This behaviour is known and there are a couple of tickets about it : https://dev.clojure.org/jira/browse/CLJ-1583 https://dev.clojure.org/jira/browse/CLJ-1218 On Wed, 18 Jul 2018, 08:28 Mark Engelberg, wrote: > I'm kind of surprised I haven't run across this before, but tonight I was > debuggin

Re: concat and mapcat not sufficiently lazy

2018-07-18 Thread Nicola Mometto
en't gotten bitten by this before. This is a > pattern I use frequently in my code; I guess I just never had deep enough > recursion for it to slow things down enough for me to realize what was > happening. > > > > On Wed, Jul 18, 2018 at 12:53 AM, Nicola Mometto <

Re: Calling proxy without reflection

2018-07-30 Thread Nicola Mometto
That's exactly what you should do and it does work, e.g.: user=> (set! *warn-on-reflection* true) true user=> (.meta ^clojure.lang.IMeta (proxy [clojure.lang.IMeta] [] (meta [] {:a 1}))) {:a 1} In your small example you have two errors that might be fishy: a missing arg vector to pass to the su

Re: Calling proxy without reflection

2018-07-30 Thread Nicola Mometto
If you remove the ^Interface type hint, then get-test will work but will > trigger reflection. > > Thanks for looking at this. It seems like it should work, but it doesn't. > > > On Mon, Jul 30, 2018 at 3:06 AM, Nicola Mometto <mailto:brobro...@gmail.com>> wrote: >

Re: Calling proxy without reflection

2018-07-30 Thread Nicola Mometto
)) >> (def p (proxy [Object Interface] [] (test [] 1))) >> (defn get-test [o] (.test ^Interface o)) >> >> => (get-test p) >> This throws an error that it can't cast the proxy to Interface. >> >> If you remove the ^Interface type hint, then get-test w

Re: Calling proxy without reflection

2018-07-30 Thread Nicola Mometto
sh environment. > > I find that the problematic example does work in the user namespace, but it > doesn't work in my segmented namespace (ns mister-rogers.wrappers, to be > really specific). > > On Mon, Jul 30, 2018 at 3:34 AM, Nicola Mometto <mailto:brobro...@gmail.

Re: Calling proxy without reflection

2018-07-30 Thread Nicola Mometto
> ClassCastException > mister_rogers.wrappers.proxy$java.lang.Object$Interface$7e434bc9 cannot be > cast to mister_rogers.wrappers.Interface mister-rogers.wrappers/get-test > (wrappers.clj:82) > > > Thanks for looking at this. > > > On Mon, Jul 30, 2018 at 3:43 AM, Nicola M

Re: Calling proxy without reflection

2018-08-02 Thread Nicola Mometto
yes, the problem is with `proxy` and redefinition, I'm working on a patch to fix this > On 2 Aug 2018, at 07:55, Mark Engelberg wrote: > > For those following along at home, it turned out not to be a problem with the > lein-virgil plugin. It's apparently a bug in Clojure. Renzo and I distill

Re: Calling proxy without reflection

2018-08-02 Thread Nicola Mometto
https://dev.clojure.org/jira/browse/CLJ-2379 > On 2 Aug 2018, at 10:22, Nicola Mometto wrote: > > yes, the problem is with `proxy` and redefinition, I'm working on a patch to > fix this > >> On 2 Aug 2018, at 07:55, Mark Engelberg > <mailto:mark.engelb...@gma

Re: [ANN] Clojure 1.8.0-alpha4

2015-08-04 Thread Nicola Mometto
There is some weirdeness going on with the new release. Compare: Clojure 1.7.0 user=> (def foo String) #'user/foo user=> (defn ^{:tag foo} a []) #'user/a with Clojure 1.8.0-master-SNAPSHOT user=> (def foo String) #'user/foo user=> (defn ^{:tag foo} a []) CompilerException java.lang.IllegalArgu

Re: Using type hints to optimize protocol invocation

2015-09-08 Thread Nicola Mometto
Protocol callsites are already optimized in clojure. Here's the emitted bytecode for a protocol invocation: 0: aload_0 1: aconst_null 2: astore_0 3: dup 4: invokestatic #36 // Method clojure/lang/Util.classOf:(Ljava/lang/Object;)Ljava

Re: Bug in DynamicClassLoader?

2015-09-20 Thread Nicola Mometto
See http://dev.clojure.org/jira/browse/CLJ-1663 András Pálinkás writes: > Can anyone explain to me why do we call super.findClass here: > https://github.com/clojure/clojure/blob/41af6b24dd5be8bd62dc2b463bc53b55e18cd1e5/src/jvm/clojure/lang/DynamicClassLoader.java#L69 > > I believe, on this line,

Re: clojure 1.8 java.lang.VerifyError method: invokeStatic signature: Can only throw Throwable objects

2015-10-01 Thread Nicola Mometto
http://dev.clojure.org/jira/browse/CLJ-1809 Lars Rune Nøstdal writes: > Hi, > Anyone playing around with 1.8 from Git? It has problems compiling this for > some reason: > > (defn blah [] > (let [a (atom nil) > b nil] > (try > (println "hi") > (catch Throwable e >

Re: tools.analyzer help

2015-10-13 Thread Nicola Mometto
Hi Gregg, tools.analyzer (specifically tools.analyzer.jvm) doesn't do any evaluation of the forms by default if you're using the `analyze` function, however there's an `analyze+eval` function that will do that if you need. Note that t.a.jvm is a *clojure* analyzer that will only be able to analyze

Re: Newbie Question: Why is "reduced?" used in the reductions function?

2015-10-17 Thread Nicola Mometto
The `reduced?` check is there in case somebody returns a `reduced` as acc value from the reducing function, as a way to terminate the reduction early: user=> (reductions (fn [_ x] (if (= 10 x) (reduced x) x)) (range)) (0 1 2 3 4 5 6 7 8 9 10) deref is the way to retrieve the value of a reduced o

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

2015-11-11 Thread Nicola Mometto
Here's a minimal repro case: user=> (defn foo ^long [] 1) #'user/foo user=> (Integer/bitCount ^int (foo)) VerifyError (class: user$eval13, method: invokeStatic signature: ()Ljava/lang/Object;) Expecting to find integer on stack java.lang.Class.getDeclaredConstructors0 (Class.java:-2) > On 11

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

2015-11-11 Thread Nicola Mometto
/browse/CLJ-1846 > <http://dev.clojure.org/jira/browse/CLJ-1846> > > Shantanu > > On Wednesday, 11 November 2015 17:13:05 UTC+5:30, Nicola Mometto wrote: > Here's a minimal repro case: > > user=> (defn foo ^long [] 1) > #'user/foo > user=> (Integer/bitCount

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

2015-11-11 Thread Nicola Mometto
On Wednesday, 11 November 2015 17:13:05 UTC+5:30, Nicola Mometto wrote: > Here's a minimal repro case: > > user=> (defn foo ^long [] 1) > #'user/foo > user=> (Integer/bitCount ^int (foo)) > VerifyError (class: user$eval13, method: invokeStatic

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

2015-11-12 Thread Nicola Mometto
This is :rettag in action. Any reason why this error should be acceptable while the CLJ-1846 one isn't? > On 12 Nov 2015, at 12:55, Alex Miller wrote: > > That's not a valid type hint. Var meta is evaluated, in this case to the > double function object. You really want: > > (defn timespi ^doub

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

2015-11-12 Thread Nicola Mometto
Given the number of bytecode/type hinting issues we've seen caused by direct linking and the lack of real benchmarks demonstrating its benefits, I'm also wondering what's the rationale between including it in the current release. > On 10 Nov 2015, at 18:15, Ghadi Shayban wrote: > > Two points

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

2015-11-12 Thread Nicola Mometto
on definition? > > CLJ-1846 is instead a valid type hint that is in conflict with the call. > Which now throws an error. > > > On Thursday, November 12, 2015 at 10:13:13 AM UTC-6, Nicola Mometto wrote: > This is :rettag in action. > Any reason why this error should be

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

2015-11-12 Thread Nicola Mometto
Also just like the CLJ-1846 issue, this bit of code was valid pre 1.8 > On 12 Nov 2015, at 19:14, Nicola Mometto wrote: > > > Depends on how you look at it. > From my point of view, both examples are using an otherwise valid type hint, > at an invalid location, and in both

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

2015-11-12 Thread Nicola Mometto
always seen > the function name hinted. > > On Thu, Nov 12, 2015 at 11:20 AM Nicola Mometto <mailto:brobro...@gmail.com>> wrote: > Also just like the CLJ-1846 issue, this bit of code was valid pre 1.8 > >> On 12 Nov 2015, at 19:14, Nicola Mometto > <mailto:b

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

2015-11-12 Thread Nicola Mometto
Klass.)) (ns bar (:require foo)) (.method (foo/foo)) > On 12 Nov 2015, at 19:49, Leon Grapenthin wrote: > > Does this mean putting it in the arglist always works and there is rarely a > practical reason to do anything else? > > On Thursday, November 12, 2015 at 8:36:20 P

Re: Reflection warning on try/catch inside go block

2015-11-16 Thread Nicola Mometto
It's possibly a tools.analyzer issue, I'll take a look ASAP > On 16 Nov 2015, at 12:41, Alice wrote: > > Sorry, I was having some copy & paste mistake, but I'm seeing the same > warning with .printStackTrace. > > On Monday, November 16, 2015 at 9:25:06 PM UTC+9, Herwig Hochleitner wrote: > The

Re: [ANN] Clojure 1.8.0-RC2

2015-11-20 Thread Nicola Mometto
*clojure-version* is not a function, it's not affected by direct linking > On 20 Nov 2015, at 14:56, Ambrose Bonnaire-Sergeant > wrote: > > I'm missing something, alter-var-root'ing *clojure-version* works just fine > when calling (clojure-version). > > (alter-var-root #'*clojure-version* ass

Re: [ANN] Clojure 1.8.0-RC2

2015-11-20 Thread Nicola Mometto
It doesn't, but direct linking only affects invocations > On 20 Nov 2015, at 15:21, Ambrose Bonnaire-Sergeant > wrote: > > Wait, how does the compiler know that *clojure-version* isn't a function? > > On Fri, Nov 20, 2015 at 10:01 AM, Nicola Mometto wrote:

Re: [ANN] Clojure 1.8.0-RC3

2015-12-02 Thread Nicola Mometto
all the clojure contrib libraries are regularly tested against new clojure versions http://build.clojure.org/ > On 2 Dec 2015, at 16:17, Sreenivas Reddy T > wrote: > > I would love a project where the tool runs all test cases of libraries > against new release candidate. > > On 2 Dec 2015

Re: Extend ns macro?

2015-12-02 Thread Nicola Mometto
def interns the var at compile time, binding is a runtime operation > On 2 Dec 2015, at 16:56, Gregg Reynolds wrote: > > > > On Wed, Dec 2, 2015 at 8:11 AM, gianluca torta wrote: > for some reason, it looks like the implementation of the ns macro assumes > that the macro itself is being defi

Re: Naming convention for atoms, refs, etc.?

2015-12-06 Thread Nicola Mometto
'foo@ is not a valid symbol name > On 6 Dec 2015, at 20:44, Gregg Reynolds wrote: > > Ps. Note the nice symmetry between *foo* and @foo@. > > On Dec 6, 2015 2:42 PM, "Gregg Reynolds" wrote: > Postfix @? Haven't pondered this before but I like the idea. Why should > perl have all the fun? >

Re: Naming convention for atoms, refs, etc.?

2015-12-06 Thread Nicola Mometto
I seriously doubt that's ever going to happen. There's no good reason to do that. > On 6 Dec 2015, at 21:00, Gregg Reynolds wrote: > > > On Dec 6, 2015 2:45 PM, "Nicola Mometto" wrote: > > > > 'foo@ is not a valid symbol name > &

Re: [ANN] Clojure 1.8.0-RC3

2015-12-08 Thread Nicola Mometto
Before 1.8, clojure would accept wrong forms like (throw my-exception 1 2 3). This is now an exception http://dev.clojure.org/jira/browse/CLJ-1456. > On 8 Dec 2015, at 13:05, Noam Ben-Ari wrote: > > Hi, > I have just tried 1.8.0-RC3 and saw a problem. > > I have a project in which I run tests

Re: Possible bug in AOT-compiled Clojure when ns-unmap is used

2015-12-30 Thread Nicola Mometto
While it's true that AOT has many issues, it's getting better release after release and this is definitely a bug. I don't understand why you wouldn't expect this to work, you *should*. OP: can you open a ticket for this bug? I'd love to have a look at this and try to fix it. > On 29 Dec 2015,

Re: Possible bug in AOT-compiled Clojure when ns-unmap is used

2016-01-05 Thread Nicola Mometto
ednesday, December 30, 2015 at 12:02:35 PM UTC-6, Nicola Mometto wrote: > While it's true that AOT has many issues, it's getting better release after > release and this is definitely a bug. > I don't understand why you wouldn't expect this to work, you *should*. >

Re: [ANN] Clojure 1.8.0-RC5

2016-01-13 Thread Nicola Mometto
Thanks for your reports Andy, useful and prompt as always :) > On 13 Jan 2016, at 16:32, Andy Fingerhut wrote: > > 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

  1   2   >