Re: clojure.edn/read-string exceptions = nil

2014-01-26 Thread t x
I recently ran into this problem again.

The solution I came up with is:

(defn filter-printable [obj]
  (cond
   (or (symbol? obj) (number? obj) (string? obj) (keyword? obj)) obj
   (vector? obj) (apply vector (map filter-printable obj))
   (seq? obj) (map filter-printable obj)
   (set? obj) (into #{} (map filter-printable obj))
   (map? obj) (into {} (for [[k v] obj]
 [(filter-printable v) (filter-printable v)]))
   true [:un-readable (pr-str obj)]))

## example:

(filter-printable
 {:k 20
  :f 'abc
  :d '(+ 1 2 3 foo)
  :other (async/chan 10)})


Anyone have a better / more elegant solution?




On Thu, Jan 16, 2014 at 10:17 AM, t x txrev...@gmail.com wrote:

 After looking at edn/read-string and realizing I would have to modify Java
 code, I have decided that modifying the sender in clojure land isn't so bad
 after all.


 On Thu, Jan 16, 2014 at 9:41 AM, Alex Miller a...@puredanger.com wrote:

 I think I would change the sender to elide whatever parts you don't want
 to send rather than mess with the receiver.


 On Thursday, January 16, 2014 2:11:02 AM UTC-6, t x wrote:

 Hi,

   Right now if I do (clojure.edn/read-string ...) on a string with a
 unreadable part, I get an exception. Instead, I would like to just get nil.
 For example:


 ## code

 (clojure.edn/read-string
  (pr-str
   {:tag :message
:chan (async/chan 10)}))

 ## currently returns

 java.lang.RuntimeException: Unreadable form
  at clojure.lang.Util.runtimeException (Util.java:219)


 ## instead, I would like:

 {:tag :message
  :chan :nil}


 Is there a way to make this happen?

 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
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 this group, send email to
clojure+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.edn/read-string exceptions = nil

2014-01-26 Thread Cedric Greevey
Shouldn't that be:

(defn filter-printable [obj]
  (cond
   (or (symbol? obj) (number? obj) (string? obj) (keyword? obj)) obj
   (vector? obj) (apply vector (map filter-printable obj))
   (seq? obj) (map filter-printable obj)
   (set? obj) (into #{} (map filter-printable obj))
   (map? obj) (into {} (for [[k v] obj]
 [(filter-printable k) (filter-printable v)]))
   true [:un-readable (pr-str obj)]))

?


On Sun, Jan 26, 2014 at 3:53 AM, t x txrev...@gmail.com wrote:

 I recently ran into this problem again.

 The solution I came up with is:

 (defn filter-printable [obj]
   (cond
(or (symbol? obj) (number? obj) (string? obj) (keyword? obj)) obj
(vector? obj) (apply vector (map filter-printable obj))
(seq? obj) (map filter-printable obj)
(set? obj) (into #{} (map filter-printable obj))
(map? obj) (into {} (for [[k v] obj]
  [(filter-printable v) (filter-printable v)]))
true [:un-readable (pr-str obj)]))

 ## example:

 (filter-printable
  {:k 20
   :f 'abc
   :d '(+ 1 2 3 foo)
   :other (async/chan 10)})


 Anyone have a better / more elegant solution?




 On Thu, Jan 16, 2014 at 10:17 AM, t x txrev...@gmail.com wrote:

 After looking at edn/read-string and realizing I would have to modify
 Java code, I have decided that modifying the sender in clojure land isn't
 so bad after all.


 On Thu, Jan 16, 2014 at 9:41 AM, Alex Miller a...@puredanger.com wrote:

 I think I would change the sender to elide whatever parts you don't want
 to send rather than mess with the receiver.


 On Thursday, January 16, 2014 2:11:02 AM UTC-6, t x wrote:

 Hi,

   Right now if I do (clojure.edn/read-string ...) on a string with a
 unreadable part, I get an exception. Instead, I would like to just get nil.
 For example:


 ## code

 (clojure.edn/read-string
  (pr-str
   {:tag :message
:chan (async/chan 10)}))

 ## currently returns

 java.lang.RuntimeException: Unreadable form
  at clojure.lang.Util.runtimeException (Util.java:219)


 ## instead, I would like:

 {:tag :message
  :chan :nil}


 Is there a way to make this happen?

 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
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



  --
 --
 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 this group, send email to
 clojure+unsubscr...@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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
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 this group, send email to
clojure+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.edn/read-string exceptions = nil

2014-01-16 Thread t x
I should add: this problem arises due to cljs / clojure talking over the
network, so:

(*) not using serialization is NOT an option

(*) however, I don't have to use edn/read-string + pr-str

(*) it's perfectly fine to use different encoding/decoding methods


On Thu, Jan 16, 2014 at 12:11 AM, t x txrev...@gmail.com wrote:

 Hi,

   Right now if I do (clojure.edn/read-string ...) on a string with a
 unreadable part, I get an exception. Instead, I would like to just get nil.
 For example:


 ## code

 (clojure.edn/read-string
  (pr-str
   {:tag :message
:chan (async/chan 10)}))

 ## currently returns

 java.lang.RuntimeException: Unreadable form
  at clojure.lang.Util.runtimeException (Util.java:219)


 ## instead, I would like:

 {:tag :message
  :chan :nil}


 Is there a way to make this happen?

 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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.edn/read-string exceptions = nil

2014-01-16 Thread Luc Prefontaine
Wrap the read in a try catch just return nil in the catch clause
for this specific exception and wrap it in a function for ease
of use. You might want to throw up any other exceptions and
only catch this one

Luc P.


 I should add: this problem arises due to cljs / clojure talking over the
 network, so:
 
 (*) not using serialization is NOT an option
 
 (*) however, I don't have to use edn/read-string + pr-str
 
 (*) it's perfectly fine to use different encoding/decoding methods
 
 
 On Thu, Jan 16, 2014 at 12:11 AM, t x txrev...@gmail.com wrote:
 
  Hi,
 
Right now if I do (clojure.edn/read-string ...) on a string with a
  unreadable part, I get an exception. Instead, I would like to just get nil.
  For example:
 
 
  ## code
 
  (clojure.edn/read-string
   (pr-str
{:tag :message
 :chan (async/chan 10)}))
 
  ## currently returns
 
  java.lang.RuntimeException: Unreadable form
   at clojure.lang.Util.runtimeException (Util.java:219)
 
 
  ## instead, I would like:
 
  {:tag :message
   :chan :nil}
 
 
  Is there a way to make this happen?
 
  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
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
--
Luc Prefontainelprefonta...@softaddicts.ca sent by ibisMail!

-- 
-- 
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 this group, send email to
clojure+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.edn/read-string exceptions = nil

2014-01-16 Thread t x
Either you misunderstood my question or I misunderstood your answer.

I don't want the entire expression to return nil. I only want the
_unparsable_ part to return nil.

Thus, the above answer should be

{:tag :message
:chan ni}

rather than

nil


On Thu, Jan 16, 2014 at 1:47 AM, Luc Prefontaine 
lprefonta...@softaddicts.ca wrote:

 Wrap the read in a try catch just return nil in the catch clause
 for this specific exception and wrap it in a function for ease
 of use. You might want to throw up any other exceptions and
 only catch this one

 Luc P.


  I should add: this problem arises due to cljs / clojure talking over the
  network, so:
 
  (*) not using serialization is NOT an option
 
  (*) however, I don't have to use edn/read-string + pr-str
 
  (*) it's perfectly fine to use different encoding/decoding methods
 
 
  On Thu, Jan 16, 2014 at 12:11 AM, t x txrev...@gmail.com wrote:
 
   Hi,
  
 Right now if I do (clojure.edn/read-string ...) on a string with a
   unreadable part, I get an exception. Instead, I would like to just get
 nil.
   For example:
  
  
   ## code
  
   (clojure.edn/read-string
(pr-str
 {:tag :message
  :chan (async/chan 10)}))
  
   ## currently returns
  
   java.lang.RuntimeException: Unreadable form
at clojure.lang.Util.runtimeException (Util.java:219)
  
  
   ## instead, I would like:
  
   {:tag :message
:chan :nil}
  
  
   Is there a way to make this happen?
  
   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
  Note that posts from new members are moderated - please be patient with
 your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@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+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 --
 Luc Prefontainelprefonta...@softaddicts.ca sent by ibisMail!

 --
 --
 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 this group, send email to
 clojure+unsubscr...@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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
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 this group, send email to
clojure+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.edn/read-string exceptions = nil

2014-01-16 Thread Bronsa
What  you want is currently not possible.
If you need this functionality, I'll take a patch for tools.reader that
adds a :nil-on-unreadable option to clojure.tools.reader.edn/read.
Il giorno 16/gen/2014 11.05, t x txrev...@gmail.com ha scritto:

 Either you misunderstood my question or I misunderstood your answer.

 I don't want the entire expression to return nil. I only want the
 _unparsable_ part to return nil.

 Thus, the above answer should be

 {:tag :message
 :chan ni}

 rather than

 nil


 On Thu, Jan 16, 2014 at 1:47 AM, Luc Prefontaine 
 lprefonta...@softaddicts.ca wrote:

 Wrap the read in a try catch just return nil in the catch clause
 for this specific exception and wrap it in a function for ease
 of use. You might want to throw up any other exceptions and
 only catch this one

 Luc P.


  I should add: this problem arises due to cljs / clojure talking over the
  network, so:
 
  (*) not using serialization is NOT an option
 
  (*) however, I don't have to use edn/read-string + pr-str
 
  (*) it's perfectly fine to use different encoding/decoding methods
 
 
  On Thu, Jan 16, 2014 at 12:11 AM, t x txrev...@gmail.com wrote:
 
   Hi,
  
 Right now if I do (clojure.edn/read-string ...) on a string with a
   unreadable part, I get an exception. Instead, I would like to just
 get nil.
   For example:
  
  
   ## code
  
   (clojure.edn/read-string
(pr-str
 {:tag :message
  :chan (async/chan 10)}))
  
   ## currently returns
  
   java.lang.RuntimeException: Unreadable form
at clojure.lang.Util.runtimeException (Util.java:219)
  
  
   ## instead, I would like:
  
   {:tag :message
:chan :nil}
  
  
   Is there a way to make this happen?
  
   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
  Note that posts from new members are moderated - please be patient with
 your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@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+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 --
 Luc Prefontainelprefonta...@softaddicts.ca sent by ibisMail!

 --
 --
 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 this group, send email to
 clojure+unsubscr...@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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 --
 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 this group, send email to
 clojure+unsubscr...@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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
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 this group, send email to
clojure+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.edn/read-string exceptions = nil

2014-01-16 Thread Luc Prefontaine
Oups, skipped the last part of your
emal. With edn I see no way to
do this. 

Luc


 Either you misunderstood my question or I misunderstood your answer.
 
 I don't want the entire expression to return nil. I only want the
 _unparsable_ part to return nil.
 
 Thus, the above answer should be
 
 {:tag :message
 :chan ni}
 
 rather than
 
 nil
 
 
 On Thu, Jan 16, 2014 at 1:47 AM, Luc Prefontaine 
 lprefonta...@softaddicts.ca wrote:
 
  Wrap the read in a try catch just return nil in the catch clause
  for this specific exception and wrap it in a function for ease
  of use. You might want to throw up any other exceptions and
  only catch this one
 
  Luc P.
 
 
   I should add: this problem arises due to cljs / clojure talking over the
   network, so:
  
   (*) not using serialization is NOT an option
  
   (*) however, I don't have to use edn/read-string + pr-str
  
   (*) it's perfectly fine to use different encoding/decoding methods
  
  
   On Thu, Jan 16, 2014 at 12:11 AM, t x txrev...@gmail.com wrote:
  
Hi,
   
  Right now if I do (clojure.edn/read-string ...) on a string with a
unreadable part, I get an exception. Instead, I would like to just get
  nil.
For example:
   
   
## code
   
(clojure.edn/read-string
 (pr-str
  {:tag :message
   :chan (async/chan 10)}))
   
## currently returns
   
java.lang.RuntimeException: Unreadable form
 at clojure.lang.Util.runtimeException (Util.java:219)
   
   
## instead, I would like:
   
{:tag :message
 :chan :nil}
   
   
Is there a way to make this happen?
   
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
   Note that posts from new members are moderated - please be patient with
  your first post.
   To unsubscribe from this group, send email to
   clojure+unsubscr...@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+unsubscr...@googlegroups.com.
   For more options, visit https://groups.google.com/groups/opt_out.
  
  --
  Luc Prefontainelprefonta...@softaddicts.ca sent by ibisMail!
 
  --
  --
  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 this group, send email to
  clojure+unsubscr...@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+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 -- 
 -- 
 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 this group, send email to
 clojure+unsubscr...@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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
--
Luc Prefontainelprefonta...@softaddicts.ca sent by ibisMail!

-- 
-- 
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 this group, send email to
clojure+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.edn/read-string exceptions = nil

2014-01-16 Thread Alex Miller
I think I would change the sender to elide whatever parts you don't want to 
send rather than mess with the receiver.

On Thursday, January 16, 2014 2:11:02 AM UTC-6, t x wrote:

 Hi,

   Right now if I do (clojure.edn/read-string ...) on a string with a 
 unreadable part, I get an exception. Instead, I would like to just get nil. 
 For example:


 ## code

 (clojure.edn/read-string
  (pr-str
   {:tag :message
:chan (async/chan 10)}))

 ## currently returns

 java.lang.RuntimeException: Unreadable form
  at clojure.lang.Util.runtimeException (Util.java:219)


 ## instead, I would like:

 {:tag :message
  :chan :nil}


 Is there a way to make this happen?

 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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.edn/read-string exceptions = nil

2014-01-16 Thread t x
After looking at edn/read-string and realizing I would have to modify Java
code, I have decided that modifying the sender in clojure land isn't so bad
after all.


On Thu, Jan 16, 2014 at 9:41 AM, Alex Miller a...@puredanger.com wrote:

 I think I would change the sender to elide whatever parts you don't want
 to send rather than mess with the receiver.


 On Thursday, January 16, 2014 2:11:02 AM UTC-6, t x wrote:

 Hi,

   Right now if I do (clojure.edn/read-string ...) on a string with a
 unreadable part, I get an exception. Instead, I would like to just get nil.
 For example:


 ## code

 (clojure.edn/read-string
  (pr-str
   {:tag :message
:chan (async/chan 10)}))

 ## currently returns

 java.lang.RuntimeException: Unreadable form
  at clojure.lang.Util.runtimeException (Util.java:219)


 ## instead, I would like:

 {:tag :message
  :chan :nil}


 Is there a way to make this happen?

 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
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
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 this group, send email to
clojure+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.