I know how to write it but I just don't like that name (or any other I've come up with yet). And I'd probably put the `x` as the last argument and provide a curried version.
On Tue, Oct 15, 2013 at 10:13 AM, Marcus Lindner <marcus.goldritter.lind...@gmail.com> wrote: > How looks this? > > (defn conditional [x condition consequent alternative] > (if (condition x) > (consequent x) > (alternative x)))) > > (conditional (some-expression) p f g) > > > > Am 15.10.2013 19:02, schrieb Sean Corfield: > > >> 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. >> >> >> > > -- > -- > 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.