Re: macro to unwrap a list

2016-02-15 Thread Gary Verhaegen
On Monday, 15 February 2016, Sonny To wrote: > I am trying to write a macro to unwrap a list: > > here's my naive attempt > > (defmacro unwrap [s] > (-> s pr-str (clojure.string/replace #"[\(\)]" "") read-string)) > > (unwrap (1 2 3) )

Re: macro to unwrap a list

2016-02-15 Thread Stuart Sierra
write a macro to unwrap a list: > > here's my naive attempt > > (defmacro unwrap [s] > (-> s pr-str (clojure.string/replace #"[\(\)]" "") read-string)) > > (unwrap (1 2 3) ) should give 1 2 3 > > any ideas how this can be done? > > thank

Re: macro to unwrap a list

2016-02-15 Thread James Reeves
What do you mean by "unwrap a list"? If you mean something where: (foo (unwrap 1 2 3)) == (foo 1 2 3) Then I'm afraid this can't be done. A macro returns a single data structure. - James On 15 February 2016 at 18:54, Sonny To wrote: > I am trying to write a

macro to unwrap a list

2016-02-15 Thread Sonny To
I am trying to write a macro to unwrap a list: here's my naive attempt (defmacro unwrap [s] (-> s pr-str (clojure.string/replace #"[\(\)]" "") read-string)) (unwrap (1 2 3) ) should give 1 2 3 any ideas how this can be done? thanks, Sonny -- You received