Question on mandatory arguments for -> and ->> macros

Showing 1-9 of 9 messages
Question on mandatory arguments for -> and ->> macros Shantanu Kumar 10/6/12 10:01 AM
Hi,

I am curious about the rationale for the mandatory arguments for ->
and ->> macros.

user=> (doc ->)
-------------------------
clojure.core/->
([x] [x form] [x form & more])

user=> (doc ->>)
-------------------------
clojure.core/->>
([x form] [x form & more])

For -> a form is optional, but for ->> it is not. Can anybody help me
understand why is there a difference?

Shantanu
Re: Question on mandatory arguments for -> and ->> macros Stuart Sierra 10/7/12 4:27 PM
From the look of the source, there's no reason why ->> couldn't have arity-1. I guess it just doesn't come up much.

-S
Re: Question on mandatory arguments for -> and ->> macros Shantanu Kumar 10/7/12 9:27 PM


On Monday, 8 October 2012 04:57:06 UTC+5:30, Stuart Sierra wrote:
From the look of the source, there's no reason why ->> couldn't have arity-1. I guess it just doesn't come up much.

Arity-1 for ->> would be useful to let somebody comment out forms as follows:

(->> foo
  #_(bar baz)
  #_quux)

I can file an issue on JIRA if this makes sense.

Shantanu
Re: Question on mandatory arguments for -> and ->> macros Jason Wolfe 10/8/12 5:37 PM
+1 I've hit this issue before when generating a macroexpansion with ->> in it.  

Also, I think at some point -> and ->> weren't themselves properly namespaced in their own macroexpansions, not sure if it's still an issue but maybe worth checking while you're in there. 



Shantanu
Re: Question on mandatory arguments for -> and ->> macros Shantanu Kumar 10/11/12 10:29 AM
Jason, do you have a snippet to reproduce the error you described?

Shantanu
Re: Question on mandatory arguments for -> and ->> macros Jason Wolfe 10/11/12 6:06 PM
Now that I think about it, I believe the namespace issue was in -?> and -?>> from an old contrib library.  Sorry for the noise.

 

Shantanu
Re: Question on mandatory arguments for -> and ->> macros Laurent PETIT 10/11/12 11:43 PM


2012/10/12 Jason Wolfe <ja...@w01fe.com>


Yeah, and I'm not sure it has been corrected yet, btw ?
 

 

Shantanu

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

Re: Question on mandatory arguments for -> and ->> macros Shantanu Kumar 10/12/12 11:40 AM
I have filed it as `enhancement` here: http://dev.clojure.org/jira/browse/CLJ-1086

Shantanu
Re: Question on mandatory arguments for -> and ->> macros Stuart Sierra 10/12/12 1:57 PM
Thank you, especially thanks for tagging it an enhancement.
-S