[ANN] tools.reader 0.8.0 released

2013-11-20 Thread Nicola Mometto
https://github.com/clojure/tools.reader Changelog: https://github.com/clojure/tools.reader/blob/master/CHANGELOG.md Leiningen dependency information: [org.clojure/tools.reader 0.8.0] While the releases I made on the last months contained mainly small bugfixes and enhancements needed

ANNOUNCE: Cognitect is sponsoring CinC contrib libraries

2013-12-05 Thread Nicola Mometto
, Nicola Mometto (Bronsa) -- -- 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 members are moderated - please be patient with your first post. To unsubscribe from

Re: case/java interop weirdness

2013-12-30 Thread Nicola Mometto
The test clauses of case expressions are not evaluated, so that case is trying to match the symbol 'FetcherEvent/EVENT_TYPE_FEED_POLLED, not the value of FetcherEvent/EVENT_TYPE_FEED_POLLED. Paul Butcher writes: I'm sure I'm missing something very simple here, but I'm damned if I can see it.

[ANN] tools.analyzer(.jvm) 0.1.0-alpha1

2014-01-10 Thread Nicola Mometto
Today I released the first version of the tools.analyzer[1] and tools.analyzer.jvm[2] contrib libraries, here are the leiningen coordinates: [org.clojure/tools.analyzer 0.1.0-alpha1] [org.clojure/tools.analyzer.jvm 0.1.0-alpha1] Right now the only documentation for both those libraries is in

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Nicola Mometto
Sean, it looks like the issue is caused by arglists like this one: https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L782-L783 tools.analyzer.jvm uses :arglists to detect possible invoke calls with a misplaced arity, expecting that to be a valid value, in

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Nicola Mometto
Sean Corfield writes: Sounds like Eastwood should ignore :arglists and just use the actual argument lists for the arity check, with perhaps an additional lint warning for when what's in :arglists doesn't match possible real signatures of the function? I can see the latter being useful on

Re: concat/forth in -, -

2014-01-18 Thread Nicola Mometto
I don't know if that's what you're asking for, but there's https://github.com/brandonbloom/factjor t x writes: Hi, Despite the title and content of this email, this is a serious, non joking (i.e. brainfuck) question. After studying

Re: possible to preserve formatting info with read-string?

2014-02-02 Thread Nicola Mometto
You can try using tools.reader[1]'s source-logging-push-back-reader: user= (require '[clojure.tools.reader :as r] #_= '[clojure.tools.reader.reader-types :as readers]) nil user= (- { :foo [ bar] } readers/source-logging-push-back-reader r/read meta :source) { :foo [ bar]

Re: [ANN] Clojure 1.6.0-beta1

2014-02-14 Thread Nicola Mometto
I would also like to point out that `if-some` reads like it would work like `if-not` rather than like `if-let`. Same applies obviously to `when-some` too. Timothy Baldridge writes: +1 to everything Dom Kiva-Meyer said. On Fri, Feb 14, 2014 at 2:13 PM, Andrey Antukh n...@niwi.be wrote:

Re: A faster clojure startup

2014-03-06 Thread Nicola Mometto
I wonder how this compares with this change Rich made to enable lazy fn initialization: https://github.com/clojure/clojure/commit/71930b6b6537a796cdf13c4ffa7cf93eb53b6235 that he later reverted: https://github.com/clojure/clojure/commit/c5681382da775e898915b17f3ab18b49c65359ec If I read the

Re: [GSoC] Proposal: persistent probabilistic data structures

2014-03-13 Thread Nicola Mometto
Matteo, best of luck with your proposal, all of those seem like good potential additions to the clojure data-structure landscape. BTW I'm too a fellow UniPD clojure user so you can inc the counter :) Nicola Matteo Ceccarello writes: Hello everybody, I just submitted my proposal for this

Re: non-equality (=) of records nuance

2014-03-18 Thread Nicola Mometto
Here's the bug: user (defrecord a []) user.a user (defrecord b []) user.b user (.__extmap (map-b (map-a {:a 1}))) #user.a{:a 1} -- 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

Re: non-equality (=) of records nuance

2014-03-18 Thread Nicola Mometto
I added a patch+tests here http://dev.clojure.org/jira/browse/CLJ-1388 Alex Miller writes: Yeah that looks bad. -- 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: [GSoC] Proposal: persistent probabilistic data structures

2014-03-19 Thread Nicola Mometto
suggested by the wiki. Cheers, Matteo Il giorno giovedì 13 marzo 2014 23:06:11 UTC+1, Nicola Mometto ha scritto: Matteo, best of luck with your proposal, all of those seem like good potential additions to the clojure data-structure landscape. BTW I'm too a fellow UniPD clojure user so you

Re: Clojure 1.6.0-RC1 - LAST CHANCE, PLEASE TEST

2014-03-19 Thread Nicola Mometto
I'm guessing it's because of the minor overhead on hashing added with the move to Murmur3? Alex Miller writes: record scratch what's that about performance now? Is that something definitive and reproducible? And if so, is there any way to track down a cause? -- You received this message

Re: Clojure 1.6.0-RC1 - LAST CHANCE, PLEASE TEST

2014-03-19 Thread Nicola Mometto
ASM 4.1 does not work with JDK 1.8 see http://dev.clojure.org/jira/browse/CLJ-1323 Steve Miner writes: I just tried to build master locally with the new JDK 1.8 on a Mac. I'm getting a build test failure. Sorry, I don't have time to look into it at the moment. JDK 1.7 worked fine for

Re: [ANN] Eastwood 0.1.1 Clojure lint tool

2014-03-20 Thread Nicola Mometto
. Jonas Enlund wrote the original version of Eastwood with the help of several other contributors. Version 0.1.1 is an update by Jonas, Nicola Mometto, and myself. It uses the new Clojure contrib libraries tools.reader for reading the code, and tools.analyzer and tools.analyzer.jvm

Re: working with multiple return values

2014-03-28 Thread Nicola Mometto
You can use destructuring user= (let [[a b] [(+ 1 2) (+ 2 3)]] [a b]) [3 5] Christopher Howard writes: In Clojure, what is the easiest (cleanest) way to return multiple values from a function, in order to work with them immediately afterwards? In Haskell you can return a tuple, and

Re: Clojure count and get functions much faster on strings than direct interop with .length and .charAt

2013-02-17 Thread Nicola Mometto
Try to set! *warn-on-reflection* to true and you'll find out that there's a lot of reflection going on when using direct java interop. Try benchmarking (.length ^String sss) and you'll see the difference Geo writes: I am writing an expensive algorithms in Clojure and while trying to optimize

Re: Understanding vars

2013-03-22 Thread Nicola Mometto
Opened ticket with fix + test http://dev.clojure.org/jira/browse/CLJ-1187 Mark Engelberg writes: On Tue, Mar 19, 2013 at 12:57 AM, Bronsa brobro...@gmail.com wrote: If I remember correctly, this is a bug due to the fact that constant empty literals are handled in a special way from the

Re: Getting array length

2013-03-30 Thread Nicola Mometto
use the function alength Alice writes: Why doesn't (.length (int-array 5)) work? Why should I use alength or count instead? -- -- -- 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

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 Thursday,

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 realize

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

[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

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

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

GSoC Report: CinC, port of the clojure compiler in clojure

2013-09-22 Thread Nicola Mometto
For the past 3 months I've been working as part of my GSoC project, on a port of the clojure compiler and analyzer to clojure. Tomorrow the GSoC will end, so this is a report of what I've accomplished with this project thus far; note that I'm not going to stop working on CinC now that the GSoC

Stretch Goal 1: CinC development

2013-09-30 Thread Nicola Mometto
Given the amazing support shown by the clojure community, Ambrose's campaign has already raised its goal. As some of you might have noticed, yesterday Ambrose revealed the first stretch goal of his campaign and that is helping me continue develop CinC and I want to spend some time explaining

Re: GSoC Report: CinC, port of the clojure compiler in clojure

2013-10-07 Thread Nicola Mometto
, Nicola Mometto wrote: For the past 3 months I've been working as part of my GSoC project, on a port of the clojure compiler and analyzer to clojure. Tomorrow the GSoC will end, so this is a report of what I've accomplished with this project thus far; note that I'm not going to stop working

Re: GSoC Report: CinC, port of the clojure compiler in clojure

2013-10-08 Thread Nicola Mometto
I don't think that's what Mike was talking about. Say we have (defn x ^long [] 1), clojure will use the IFn$L and emit an public long invokePrim() method. When we do (defn y [] (let [a (x)] a) the compiler will call .invokePrim instead of invoke. If we redefine (defn x [] ) then y won't work

Re: [ClojureScript] Re: ClojureScript Clojure 1.6.0

2014-06-06 Thread Nicola Mometto
For that matters, I'm working on writing tools.analyzer.js and the minimum clojure version supported will be 1.4.0 Nicola Chris Granger writes: Since I doubt there'd be any others, I'll be the only dissenter ;) People already get mad Light Table requiring 1.5 since we use CLJS to do

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

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. To post

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

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) utf8]

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 nil

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

2014-08-19 Thread Nicola Mometto
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 On Wednesday, August 13, 2014 6:54:54 PM UTC+2, Nicola Mometto wrote: As some of you

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

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

[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
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. With this release comes a new feature I'm really excited about and that I believe will help users

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 use

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'd expect Compiler/LOADER

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 https://github.com/babysnakes/ayler/wiki (a simple namespace browser) I used to get the doc for namespace by

Re: Namespace metadata

2014-10-29 Thread Nicola Mometto
it in riemann in a namespace that is not AOT at all. On Wed, Oct 29, 2014 at 3:03 PM, Nicola Mometto brobro...@gmail.com wrote: 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

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)) The

Re: how clojure infers types.

2014-11-04 Thread Nicola Mometto
is not assignable from java.util.Set. Phil Nicola Mometto brobro...@gmail.com writes: 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

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)) ;; = 15

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 PersistentHashMap: user

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)}) = true

Re: Set equality bug?

2015-01-22 Thread Nicola Mometto
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 brobro...@gmail.com wrote: Looking at the PHM impl, this looks like it's caused by (float 0.5) and (double 0.5) hashing differently. user= (= (float

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:

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

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 a2093...@trbvm.com wrote:

Re: [ANN] Clojure 1.7.0-alpha5 now available

2015-01-29 Thread Nicola Mometto
and CLJ-1544. Many other tickets were found to be duplicates of one of these as well. Big thanks to Nicola Mometto for doing the hard work on debugging and providing fixes for these. For all changes new in alpha5, see the issues marked (alpha5) in the full changes below

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: 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: 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: [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
: 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))) Elapsed time: 4.058695 msecs nil Nicola Mometto writes: The recent

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: 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 to

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: 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

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

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 brobro...@gmail.com 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 type-hinted form is used, I'll

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 behavior

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

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

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
e.org/jira/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=>

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

2015-11-11 Thread Nicola Mometto
wse/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 ^int (foo)) > VerifyError (class: user$eval13, method: invokeSt

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

2015-11-12 Thread Nicola Mometto
r 12, 2015 at 8:36:20 PM UTC+1, Nicola Mometto wrote: > It.. depends :( > > If your type hint is a *primitive* then you want to put it in the arglist. If > you put it in the Var, the best case scenario is that you'll get either > reflection warnings or boxed maths, and the worst

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

2015-11-12 Thread Nicola Mometto
? I've always seen > the function name hinted. > > On Thu, Nov 12, 2015 at 11:20 AM Nicola Mometto <brobro...@gmail.com > <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,

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

2015-11-12 Thread Nicola Mometto
> this should throw an error 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 w

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 <brobro...@gmail.com> wrote: > > > Depends on how you look at it. > From my point of view, both examples are using an otherwise valid type hint, >

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

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

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: >

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

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

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

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: 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

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

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

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

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 <d...@mobileink.com> wrote: > > > On Dec 6, 2015 2:45 PM, "Nicola Mometto" <brobro...@gmail.com> wrote: > > > > 'foo@ is

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

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

2016-01-05 Thread Nicola Mometto
onses. > > On Wednesday, 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: 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: [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). > >

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 > <abonnaireserge...@gmail.com> wrote: > > Wait, how does the compiler know that *clojure-version* isn't a function? > > On Fri, Nov 20, 2015 at 10:01 AM

  1   2   >