No need for macro

(let [example-data [['hospice-enc "hospice enc" "HOSPICE_ENC"]
                    ['hospice-env "hospice env" "HOSPICE_ENV"]]]
  (doseq [[name-sym desc-string name-string] example-data]
    (spit "/tmp/clinic.clj"
          (format "%s\n"
                  (pr-str `(onto/defconcept ~name-sym ~desc-string
~name-string)))
          :append true)))

Generates this in /tmp/clinic.clj

(onto/defconcept hospice-enc "hospice enc" "HOSPICE_ENC")
(onto/defconcept hospice-env "hospice env" "HOSPICE_ENV")



On Thu, Sep 27, 2018 at 11:43 AM venkata sai <venkysai...@gmail.com> wrote:

> Yes thank you I will try with this approach..but how do I take parameters
> in macros
>
> On 28 Sep 2018 00:06, "Robert Levy" <r.p.l...@gmail.com> wrote:
>
>> Actually, if you are trying to write out to a file, then instead do this
>>
>> (doseq [[name-sym desc-string name-string] (prepare-data spreadsheet)]
>>   (spit "clinic.clj"
>>         (pr-str `(onto/defconcept ~name-sym ~desc-string ~name-string))
>>         :append true))
>>
>>
>> On Thu, Sep 27, 2018 at 11:30 AM Robert Levy <r.p.l...@gmail.com> wrote:
>>
>>> I think that if you're wanting to do this then you probably are taking
>>> the wrong approach, but taking you at face value I would say try
>>> something like this.  If you provide more information on what you are
>>> actually trying to do, then you might be able to get better advice.
>>>
>>> (defmacro def-onto-concept [name-sym desc-str name-str]
>>>   `(onto/defconcept ~name-sym ~desc-str ~name-str))
>>>
>>> (doseq [[name-sym desc-string name-string] (prepare-data spreadsheet)]
>>>   (def-onto-concept name-sym desc-string name-string))
>>>
>> --
>> 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.
>>
> --
> 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.
>

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