google-cloud

Google Cloud Platform: Clojure + {GAE, GCE, anything else on Google Platform}
nickbauman 2017-02-06T15:41:13.000987Z

@qqq non-indexed queries are considered a bug in datastore. No scanning allowed.

nickbauman 2017-02-06T15:41:56.000988Z

And they changed their read costs so projection queries aren’t cheaper. They may be faster though.

nickbauman 2017-02-06T15:42:53.000989Z

(you will find the space allocated to indexes are often ~10x the space of your data itself)

nickbauman 2017-02-06T15:46:03.000990Z

I prefer my DSL in cljgae-template:

(query-<Noun> [:and [:someprop > 5] [::someprop <= 17]])
over
… {{:age #(> % 27)}  {:name “Smith”}}
But reasonable people can disagree.

2017-02-07T21:15:32.000994Z

nickbauman: what's <Noun> mean?

2017-02-07T21:18:07.000997Z

these [...] things are macros?

2017-02-07T21:27:01.000999Z

fwiw, i like the simplicity and transparency of treating maps as AND clauses and sets of maps as OR clauses. ie not

… {{:age #(&gt; % 27)} {:name "Smith"}}
but
… {:age #(&gt; % 27) :name "Smith"}
vs.
... #{{:age #(&gt; % 27)} {:name "Smith"}}

nickbauman 2017-02-07T21:46:12.001002Z

Noun is the entity you declared in the first place

nickbauman 2017-02-07T21:46:47.001004Z

(defentity Dog [:property-a :property-b :property-c])

nickbauman 2017-02-07T21:47:27.001006Z

(query-Dog [:and [:property-a < 4] [:property-b > 5]])

nickbauman 2017-02-07T21:48:06.001008Z

Also:

nickbauman 2017-02-07T21:48:37.001010Z

(query-Dog [:or [:property-a < 4] [:property-b > 5]])

2017-02-07T23:58:07.001012Z

where does "query-Dog" come from?

2017-02-08T00:00:45.001014Z

side-effect of (defentity Dog ...)?

✅ 1
nickbauman 2017-02-09T16:17:22.001017Z

Correct. The defentity macro creates the functions.

nickbauman 2017-02-09T16:18:54.001019Z

You don't have to use those functions, mind you. You can create a symbol and plink that into the query function on your own. At some point I’m going to tease this out so you can use it however you want it. So that you can even do kindless queries if you want.

2017-02-09T19:38:30.001023Z

i wonder if you could make it more clojurish by mimicking defrecord. e.g. #Dog.query[...] and vector-?Dog[...] or some such. see https://clojure.org/reference/datatypes

2017-02-09T19:39:34.001025Z

"query-Dog" seems a little too magical to me, fwiw.

2017-02-09T19:40:28.001027Z

i rather like #Dog.query[...].

nickbauman 2017-02-09T22:45:24.001029Z

Yeah. Pros and cons. The fellas over at SIFT tell me when they have a problem they just write the solution in text in an imaginary language that seems best suited for they problem. Then they implement the language using Lisp. They’ve written hundreds of DSLs. http://www.sift.net/

😉 1
nickbauman 2017-02-10T16:48:56.001032Z

FWIW I value readability over all other things. One of the last things I value is syntax. And then it’s ALWAYS the less syntax the better.

2017-02-12T20:56:20.001034Z

i'm also a fanatic about readability, but i tend to think more in terms of expressivity. expressivity being a property of languages, whereas readability is a property of texts.

2017-02-12T20:59:25.001036Z

to me syntax is absolutely central, because expressivity follows from it. it's more important than vocab, since you can have a great vocab with indecipherable syntax, but not vice-versa.

nickbauman 2017-02-13T16:19:03.001038Z

Readability is almost always the opposite of expressivity.

nickbauman 2017-02-13T16:19:28.001040Z

Ruby is all about expressivity

nickbauman 2017-02-13T16:19:36.001042Z

Python is all about readability

2017-02-13T18:51:06.001044Z

howso? perl is very expressive. it's also very readable, to an expert fluent in the language. of course one can write unreadable texts in any language, no matter how expressive. but that's a writing problem for which the author rather than the language is responsible. that's why i think expressivity is central to language design. the designer has control over that, but no control at all over the readability of things people write.

2017-02-13T18:54:47.001047Z

the expressivity of clojure is one of it's main attractions. ironically, noobs often complain that all the parens make it unreadable.

nickbauman 2017-02-14T05:16:55.001050Z

Expressiveness is often a proxy for terseness. You get this with weird sigils in perl, for example.

nickbauman 2017-02-14T05:20:28.001052Z

The terseness often leads to side-effecty / magic behavior.

nickbauman 2017-02-14T05:20:44.001054Z

Magic behavior, by definition, isn’t readable.

nickbauman 2017-02-14T05:40:51.001057Z

I love this explanation of the balance of syntax and semantics of Lisp: https://news.ycombinator.com/item?id=13008649

nickbauman 2017-02-06T16:58:07.000991Z

Also cljgae-template query DSL returns a lazy sequence on a cursor, which means you can materialize only what you need only when you need it.