Re: type function returning a NullPointerException

2019-02-15 Thread Alex Miller
What's the stack trace when you get an NPE? (pst *e) Are you shadowing a core function with your own `count` or something like that? On Friday, February 15, 2019 at 8:27:55 AM UTC-6, KJO wrote: > > Hi- > > This one has me stumped. The following code snippet throws a >

Re: type function returning a NullPointerException

2019-02-15 Thread KJO
;> >> Hi- >> >> This one has me stumped. The following code snippet throws a >> NullPointerException and I just can't understand how it could. >> >> (if (set? t-val) >> (println t-val (type t-val))) >> >> It seems that if it's a

type function returning a NullPointerException

2019-02-15 Thread KJO
Hi- This one has me stumped. The following code snippet throws a NullPointerException and I just can't understand how it could. (if (set? t-val) (println t-val (type t-val))) It seems that if it's a set, it should have a set type. If I change the code to (if (set? t-val) (pri

Re: Got NullpointerException when using loop/recur/let together

2017-10-25 Thread Matching Socks
Also, have another look at '(ret (- time-now start-time)) It will yield a list containing the symbol 'ret and a nested list containing the symbol '- etc etc etc. I think what you expected was a vector of two numbers. -- You received this message because you are subscribed to the Google Group

Re: Got NullpointerException when using loop/recur/let together

2017-10-24 Thread Justin Smith
you wrap a call to Thread/sleep in parens, in clojure this means you want to call it, Thread/sleep returns nil and calling nil gives a NullpointerException Parens are not for grouping or sequencing things in clojure, and you don't need them here - fn has an implicit do block already, in

Got NullpointerException when using loop/recur/let together

2017-10-24 Thread yihao yang
(RuntimeException. (str "'ls' not working in " time-out "seconds."))) (recur start-time time-out ) ) ) But it returns a NullpointerException after 1 seconds. Could anyone help me out? Thanks, Yihao -- You received this message because you are sub

Re: NullPointerException on ManagementFactory/getThreadMXBean ???

2016-01-25 Thread piastkrakow
entFactory/getThreadMXBean) > cpu-times (map (fn [t] > [(.getThreadCpuTime mgr (.getId t)) t]) > (threads))] > (map > (fn [[cpu t]] [cpu (.getName t) (.getId t) t]) > (reverse (sort-by first cpu-times) > >

NullPointerException on ManagementFactory/getThreadMXBean ???

2016-01-25 Thread piastkrakow
(reverse (sort-by first cpu-times) With some code borrowed from here: http://lifeisagraph.com/2011/04/24/debugging-clojure.html Does anyone see a place where a NullPointerException might get started? I assume this must be some circumstance unique to startup. I don't think this

Re: NullPointerException when creating protocol in macro

2013-06-07 Thread Vincent
Thanks everyone for your answers. I must say I'm quite mystified as to why Stuart's version works. I ended up defining a function that has the same signature as the protocol, and whose first argument wraps a function that contains the appropriate code. Vincent On Wednesday, 5 June 2013 23:57:

Re: NullPointerException when creating protocol in macro

2013-06-05 Thread Softaddicts
protocol-name signature] protocol] > >> `(do > >>(defprotocol ~protocol-name ~signature) > >>(fn [] (reify ~protocol-name ~implementation) > >> > >> (let [f (create-protocol [P (method [this])] > >>

Re: NullPointerException when creating protocol in macro

2013-06-05 Thread Stuart Sierra
On Wed, Jun 5, 2013 at 7:35 PM, Colin Fleming wrote: > Given this, are there any forms that are genuinely top-level from the > compiler's point of view? It's never explicitly enforced, just a consequence of how the compiler creates and loads Java classes. Generally, the things which compile dir

Re: NullPointerException when creating protocol in macro

2013-06-05 Thread Colin Fleming
nal code is more complicated, where the function will read a >> value from a file and, depending on that value, return the appropriate >> implementation of the protocol. >> >> When I run Clojure 1.5.1 on that code I get the following exception: >> Exception in thread &

Re: NullPointerException when creating protocol in macro

2013-06-05 Thread Stuart Sierra
Hi Vincent, `defprotocol` is a top-level form, not really meant to be mixed with value-returning expressions like `fn`. Protocols are always global because of how they compile into Java interfaces. Here's one way to make it work, by defining a symbol instead of returning a function: (defmacro

NullPointerException when creating protocol in macro

2013-06-05 Thread Vincent
I’m trying to write a macro that defines a protocol and a function that, when called, returns an implementation of that protocol. I’ve reduced the code to the following example: (defmacro create-protocol [protocol implementation] (let [[protocol-name signature] protocol] `(do (defpro

what is the issue: NullPointerException com.mongodb.DBCursor._check (DBCursor.java:365) for congomongo

2013-04-18 Thread Zhi Yang
I use a mongodb which use sharding, so I connect to mongos. but when I query like: (fetch :locations) NullPointerException com.mongodb.DBCursor._check (DBCursor.java:365) there is error if the use (fetch :locations :one? true) it works. anyone know what is going on? I use version

what is the issue: NullPointerException com.mongodb.DBCursor._check (DBCursor.java:365) for congomongo

2013-04-18 Thread Zhi Yang
I use a mongodb which use sharding, so I connect to mongos. but when I query like: (fetch :locations) NullPointerException com.mongodb.DBCursor._check (DBCursor.java:365) there is error if the use (fetch :locations :one? true) it works. anyone know what is going on? I use version

Re: clj-logging-config, lein2 and AOT compilation == NullPointerException

2012-09-05 Thread Leonardo Borges
I haven't really found out what the problem is - and haven't been looking into it - but I put a small clojure app together to replicate the issue. You can find it on dropbox[1] I've also updated the issue I had opened on the clj-logging-config github issues page [2] If you're keen on debugging

clj-logging-config, lein2 and AOT compilation == NullPointerException

2012-09-03 Thread Leonardo Borges
Hi all, I've been debugging an issue in my Clojure app deployed on Heroku and after some time I finally tracked it down to what appears to be an issue when AOT compiling the project while using clj-logging-config [1] It works without any issues if I let Clojure compile my namespaces on the fly. A

Re: NullPointerException

2012-05-17 Thread Evan Mezeske
On Thursday, May 17, 2012 1:25:45 PM UTC-7, Armando Blancas wrote: > > -- it's also just plain wrong. Those are not local functions: def always >> operates at top-level. >> >> > Big deal. You see what I mean? Pedantry is contagious. > Well, I guess if "trying not to give newcomers blatantly fals

Re: NullPointerException

2012-05-17 Thread Raoul Duke
On Thu, May 17, 2012 at 1:25 PM, Armando Blancas wrote: >> -- it's also just plain wrong.  Those are not local functions: def always >> operates at top-level. > Big deal. You see what I mean? Pedantry is contagious. er, i should think it *is* a big deal: programming languages really don't give on

Re: NullPointerException

2012-05-17 Thread Armando Blancas
> > -- it's also just plain wrong. Those are not local functions: def always > operates at top-level. > > Big deal. You see what I mean? Pedantry is contagious. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

Re: NullPointerException

2012-05-17 Thread Evan Mezeske
On Thursday, May 17, 2012 12:52:27 PM UTC-7, Armando Blancas wrote: > > "There's nothing wrong" is a pretty strong statement. > > > LOL. Perhaps as strong as "it is definitely the wrong way to do things"? > Jeez. > > Pedantry is the wrong way to welcome newbies to this board. > Far from being ped

Re: NullPointerException

2012-05-17 Thread Raoul Duke
On Thu, May 17, 2012 at 12:52 PM, Armando Blancas wrote: > Pedantry is the wrong way to welcome newbies to this board. stop with your pedantry about there must be no pedantry? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, se

Re: NullPointerException

2012-05-17 Thread Armando Blancas
> > "There's nothing wrong" is a pretty strong statement. LOL. Perhaps as strong as "it is definitely the wrong way to do things"? Jeez. Pedantry is the wrong way to welcome newbies to this board. -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: NullPointerException

2012-05-17 Thread Moritz Ulrich
It's called Emacs + Paredit :-) On Thu, May 17, 2012 at 8:00 PM, Raoul Duke wrote: > some day we'll have the technology to let the compiler tell us that, > instead of spewing some horrible, pointless, stack trace? -- Moritz Ulrich -- You received this message because you are subscribed to t

Re: NullPointerException

2012-05-17 Thread Alan Malloy
"There's nothing wrong" is a pretty strong statement. It works, but it is definitely the wrong way to do things. Using a letfn, or external helper functions, is a much better approach. On May 17, 12:19 pm, Armando Blancas wrote: > The redefinition of functions somehow is spooking the compiler. Bu

Re: NullPointerException

2012-05-17 Thread Armando Blancas
The redefinition of functions somehow is spooking the compiler. But if you're at the REPL you should be seeing these warnings (are you doing AOT compile?) WARNING: double already refers to: #'clojure.core/double in namespace: user, being replaced by: #'user/double WARNING: * already refers to: #

Re: NullPointerException

2012-05-17 Thread eniotna
2012/5/17 Raoul Duke > On Thu, May 17, 2012 at 10:55 AM, eniotna wrote: > > Look at your parenthesis. > > You did not close your first function. > > some day we'll have the technology to let the compiler tell us that, > emacs told me. But i'm sure some other editors can tell you that too. inst

Re: NullPointerException

2012-05-17 Thread eniotna
Furthermore, The syntax you're using is not correct. If you want to define functions inside your function ex1_17, use letfn. Something along the line: (defn ex1_17 [] (letfn [(double [x] (+ x x)) (halve [x] (/ x 2)) (mult [a b] (cond (= b 0) 0

Re: NullPointerException

2012-05-17 Thread Raoul Duke
On Thu, May 17, 2012 at 10:55 AM, eniotna wrote: > Look at your parenthesis. > You did not close your first function. some day we'll have the technology to let the compiler tell us that, instead of spewing some horrible, pointless, stack trace? -- You received this message because you are subsc

Re: NullPointerException

2012-05-17 Thread eniotna
Hi, Look at your parenthesis. You did not close your first function. Antoine 2012/5/17 Sargash > Hi! > > I have a problem. With that code: > > ; === > ; ex 1.17 multiply > (defn ex1_17 [] > (defn double [x] (+ x x)) > (defn halve [x] (/ x 2)) > > (defn *

NullPointerException

2012-05-17 Thread Sargash
Hi! I have a problem. With that code: ; === ; ex 1.17 multiply (defn ex1_17 [] (defn double [x] (+ x x)) (defn halve [x] (/ x 2)) (defn * [a b] (cond (= b 0) 0 (even? b) (* (double a) (halve b)) :else (+ a (* a (- b 1) (print

Re: NullPointerException in c.l.Compiler.lookupVar after aot compilation: means what?

2011-11-09 Thread Brian Marick
On Nov 9, 2011, at 4:58 PM, Stuart Halloway wrote: >>> Line 4 of midje.util.report is unusual in several ways: it precedes the ns >>> call, adds a second ns call, does an eval, and uses def forms not at the >>> top level: >> >> Thanks, Stu. That code was a patch that came in when I was new to

Re: NullPointerException in c.l.Compiler.lookupVar after aot compilation: means what?

2011-11-09 Thread Stuart Halloway
>> Line 4 of midje.util.report is unusual in several ways: it precedes the ns >> call, adds a second ns call, does an eval, and uses def forms not at the top >> level: > > Thanks, Stu. That code was a patch that came in when I was new to Clojure, > and I didn't understand it. I think it was a

Re: NullPointerException in c.l.Compiler.lookupVar after aot compilation: means what?

2011-11-09 Thread Brian Marick
On Nov 8, 2011, at 8:47 PM, Alan Malloy wrote: >> (let [ns-obj (the-ns (doto 'clojure.test require)) >> the-var (intern ns-obj 'old-report)] >> (when-not (.hasRoot the-var) >> (intern ns-obj 'old-report clojure.test/report))) >> >> Seems to have the same effect as the defonce in some

Re: NullPointerException in c.l.Compiler.lookupVar after aot compilation: means what?

2011-11-09 Thread Brian Marick
On Nov 8, 2011, at 6:44 PM, Stuart Halloway wrote: > Line 4 of midje.util.report is unusual in several ways: it precedes the ns > call, adds a second ns call, does an eval, and uses def forms not at the top > level: Thanks, Stu. That code was a patch that came in when I was new to Clojure, an

Re: NullPointerException in c.l.Compiler.lookupVar after aot compilation: means what?

2011-11-08 Thread Alan Malloy
/lib/dev > > >    Compiling midje-aot.core > > >    Compilation succeeded. > > > > But certain of the namespaces can't be loaded: > > > > 1766 $ lein repl > > > REPL started; server listening on localhost port 40437 > > > user=> (requ

Re: NullPointerException in c.l.Compiler.lookupVar after aot compilation: means what?

2011-11-08 Thread Alan Malloy
But certain of the namespaces can't be loaded: > > > 1766 $ lein repl > > REPL started; server listening on localhost port 40437 > > user=> (require 'midje.semi-sweet) > > NullPointerException   clojure.lang.Compiler.lookup

Re: NullPointerException in c.l.Compiler.lookupVar after aot compilation: means what?

2011-11-08 Thread Stuart Halloway
started; server listening on localhost port 40437 > user=> (require 'midje.semi-sweet) > NullPointerException clojure.lang.Compiler.lookupVar (Compiler.java:6780) > > What could that exception mean? What's a starting point for debugging? The full stack trace:

NullPointerException in c.l.Compiler.lookupVar after aot compilation: means what?

2011-11-08 Thread Brian Marick
k/src/midje-aot/lib Copying 1 file to /Users/marick/src/midje-aot/lib/dev Compiling midje-aot.core Compilation succeeded. But certain of the namespaces can't be loaded: 1766 $ lein repl REPL started; server listening on localhost port 40437 user=> (require 'midje.semi-sweet) Nu

Re: SICP sqrt function generates unexpected NullPointerException

2011-10-16 Thread Alan Malloy
An infinite loop on large inputs is unrelated to his null-pointer problem. As SICP makes clear, the imprecision of floating-point arithmetic means this particular algorithm will not terminate for large inputs. That is, rounding errors stop it from making progress when the numbers are large and the

Re: SICP sqrt function generates unexpected NullPointerException

2011-10-16 Thread Timo Grodzinski
+1 hangs with Clojure 1.2.1 in Slimes REPL on Java 1.6.0_26 (Ubuntu) -- 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

Re: SICP sqrt function generates unexpected NullPointerException

2011-10-14 Thread Alan O'Donnell
Armando, I get the same behavior as you with Clojure 1.2.1. But if I lein dep Clojure 1.3.0, I'm back to NullPointerExceptions. -- 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 po

Re: SICP sqrt function generates unexpected NullPointerException

2011-10-14 Thread Armando Blancas
With 1.3/OSX this code worked up to: user=> (sqrt 1) 100.0 and then hanged here: user=> (sqrt 10) ~ $ On Oct 13, 7:04 pm, "Alan O'Donnell" wrote: > Hi everyone, > > I've encountered an unexpected NullPointerException while tran

SICP sqrt function generates unexpected NullPointerException

2011-10-14 Thread Alan O'Donnell
Hi everyone, I've encountered an unexpected NullPointerException while translating some early SICP code into Clojure 1.3.0. In particular, I'm implementing the iterative sqrt procedure from section 1.1.7. Here's my code: (defn square [x] (* x x)) (defn abs [x] (cond

Re: NullPointerException on disj

2010-05-27 Thread Allen Johnson
Opened ticket #360 for this. https://www.assembla.com/spaces/clojure/support/tickets/360-nullpointerexception-on-disj Thanks. -- 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

Re: NullPointerException on disj

2010-05-27 Thread Rich Hickey
On May 27, 1:10 am, Allen Johnson wrote: > Hey everyone. I was playing around with the protocols/deftype stuff > and ran into a weird NullPointerException when calling the satisfies? > function. Seems to only happen with a java.lang.Object instance. > > Clojure 1.2.0-master-

NullPointerException on disj

2010-05-26 Thread Allen Johnson
Hey everyone. I was playing around with the protocols/deftype stuff and ran into a weird NullPointerException when calling the satisfies? function. Seems to only happen with a java.lang.Object instance. Clojure 1.2.0-master-SNAPSHOT user=> (defprotocol Greeter (greet [this])) Greeter u

Re: Clojars.org artifact upload issue - NullPointerException

2010-04-01 Thread Shantanu Kumar
On Apr 2, 4:37 am, "Alex Osborne" wrote: > Hi Shantanu, > > Shantanu Kumar writes: > >   jettify-java > >   jar > >   0.2 > >   jettify-java > >   http://code.google.com/p/bitumenframework/ > > You appear to not be specifying a groupId in your POM.  Try adding one. It worked. Thanks! Regards,

Re: Clojars.org artifact upload issue - NullPointerException

2010-04-01 Thread Alex Osborne
Hi Shantanu, Shantanu Kumar writes: > jettify-java > jar > 0.2 > jettify-java > http://code.google.com/p/bitumenframework/ You appear to not be specifying a groupId in your POM. Try adding one. Cheers, Alex -- You received this message because you are subscribed to the Google Gro

Clojars.org artifact upload issue - NullPointerException

2010-04-01 Thread Shantanu Kumar
Hi, I am trying to upload a JAR to Clojars.org but I am getting NullPointerException. Can somebody help me understand what's going on? The log is below: D:\projects\hgrepos\jettify\jettify-parent\jettify-java\target>scp pom.xml jettify-java-0.2.jar cloj...@clojars.org: Welcome to

Re: NullPointerException from #'> et al.

2010-01-14 Thread Timothy Pratley
2010/1/15 C. Florian Ebeling : > I agree. It only looks inconsistent when you assume nil is treated > uniformly by these comparison function, which does not make sense. I quite often wish to compare comparable objects that are not numbers and wrote some simple operators to do that: user=> ( ( ( (

Re: NullPointerException from #'> et al.

2010-01-14 Thread ataggart
Also, it is consistent given that == is the numerical analogue to <=, etc. -- 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

Re: NullPointerException from #'> et al.

2010-01-14 Thread ataggart
On Jan 14, 9:00 am, "C. Florian Ebeling" wrote: > > What do you think should be the boolean result of (> nil 1)? > > > Since the inequality functions only work with Numbers, and nil is not > > a Number.  The only way to make that work would be to impute some > > default numerical value to nil, w

Re: NullPointerException from #'> et al.

2010-01-14 Thread C. Florian Ebeling
> What do you think should be the boolean result of (> nil 1)? > > Since the inequality functions only work with Numbers, and nil is not > a Number.  The only way to make that work would be to impute some > default numerical value to nil, which would probably introduce more > problems than it solve

Re: NullPointerException from #'> et al.

2010-01-14 Thread ataggart
On Jan 14, 7:57 am, "C. Florian Ebeling" wrote: > Hi, > > out of curiosity, what is the reasoning behind this behavior (I'm > pretty sure it is intended): > > (= nil 1) > => false > > (> nil 1) ;; NullPointerException > > Same behavior for >=

NullPointerException from #'> et al.

2010-01-14 Thread C. Florian Ebeling
Hi, out of curiosity, what is the reasoning behind this behavior (I'm pretty sure it is intended): (= nil 1) => false (> nil 1) ;; NullPointerException Same behavior for >= <= etc. Florian -- Florian Ebeling florian.ebel...@gmail.com -- You received this messag

Re: NullPointerException with defmacro and none without?!

2009-09-01 Thread Sir Diddymus
Ah, thanks to both of you for the fast reply - as always, the problem's to be found between chair and keyboard. ;) Greetings from Germany, Sir Diddymus P.S.: Btw, great props to Meikel for vimclojure - now I can use the world's best editor with nice Clojure integration. 8) --~--~-~--

Re: NullPointerException with defmacro and none without?!

2009-09-01 Thread Meikel Brandmeyer
Hi, Am 01.09.2009 um 17:44 schrieb Sir Diddymus: (defmacro RunQt [args & body] `( (try (QApplication/initialize (into-array [~args])) (catch RuntimeException e# (println e#))) ~...@body (QApplication/exec))) You have to wrap the try and QApplication/exec call into a `do`:

Re: NullPointerException with defmacro and none without?!

2009-09-01 Thread Christophe Grand
Hello! On Tue, Sep 1, 2009 at 5:44 PM, Sir Diddymus wrote: > Hi all, > >> (defmacro RunQt [args & body] >>   `( >>     (try >>       (QApplication/initialize (into-array [~args])) >>       (catch RuntimeException e# (println e#))) >>     ~...@body >>     (QApplication/exec))) (defmacro RunQt [ar

NullPointerException with defmacro and none without?!

2009-09-01 Thread Sir Diddymus
clojure.main qtest.clj I have this behavior under WinXP and 2k, with Java RE 1.5.x and with JDK 1.6.0_16, Clojure 1.0.0 and the latest Qt Jambi. Am I just missing something totally fundamental and this is expected behavior? I fiddled with this code for I don't know how long, tried this

Re: NullPointerException in Compiler.java

2009-07-03 Thread Rich Hickey
On Jul 3, 5:27 am, jon wrote: > Hi, could Rich or someone knowledgeable look into this (reflection > related?) NullPointerException in Compiler.java. > I think it's either a bug or at least should provide a better error > message, but I don't have any time to look dee

NullPointerException in Compiler.java

2009-07-03 Thread jon
Hi, could Rich or someone knowledgeable look into this (reflection related?) NullPointerException in Compiler.java. I think it's either a bug or at least should provide a better error message, but I don't have any time to look deeper into it.. Thanks, Jon - I was using clojure-1.0

Re: clojure.contrib.test-is/run-tests throws NullPointerException w/ invalid args

2009-05-06 Thread Stuart Sierra
On May 5, 2:05 pm, Timo Mihaljov wrote: > When clojure.contrib.test-is/run-tests is given an invalid argument, it > throws a NullPointerException: Fixed! -SS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &q

Re: clojure.contrib.test-is/run-tests throws NullPointerException w/ invalid args

2009-05-06 Thread Timo Mihaljov
Stuart Sierra wrote: > On May 5, 2:05 pm, Timo Mihaljov wrote: >> When clojure.contrib.test-is/run-tests is given an invalid argument, it >> throws a NullPointerException: > > Yes, I'm aware of this, will try to fix.

Re: clojure.contrib.test-is/run-tests throws NullPointerException w/ invalid args

2009-05-05 Thread Stuart Sierra
On May 5, 2:05 pm, Timo Mihaljov wrote: > When clojure.contrib.test-is/run-tests is given an invalid argument, it > throws a NullPointerException: Yes, I'm aware of this, will try to fix. -SS --~--~-~--~~~---~--~~ You received this message beca

clojure.contrib.test-is/run-tests throws NullPointerException w/ invalid args

2009-05-05 Thread Timo Mihaljov
When clojure.contrib.test-is/run-tests is given an invalid argument, it throws a NullPointerException: user=> (use 'clojure.contrib.test-is) nil user=> (run-tests 'asdf) java.lang.RuntimeException: java.lang.NullPointerException (NO_SOURCE_FILE:0) The issue seems harmless

Possible bug, NullPointerException for undefined proxy interface or super-class

2009-02-15 Thread BerlinBrown
I don't know if this is expected, but I get a Nullpointerexception when I implement a proxy function and the 'interface' isn't 'imported'. For example, I was refactoring some code and didn't carry over the import and get this nullpointerexception error. Obvi

Not really a NullPointerException, and repl lines

2008-11-28 Thread Jeff Rose
Clojure user=> (nil (println "asd") ) java.lang.NullPointerException (NO_SOURCE_FILE:1) user=> This seems like an odd error to get here. Couldn't it say something like "invalid function as first value"? It also made me wonder, would it be possible to have a line counter inside the REPL, and

A clearer exception than NullPointerException

2008-10-26 Thread samppi
I'm new at Clojure, but from trying it out it seems really cool. I have a minor request—when a list is evaluated and its first argument is nil, a NullPointerException occurs. This took me a while to debug when I had put (some-fn 3), and some-fn happened to be nil in some cases. Could a cl