timing sleep

5 views
Skip to first unread message

Parth Malwankar

unread,
Aug 15, 2008, 4:11:08 AM8/15/08
to Clojure
Hello,

Here is something I tried.

user=> (. Thread sleep 1000)
nil
user=> (time (. Thread sleep 1000))
java.lang.ClassFormatError: Field "ret__834" in class user/eval__2163
has illegal signature "V"
clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:0: Field
"ret__834" in class user/eval__2163 has illegal signature "V"
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3821)
at clojure.lang.Compiler.analyze(Compiler.java:3654)
at clojure.lang.Compiler.eval(Compiler.java:3845)
at clojure.lang.Repl.main(Repl.java:75)
Caused by: java.lang.ClassFormatError: Field "ret__834" in class user/
eval__2163 has illegal signature "V"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at
clojure.lang.DynamicClassLoader.defineClass(DynamicClassLoader.java:
36)
at clojure.lang.Compiler$FnExpr.compile(Compiler.java:2983)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2770)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3812)
... 3 more
user=> (time (* 10 10))
"Elapsed time: 0.077316 msecs"
100
user=>

Is it not possible to time (. Thread sleep 1000)? What I am doing
wrong?

Thanks.
Parth

Parth Malwankar

unread,
Aug 15, 2008, 4:12:25 AM8/15/08
to Clojure
Wrapping it in another function seems to work though:

user=> (defn big-computation [x] (. Thread sleep 1000) (* 10 x))
#'user/big-computation
user=> (time (big-computation 1))
"Elapsed time: 1012.272771 msecs"
10
user=>

Rich Hickey

unread,
Aug 15, 2008, 8:58:23 AM8/15/08
to Clojure
Fixed - thanks for the report.

Rich

Parth Malwankar

unread,
Aug 15, 2008, 10:13:42 AM8/15/08
to Clojure
Works perfectly. Thanks Rich.
Reply all
Reply to author
Forward
0 new messages