Sean,

The case you listed is where let binding becomes important so as to not
perform duplicate evaluation. That is one place the utility of let stands
out along with its scope.

For example

Without let bindings:

  (if (p (some-expression))
    (f (some-expression))
    (g (some-expression))

introduces duplicate evaluation.  I see the utility of let more in such
scenarios.  Whereas in the original PGs example that is not the case, and
debate on that stands.


On Tue, Oct 15, 2013 at 10:02 AM, Sean Corfield <seancorfi...@gmail.com>wrote:

> Yeah, I found when I first got started with Clojure I tended to use
> let for intermediate named results but over time I've moved to using
> small, private top-level functions instead because I want to focus on
> the names of the _functionality_ rather than the names of intermediate
> _data_. I still use let for some things but nowhere near as much as I
> used to.
>
> One construct using let that I see in my code quite a bit that I
> haven't figured out a cleaner way to express:
>
> (let [x (some-expression)]
>   (if (p x)
>     (f x)
>     (g x)))
>
> I get tempted to write a utility function for it but I haven't come up
> with a good name for it :)
>
> Sean
>
> On Tue, Oct 15, 2013 at 9:00 AM, Alex Baranosky
> <alexander.barano...@gmail.com> wrote:
> > I and some of my coworkers do tend to avoid `let` unless in this
> particular
> > case you especially want to emphasize the name of something unobvious.
> OFten
> > I'd prefer to pull out a new function over using let, or inline the
> binding
> > for readability *improvement*.
> >
> >
> > On Tue, Oct 15, 2013 at 8:18 AM, Raoul Duke <rao...@gmail.com> wrote:
> >>
> >> if a programming language doesn't have something like 'where', then i
> >> am sad. http://stackoverflow.com/questions/4362328/haskell-where-vs-let
> >>
> >> --
> >> --
> >> 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/groups/opt_out.
> >
> >
> > --
> > --
> > 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/groups/opt_out.
>
>
>
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> --
> 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/groups/opt_out.
>

-- 
-- 
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/groups/opt_out.

Reply via email to