Could type function (type X) print nothing?

107 views
Skip to first unread message

임정택

unread,
Apr 24, 2015, 11:19:14 PM4/24/15
to clo...@googlegroups.com
Hello, Clojure users.
I'm a beginner of Clojure, so it could be a dumb question.

I'm playing with Apache Storm, and I leave below line to see tuple value when something is wrong.

(log-warn "Can't transfer tuple - task value is null. tuple type: " (type tuple) " and information: " tuple)

log-warn is defined...

(ns backtype.storm.log
  (:require [clojure.tools [logging :as log]]))

(defmacro log-warn
[& args]
`(log/warn (str ~@args)))

But it prints like...

2015-04-23T14:46:59.517+0200 b.s.d.worker [WARN] Can't transfer tuple - task value is null. tuple type:  and information: 

Evaluated value of (type tuple) and tuple value (maybe toString()?) doesn't printed. 
Is this possible? If possible, please let me know what type the tuple can be.

Thanks!

Regards.
Jungtaek Lim (HeartSaVioR)

James Reeves

unread,
Apr 24, 2015, 11:48:25 PM4/24/15
to clo...@googlegroups.com
    (str nil)
    => ""
    (type nil)
    => nil
    (str (type nil))
    => ""

Rather than use `str`, try using `pr-str` to get a more accurate representation of the data:

    (pr-str nil)
    => "nil"

- James

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

임정택

unread,
Apr 25, 2015, 10:29:27 AM4/25/15
to clo...@googlegroups.com, ja...@booleanknot.com
My god, you save me. Thanks!

2015년 4월 25일 토요일 오후 12시 48분 25초 UTC+9, James Reeves 님의 말:
Reply all
Reply to author
Forward
0 new messages