Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
:let bindings inside of cond
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Engelberg  
View profile  
 More options Nov 15 2012, 6:24 pm
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Thu, 15 Nov 2012 15:24:01 -0800
Local: Thurs, Nov 15 2012 6:24 pm
Subject: :let bindings inside of cond

A year-and-a-half ago, Christophe Grand posted on his blog a cond variation
that supports the same :let notation that the for construct does (
http://clj-me.cgrand.net/2011/06/17/a-flatter-cond/).  I have been using
this cond variation ever since he introduced it, and consider it to be the
#1 piece of useful syntactic sugar that Clojure does not currently have in
its core.

I saw today that let-> and some other threading macros are slated for
inclusion in 1.5.  I thought this would be a good opportunity to raise
discussion about this, and formally suggest that Clojure's cond be modified
to allow :let clauses.

I am aware that there are other approaches which similarly prevent
interleavings of cond and let from getting overly indented (specifically,
Evan Gamble has an interesting variation of let that allows guards).
However, I advocate Grand's approach because of its elegant parallelism
with the syntax that already exists within the for construct.  The notation
feels completely natural based on that existing precedent.

I should point out that the final version posted on Grand's site has a
couple additional features, specifically, his cond also supports a
:when-let clause and a final default clause that doesn't require :else.
Although I like these features, I am not advocating that those be added to
the core.  Many people prefer to have the explicit check that their cond
has an even number of components and :when-let might not be intuitively
obvious as to what it does.  So I am specifically recommending just to
include the support for :let clauses in cond and none of the other
features.  This one addition shouldn't really break anyone's code, extends
cond in an intuitive way that is consistent with other Clojure constructs,
and is, in my experience, incredibly useful.

--Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andy Fingerhut  
View profile  
 More options Nov 23 2012, 12:16 am
From: Andy Fingerhut <andy.finger...@gmail.com>
Date: Thu, 22 Nov 2012 21:16:45 -0800
Local: Fri, Nov 23 2012 12:16 am
Subject: Re: :let bindings inside of cond

You could add a patch to CLJ-200 and see if it gets screened.  All patches for tickets that aren't closed go through my prescreening process, but that is only gets it on the big list of prescreened patches, with all of the others.

http://dev.clojure.org/jira/browse/CLJ-200

It would be polite if it the patch lists the name of the author of the code submitted.

Andy

On Nov 15, 2012, at 3:24 PM, Mark Engelberg wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Nov 23 2012, 3:39 am
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Fri, 23 Nov 2012 00:39:50 -0800
Local: Fri, Nov 23 2012 3:39 am
Subject: Re: :let bindings inside of cond

Done.  I want to thank you again for creating this page:
http://dev.clojure.org/display/design/JIRA+workflow

I contribute rarely, so I can never remember the process.  Having these
step-by-step instructions was HUGE.

--Mark

On Thu, Nov 22, 2012 at 9:16 PM, Andy Fingerhut <andy.finger...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andy Fingerhut  
View profile  
 More options Nov 23 2012, 3:48 am
From: Andy Fingerhut <andy.finger...@gmail.com>
Date: Fri, 23 Nov 2012 00:48:23 -0800
Local: Fri, Nov 23 2012 3:48 am
Subject: Re: :let bindings inside of cond

Cool.

And since it is Thanksgiving in the USA, I wanted to thank the real creators of that page: Christopher Redinger and Stuart Halloway.  I've added some and rearranged it, but most of it was there before I ever touched it.

And thanks to Rich Hickey for writing and releasing Clojure into the world, and for all of the other folks who've made it better and built libraries and applications on top of it.

Andy

On Nov 23, 2012, at 12:39 AM, Mark Engelberg wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »