Is this expected behavior with meta data?

2015-06-25 Thread Sarkis Karayan
Why doesn't this work? user=> (meta ^{:some-meta 123} 'n) nil While this works: user=> (meta ^{:some-meta 123} (fn [n] n)) {:some-meta 123} And this works too: user=> (meta (with-meta 'n {:some-meta 123})) {:some-meta 123} Is this intended behavior? If so, what's the reasoning? Thanks, Sarki

Changing default clojure reader

2014-08-29 Thread Sarkis Karayan
Hello, Is it possible to change the default clojure reader to use clojure.tools.reader.reader-types/source-logging-push-back-reader? I am currently using this reader so that I can see the source code of my fns at runtime as metadata, however, it requires that I read the source again once the p

Re: *data-readers* with clojure.tools.reader -- No reader function for tag id

2014-05-12 Thread Sarkis Karayan
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 [

Re: *data-readers* with clojure.tools.reader -- No reader function for tag id

2014-05-12 Thread Sarkis Karayan
s, 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 > > >

*data-readers* with clojure.tools.reader -- No reader function for tag id

2014-05-12 Thread Sarkis Karayan
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 somethi

Re: Best way to create a namespace at runtime from a web app

2014-04-24 Thread Sarkis Karayan
new namespace as part of a web server. > Care to provide an example? :) > > > On Thursday, 24 April 2014 18:44:02 UTC+1, Sarkis Karayan wrote: >> >> Hi everyone, >> >> I am working on a web app that allows code and namespace creation at >> runtime, but I g

Re: Best way to create a namespace at runtime from a web app

2014-04-24 Thread Sarkis Karayan
Thank you, I was doing everything but the obvious. :-) On Thursday, April 24, 2014 11:26:39 AM UTC-7, A. Webb wrote: > > Have you tried the aptly named > create-ns > ? > -- You received this message because you are subscribed to the Go

Best way to create a namespace at runtime from a web app

2014-04-24 Thread Sarkis Karayan
Hi everyone, I am working on a web app that allows code and namespace creation at runtime, but I get an error when trying to create a namespace from a web process: java.lang.IllegalStateException: Can't change/establish root binding of: *ns* with set This works when doing in a repl or single t

Re: possible to preserve formatting info with read-string?

2014-02-02 Thread Sarkis Karayan
eader.reader-types :as readers]) > nil > > user=> (-> "{ :foo [ bar] }" readers/source-logging-push-back-reader >r/read meta :source) > "{ :foo [ bar] }" > > [1]https://github.com/clojure/tools.reader > > Sarkis Karayan writes: &g

Re: possible to preserve formatting info with read-string?

2014-02-02 Thread Sarkis Karayan
Perfect, thank you! On Sunday, February 2, 2014 9:38:03 PM UTC-5, Sarkis Karayan wrote: > > Hey guys, > > Is there a similar function to read-string that preserves formatting info > (perhaps by storing formatting info as metadata)? > > My app does a read-string on a cloju

possible to preserve formatting info with read-string?

2014-02-02 Thread Sarkis Karayan
Hey guys, Is there a similar function to read-string that preserves formatting info (perhaps by storing formatting info as metadata)? My app does a read-string on a clojure file and saves the content to datomic (each fn is stored in an entity, each file can have multiple fns). The difficulty t