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

2018-10-04 Thread lei Shulang
But a Maybe/Nothing will short-circuit the whole flow where cond-let won't? 


On Thursday, 4 October 2018 08:38:05 UTC-7, Moe Aboulkheir wrote:
>
> See https://funcool.github.io/cats/latest/#mlet for something closer to 
> home, in the monadic vein.
>
>
> On Thu, Oct 4, 2018 at 4:10 PM Gary Trakhman  > wrote:
>
>> These are all just sugar over monadic bind, right?
>>
>> Here's one way to do it in the ocaml alternate universe:
>> https://github.com/janestreet/ppx_let#syntactic-forms-and-actual-rewriting
>>
>> But it can be made to work for async or options or whatever, too.
>>
>> We can put the async helpers in the same bucket: 
>> https://github.com/ztellman/manifold/blob/master/docs/deferred.md#let-flow
>>
>> The general idea is turning function application into something that 
>> looks less nested.
>>
>> On Wed, Oct 3, 2018 at 10:22 PM Mark Engelberg > > wrote:
>>
>>> 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 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
 --- 
 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+u...@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 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 

Re: [ANN] graphql-clj 0.2.0

2017-04-27 Thread Lei
Good question.

Before I answer it directly, please allow me to share some history about
GraphQL.

Back 2016, I felt the pain of maintaining different versions of RESTful api
for both web application and mobile application. I believed GraphQL was the
answer. So I tried to look around, there was no available GraphQL
implementation in Clojure Community.I loved GraphQL so much, so I decided
to implement one in Clojure.

I started with GraphQL parser, it was done very quickly with the help of
Instaparse. In the middle of 2016, the 0.1.0 version of graphq-clj was
released. After the release, a lot of people from the community helped
building this library, especially from Edward in Nebank. Early 2017, myself
and one of my team member JeffI started rewriting the parser and validator.
The purpose of the rewrite was to simplify the implementation and make
validation process more predictable and robust.

Here are few main ideas about graphql-clj:

1. Provides parser and validator for GraphQL schema langurage. User don't
need to learn anything new other than GraphQL schema spec. This is probably
one major difference.
2. Simple API. To start using GraphQL with graphql-clj, only two API
functions(resolver and execution) are needed.

A demo project has been provided showing how to use graphql-clj:
https://github.com/tendant/graphql-clj-starter. It has GraphiQL build-in,
you can try it yourself.

graphql-clj is still evolving, any comments and advices are very welcome.

Lacinia was just open sourced recently, I only read some document about it.

There is also another option named alumbra worth trying as well. It is good
to have options.



On Mon, Apr 24, 2017 at 7:29 PM, Didier <didi...@gmail.com> wrote:

> How does this compare to Lacinia?
>
>
> On Monday, 24 April 2017 11:24:22 UTC-7, Lei wrote:
>>
>> graphql-clj is a Clojure library that provides GraphQL implementation.
>>
>> In this new version 0.2.0,  schema and query validator have been
>> completely rewritten for simplicity and robustness. APIs have simplified in
>> this new version as well.
>>
>> The github repository is: https://github.com/tendant/graphql-clj
>>
>> Any comments and advices are welcome!
>>
>> Cheers,
>> Lei
>>
> --
> 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.


[ANN] graphql-clj 0.2.0

2017-04-24 Thread Lei
graphql-clj is a Clojure library that provides GraphQL implementation.

In this new version 0.2.0,  schema and query validator have been completely 
rewritten for simplicity and robustness. APIs have simplified in this new 
version as well.

The github repository is: https://github.com/tendant/graphql-clj

Any comments and advices are welcome!

Cheers,
Lei

-- 
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: conditional support for spec in libraries

2016-10-23 Thread Lei
graphql-clj library tries to support both Clojure 1.9 and 1.8. 

The way it does: 

Library use Clojure 1.9 as dependency. 

For project uses Clojure 1.8 and depends on graphql-clj, it has a few 
options: 

1. Don't use the namespace with clojure.spec

or

2. Add https://github.com/tonsky/clojure-future-spec as dependency, 
clojure.spec backport will be available. 

Caveat: For some new functions introduced in clojure.core 1.9, simply 
copied those functions to library.

You can find more detail in https://github.com/tendant/graphql-clj/pull/32


On Sunday, October 23, 2016 at 8:49:33 AM UTC-7, Cal Loomis wrote:
>
> The only discussion I’ve seen about providing conditional support for spec 
> in libraries is in the old thread started by Sean Corfield for the JDBC 
> library: 
>
> https://groups.google.com/d/msg/clojure-dev/4VAlKZxiN94/tNQo_4yABAAJ 
>
> Is the technique described there, the recommended best practice? Or should 
> we expect to see a :spec feature expression added to Clojure 1.9+?  Do 
> people have other ways of providing conditional spec support in libraries 
> targeted at multiple clojure versions? 
>
> Any feedback appreciated. 
>
>
>
>

-- 
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] graphql-clj: An Clojure library provides GraphQL implementation

2016-10-15 Thread Lei
Hi All, 

I am pleased to announce the release of graphql-clj, a library that 
provides GraphQL implementation in Clojure.

https://github.com/tendant/graphql-clj

For those who are not familiar with GraphQL. GraphQL is a query language 
for APIs and a runtime for fulfilling those queries with your existing 
data. For more details about GraphQL: http://graphql.org. 

There is also a starter project for you to try graphql-clj and GraphiQL in 
3 minutes. 

https://github.com/tendant/graphql-clj-starter

graphql-clj is a native Clojure implementation of GraphQL specification (
http://facebook.github.io/graphql/).

Things have been implemented so far:

1. A parser using instaparse. It supports both GraphQL schema and query.

2. A schema system represent GraphQL type system.

3. A validator using clojure.spec. (Special thanks to Edward Wible)

4. An execution engine supports GraphQL query and mutation.

5. Introspection query support.

Thanks a lot to Edward Wible for his significant contribution on all parts 
of this library. 

This is library was made possible with contributions of: 

   - Edward Wible
   - Marcin Kulik
   - Feifan Zhou
   - Oleh Palianytsia
   - David Adair
   - Yannick Scherer

This library is under active development. Any feedback is welcome, 
especially github PR and issues. 

Cheers,
Lei

-- 
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] graphql-clj: An Clojure library provides GraphQL implementation

2016-10-15 Thread Lei
Hi All,

I am pleased to announce the release of graphql-clj, a library that
provides GraphQL implementation.

https://github.com/tendant/graphql-clj

For those who are not familiar with GraphQL. GraphQL is a query language
for APIs and a runtime for fulfilling those queries with your existing
data. For more details about GraphQL: http://graphql.org.

There is also a starter project for you to try graphql-clj and GraphiQL in
3 minutes.

https://github.com/tendant/graphql-clj-starter

graphql-clj is a native Clojure implementation of GraphQL specification (
http://facebook.github.io/graphql/).

Things have been implemented so far:

1. A parser using instaparse. It supports both GraphQL schema and query.

2. A schema system represent GraphQL type system.

3. A validator using clojure.spec. (Special thanks to Edward Wible)

4. An execution engine supports GraphQL query and mutation.

5. Introspection query support.

Thanks a lot to Edward Wible for his significant contribution on all parts
of this library.

This is library was made possible with contributions of:

   - Edward Wible
   - Marcin Kulik
   - Feifan Zhou
   - Oleh Palianytsia
   - David Adair
   - Yannick Scherer

This library is under active development. Any feedback is welcome,
especially github PR and issues.

Cheers,
Lei

-- 
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.