It's not going to be easy to read the #<URI form in clojurescript I think.

On the server, I would extend the the print-string (I think its called this 
- you will need to look at the core source code) multi-method. You can use 
this to make java....URI print as a string or as a tagged literal if you 
need it.

D

On Thursday, 10 January 2013 12:42:33 UTC+11, Taylor Sando wrote:
>
> The URIs are coming from a datomic database that actually stores the 
> values as java.net.URIs.  All I'm doing is transferring the query values 
> from the database to the client.  The server uses pr-str before sending 
> back the results, and the client uses reader/read-string to get the 
> results.  
>
> On Wednesday, January 9, 2013 7:35:31 PM UTC-6, Dave Sann wrote:
>>
>> why not just print/send your uris as strings?
>>
>> you only need a reader tag if you want to read/interpret it in a 
>> particular way at read time in the client. do you want to do this?
>>
>> D
>>
>>
>> On Thursday, 10 January 2013 12:20:53 UTC+11, Taylor Sando wrote:
>>>
>>> I am looking for a way to transfer URI objects from a clojure client to 
>>> a clojurescript client.  The printed representation of a java.net.URI 
>>> object is  #<URI "http//www.example.com>  The problem is that I can't 
>>> read in this data when it's structured like that.  For example, I'd like to 
>>> be able to pass this data strucutre to the client {:uri #<URI 
>>> http://www.google.com>}.  From my understanding, the extensible reader 
>>> needs something in the form of #symbol [value].  
>>>
>>> I know how to extend the clojurescript reader:
>>>
>>> (defn make-url [stuff]
>>>   (str (first stuff)))
>>>
>>> (reader/register-tag-parser! 'URI make-url)
>>>
>>> (assert (=  "http://www.google.com"; (reader/read-string "#URI [
>>> http://www.google.com]";)))
>>>
>>> I know that I could just map over the data structure and convert the 
>>> uris to strings, and then send that to the client, but it seems like there 
>>> should be a better way.
>>>
>>

-- 
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

Reply via email to