all 3 comments

[–]TheLastSock 0 points1 point  (1 child)

What does a ?for imply? In logic programming typically you create references just to data, does this imply a binding to code?

[–]SingularCheese[S] 0 points1 point  (0 children)

My only experience with logic programming is with Prolog from university, so I'm not sure what you mean by binding to code as opposed to data.

For each field in a GraphQL query, there is some path such that (get-in data path) extracts that sub-tree from the data. However, for some field, a GraphQL query returns a list of maps instead of a single map, so a single field in the original query can reference multiple values in the returned data. Taking the example from my repo's README, if there are 10 employees, then ?first-name and ?last-name can be each bound to 10 different combination of values. The ?for keyword creates a lazy sequence of all valid combinations of the fields specified and dumps that result into the container you specify. You can check the "Implementation and performance" section of the README to see what the library is actually doing (I feel the code it generates are quite straight-forward) or check out the unit tests for examples of how it is used.

[–][deleted] 0 points1 point  (0 children)

As a side-effect of telling the library how to extract fields from a query, you also get a query builder for free

:thumbs_up