I got this to work by modifying my read-all function to convert the results 
from the take-while into a vector.
Not entirely sure why it makes a difference, but I got through it for now.
Interestingly, calling vec isn't needed when using clojure.tools.reader.edn.

Thanks for your help.


(defn read-all [source-code]
  (let [reader (readers/source-logging-push-back-reader source-code)
        eof    (Object.)]
    (binding [r/*data-readers* *data-readers*]
      (vec
        (take-while #(not= % eof)
          (repeatedly #(r/read reader false eof)))))))


On Monday, May 12, 2014 6:53:45 PM UTC-4, Sarkis Karayan wrote:
>
> Doesn't seem to work:
>
> (ns literal-test
>   (:require [datomic.api :as d]
>             [clojure.tools.reader :as r]
>             [clojure.tools.reader.reader-types :as readers]))
>
> (defn read-all [source-code]
>   (let [reader (readers/source-logging-push-back-reader source-code)
>         eof    (Object.)]
>     (binding [r/*data-readers* *data-readers*]
>       (take-while #(not= % eof)
>         (repeatedly #(r/read reader false eof))))))
>
> (read-all "#db/id [db.part/user -100]")
>
>
>
> *ExceptionInfo No reader function for tag id  clojure.core/ex-info 
> (core.clj:4327)*
>
> Any ideas?
>
> Thanks,
> Sarkis
>
>
>
> On Monday, May 12, 2014 6:27:13 PM UTC-4, Nicola Mometto wrote:
>>
>> (binding [clojure.tools.reader/*data-readers* *data-readers*] 
>>   (clojure.tools.reader/read ..))
>> is probably what you want.
>>
>>
>> On Tue, May 13, 2014 at 12:17 AM, Sarkis Karayan <skar...@gmail.com>wrote:
>>
>>> Hi everyone,
>>>
>>> I am trying to use clojure.tools.reader to read from a file and also 
>>> process datomic #db/id literals, but I am not sure how to pass in the 
>>> *data-readers*?
>>>
>>> clojure.tools.reader.edn allows something like this:
>>> (edn/read reader false eof { :readers *data-readers* } )
>>>
>>> Is there something equivalent with clojure.tools.reader?
>>>
>>> Thanks,
>>> Sarkis
>>>
>>>
>>>  -- 
>>> 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.
>>>
>>
>>

-- 
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/d/optout.

Reply via email to