Re: [ANN] com.walmartlabs/cond-let 1.0.0

2018-10-03 Thread Mark Engelberg
This looks like a case of "convergent evolution".

Having the ability to do a :let in the middle of a cond feels like one of
those things that *should* be in the core language, so if it's not in
there, a bunch of people are naturally going to arrive at the same solution
and make it happen in their own utility libraries.  A bunch of us Clojure
programmers from the early 1.0 days had been privately passing around and
using a "cond that supports :let bindings" macro for years.  The first time
I saw the macro was in a blog post by Christophe Grand. I really hoped it
would make it into Clojure proper -- other functional languages like Racket
and F# support ways to bind local variables with "clearer, more linear
code, that doesn't make a march for the right margin", as Howard Lewis Ship
put it.  But after several years had passed without any indication that
CLJ-200 was ever going to be addressed, I eventually made the improved cond
macro into a clojars library.

walmartlabs' cond-let addresses the most important thing (let), which is
the critical piece of functionality that feels like the most natural,
needed addition to the language.  better-cond's :let syntax is identical.
But as us old-school Clojurians passed around the "better cond" macro over
the years, it grew in functionality.  So in better-cond, I included the
other little improvements that had accumulated over time, which I had found
useful.  So better-cond also supports :when, :when-let, and :do (and will
soon have :when-some).  :let is the only piece that I felt really belonged
in the core language's cond, and if CLJ-200 had made it into the core
language, I would have been content to just use Clojure's own cond.  But
once I realized I was going to need a library to achieve the much-needed
:let inside of cond, I figured I might as well use that library to include
the other convenient cond additions as well.  So better-cond is a superset
of cond-let's functionality, with support for :let plus a few bonuses.

Use whichever one strikes your fancy.  cond-let is perfect if all you care
about is adding :let to your cond.  If you want to experiment with some of
the other features beyond :let, you could use better-cond and see what you
think.

Either way, I strongly encourage you to use one of these two libraries so
you can start using :let inside your cond.  I agree fully with Howard Lewis
Ship that it results in clearer code.  Try either library which supports
this -- it will change your life!


On Wed, Oct 3, 2018 at 5:05 PM Matching Socks  wrote:

> Is this a refinement of Mark Engelberg's "better-cond", or an alternative
> approach?
>
> I have not used better-cond myself, but it starts here:
> https://dev.clojure.org/jira/browse/CLJ-200.
>
> --
> 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/d/optout.
>

-- 
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/d/optout.


Re: [ANN] com.walmartlabs/cond-let 1.0.0

2018-10-03 Thread Matching Socks
Is this a refinement of Mark Engelberg's "better-cond", or an alternative 
approach?  

I have not used better-cond myself, but it starts here:  
https://dev.clojure.org/jira/browse/CLJ-200. 

-- 
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/d/optout.


[ANN] com.walmartlabs/cond-let 1.0.0

2018-10-03 Thread Howard Lewis Ship
A micro library of a single macro, cond-let.

cond-let acts like a cond, but adds :let terms that are followed by a
binding form (like let).

This allows conditional code to introduce new local symbols; the result is
clearer, more linear code, that doesn't make a march for the right margin.

Example:

(defn ^:private has-necessary-capabilities?
  "Does the worker have all the capabilities that the job needs?"
  [state worker-id task]
  (cond-let

:let [job-id (:job-id task)]

(nil? job-id)
true

:let [capabilities (get-in state [:jobs job-id
:clockwork/required-capabilities])]

(empty? capabilities)
true

:let [worker-capabilities (get-in state [:workers worker-id
:capabilities])]

(empty? worker-capabilities)
false

:else
;; It's ok for the worker to have *more* capabilities than are
specified.
;; For each required capability, we need an exact match.
(= (select-keys worker-capabilities (keys capabilities))
   capabilities)))

https://github.com/walmartlabs/cond-let

-- 
Howard M. Lewis Ship

Senior Mobile Developer at Walmart Labs

(971) 678-5210
http://howardlewisship.com
@hlship

-- 
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/d/optout.


Clojurists Together Call For Funding Proposals: November 2018 - January 2019

2018-10-03 Thread Daniel Compton
Hi folks

Clojurists Together is soon going to be evaluating proposals for our Q4
funding round of November 2018 - January 2019. If you maintain a
Clojure/Script open source project/service/something else, please consider
applying  for funding.

We recently surveyed
 our
members and error messages, documentation, build tools, IDE support, test
tooling, and linters were things people wanted to see supported. Tools and
documentation targeting beginners to Clojure or to programming, in general,
were mentioned by quite a few people. Projects people specifically named
were: Shadow CLJS, Figwheel, CIDER, Rum, Datascript, Reagent, Protorepl,
Neanderthal, LightTable, Leiningen, Fulcro, Expound, and Eastwood.

If you work on a project named as a focus or a specific project, then we
would really love to have you apply.

Previous projects we have funded include Figwheel, clj-http, CIDER,
ClojureScript, and the two current projects we are funding: cljdoc and
Shadow CLJS. Two successful projects will each be funded $1,800 USD/mo for
three months ($5,400 total).

Application details are at
https://www.clojuriststogether.org/open-source/. *Applications
close on October 9th* (midnight end of day Pacific Time). If you have any
questions or would like help with your project proposal, please contact me
and I'll be happy to help.

If you work for a company that depends on Clojure staying viable, *please*
encourage your management to sign up for a company membership
. We have had a lot of
support from individual developer members (around 150), but only 18 company
members. If you're in management and Clojurists Together isn't pushing your
buttons, let me know what kinds of things would make a membership more
valuable for you.

Lastly, thanks to all of our company and developer members
. Without your support, none
of this could have happened.

Thanks, Daniel and the rest of the team
.

-- 
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/d/optout.