Re: Trouble with advanced macros

2019-03-28 Thread Nathan Rogers
 (def dict
   {:key `(str "obj isn't defined in this scope" (:blah ~'obj))}) 
  
 (defmacro my-macro [obj & args]  
   `(let [o# ~obj 
  a# ~args] 
  (apply (fn [obj args] (print ~(:key dict) args)) o# a#)))   


This approach looks even better and still doesn't work :(

On Thursday, March 28, 2019 at 9:58:25 PM UTC-6, Nathan Rogers wrote:
>
> (def dict   
>   {:key `(str "obj isn't defined in this scope" (:blah ~'obj))}) 
>  
> (defmacro my-macro [obj & args]   
>   `(print ~(:key dict) ~@args)) 
>
>
> (macroexpand '(my-macro {:blah "thingy"} "test string"))  
>
>
>
> I have a need to inline arbitrary code, but that code needs to know about 
> some things in the context of the macro. In the minimal example, you can 
> see that I need to get the key :blah from some symbol obj, in this context 
> one :key might be one set of code, another :key in a list of dicts might 
> have a completely different bit of code. I want to avoid using functions 
> here, because despite the simple appearance, calling functions will bee 
> horrible and messy. Is there any way to accomplish this? 
>
> The above example appears to give me what I need, but obj isn't in scope. 
> I've tried something like the following, but it still isn't correct
>
> (def dict   
>   {:key `(str "obj isn't defined in this scope" (:blah ~'obj))})  
>
> (defmacro my-macro [my-obj & args]   
>   `(let [obj my-obj]
>   (print ~(:key dict) ~@args))
>
> (macroexpand '(my-macro {:blah "thingy"} "test string"))  
>
>
> If it can be done, how. If not, please let me know your thoughts on how to 
> best accomplish what I need. 
>

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


Trouble with advanced macros

2019-03-28 Thread Nathan Rogers
(def dict   
  {:key `(str "obj isn't defined in this scope" (:blah ~'obj))}) 
 
(defmacro my-macro [obj & args]   
  `(print ~(:key dict) ~@args)) 


(macroexpand '(my-macro {:blah "thingy"} "test string"))  



I have a need to inline arbitrary code, but that code needs to know about 
some things in the context of the macro. In the minimal example, you can 
see that I need to get the key :blah from some symbol obj, in this context 
one :key might be one set of code, another :key in a list of dicts might 
have a completely different bit of code. I want to avoid using functions 
here, because despite the simple appearance, calling functions will bee 
horrible and messy. Is there any way to accomplish this? 

The above example appears to give me what I need, but obj isn't in scope. 
I've tried something like the following, but it still isn't correct

(def dict   
  {:key `(str "obj isn't defined in this scope" (:blah ~'obj))})  

(defmacro my-macro [my-obj & args]   
  `(let [obj my-obj]
  (print ~(:key dict) ~@args))

(macroexpand '(my-macro {:blah "thingy"} "test string"))  


If it can be done, how. If not, please let me know your thoughts on how to 
best accomplish what I need. 

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


Re: [Q] Deploying two artefacts/jars with same group/artefactid via Leiningen

2019-03-28 Thread Francis Avila






I haven't used lein-package but I am surprised it doesn't handle this case. 
This issue I think describes a similar use case, perhaps it helps you? 
https://github.com/pliant/lein-package/issues/9

`lein deploy` has a long form which accepts arbitrary filenames:

$ lein help deploy
Deploy jar and pom to remote repository.

The target repository will be looked up in :repositories in project.clj:

  :repositories [["snapshots" "https://internal.repo/snapshots";]
 ["releases" "https://internal.repo/releases";]
 ["alternate" "https://other.server/repo";]]

If you don't provide a repository name to deploy to, either "snapshots" or
"releases" will be used depending on your project's current version. You may
provide a repository URL instead of a name.

See `lein help deploying` under "Authentication" for instructions on
how to configure your credentials so you are not prompted on each
deploy.

You can also deploy arbitrary artifacts from disk:

$ lein deploy myrepo com.blueant/fancypants 1.0.1 fancypants.jar pom.xml

While this works with any arbitrary files on disk, downstream projects will 
not
be able to depend on jars that are deployed without a pom.

Arguments: ([] [repository] [repository identifier version & files])

So as an extra step after a normal deploy you can do:

lein deploy myrepo com.blueant/fancypants 1.0.1 fancypants-1.0.1-app.jar

This would add this jar as-is to the correct directory in myrepo.


On Thursday, March 28, 2019 at 1:05:39 PM UTC-5, henrik42 wrote:
>
> Hi,
>
> I have an uberjar that I want to deploy to clojars. Part of
> building the uberjar is building the "standard" lib-jar of the
> same project.
>
> Now I'd like to release/deploy both with the same group/artefactid to
> clojars. The uberjar should get the :classifier "app".
>
> So after that people could lein depend on the lib-jar and can download
> the "app" via browser/wget/etc.
>
> I've tried different things (e.g. lein-package) with no luck.
>
> The problem is that deploying them "one at a time" re-deploys pom.xml and 
> that fails. 
> So deployen two jars must be aware of this and deploy pom.xml only once.
>
> Any idea?
>
> -- Henrik
>
>

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


Re: [Q] Deploying two artefacts/jars with same group/artefactid via Leiningen

2019-03-28 Thread Thomas Heller
I'm doing this in shadow-cljs deploying a normal jar and one with aot. I'm 
not exactly sure how you'd do that for an uberjar though.

https://github.com/thheller/shadow-cljs/blob/master/project.clj#L96-L103

On Thursday, March 28, 2019 at 7:05:39 PM UTC+1, henrik42 wrote:
>
> Hi,
>
> I have an uberjar that I want to deploy to clojars. Part of
> building the uberjar is building the "standard" lib-jar of the
> same project.
>
> Now I'd like to release/deploy both with the same group/artefactid to
> clojars. The uberjar should get the :classifier "app".
>
> So after that people could lein depend on the lib-jar and can download
> the "app" via browser/wget/etc.
>
> I've tried different things (e.g. lein-package) with no luck.
>
> The problem is that deploying them "one at a time" re-deploys pom.xml and 
> that fails. 
> So deployen two jars must be aware of this and deploy pom.xml only once.
>
> Any idea?
>
> -- Henrik
>
>

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


[Q] Deploying two artefacts/jars with same group/artefactid via Leiningen

2019-03-28 Thread henrik42
Hi,

I have an uberjar that I want to deploy to clojars. Part of
building the uberjar is building the "standard" lib-jar of the
same project.

Now I'd like to release/deploy both with the same group/artefactid to
clojars. The uberjar should get the :classifier "app".

So after that people could lein depend on the lib-jar and can download
the "app" via browser/wget/etc.

I've tried different things (e.g. lein-package) with no luck.

The problem is that deploying them "one at a time" re-deploys pom.xml and 
that fails. 
So deployen two jars must be aware of this and deploy pom.xml only once.

Any idea?

-- Henrik

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


pprint

2019-03-28 Thread Alex Miller
jira/patch welcome...

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