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

162 views
Skip to first unread message

Shantanu Kumar

unread,
Oct 6, 2012, 1:01:03 PM10/6/12
to Clojure
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

Stuart Sierra

unread,
Oct 7, 2012, 7:27:06 PM10/7/12
to clo...@googlegroups.com
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

Shantanu Kumar

unread,
Oct 8, 2012, 12:27:15 AM10/8/12
to clo...@googlegroups.com


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

Jason Wolfe

unread,
Oct 8, 2012, 8:37:06 PM10/8/12
to clo...@googlegroups.com
+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

Shantanu Kumar

unread,
Oct 11, 2012, 1:29:57 PM10/11/12
to clo...@googlegroups.com
Jason, do you have a snippet to reproduce the error you described?

Shantanu

Jason Wolfe

unread,
Oct 11, 2012, 9:06:10 PM10/11/12
to clo...@googlegroups.com
Now that I think about it, I believe the namespace issue was in -?> and -?>> from an old contrib library.  Sorry for the noise.

 

Shantanu

Laurent PETIT

unread,
Oct 12, 2012, 2:42:38 AM10/12/12
to clo...@googlegroups.com


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

Shantanu Kumar

unread,
Oct 12, 2012, 2:40:45 PM10/12/12
to clo...@googlegroups.com
I have filed it as `enhancement` here: http://dev.clojure.org/jira/browse/CLJ-1086

Shantanu

Stuart Sierra

unread,
Oct 12, 2012, 4:57:52 PM10/12/12
to clo...@googlegroups.com
Thank you, especially thanks for tagging it an enhancement.
-S

Reply all
Reply to author
Forward
0 new messages