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
>
;>
>> 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
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
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
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
(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
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)
>
>
(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
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:
protocol-name signature] protocol]
> >> `(do
> >>(defprotocol ~protocol-name ~signature)
> >>(fn [] (reify ~protocol-name ~implementation)
> >>
> >> (let [f (create-protocol [P (method [this])]
> >>
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
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 &
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
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
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
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
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
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
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
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
>
> -- 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
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
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
>
> "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.
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
"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
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: #
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
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
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
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 *
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
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
>> 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
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
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
/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
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
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:
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
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
+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
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
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
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
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
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-
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
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,
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
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
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=> ( ( ( (
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
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
> 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
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 >=
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
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)
--~--~-~--
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`:
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
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
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
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
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
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.
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
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
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
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
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
70 matches
Mail list logo