On 23 August 2017 at 04:27, Timothy Baldridge <[email protected]> wrote:
> But Datomic has E in [e a v] which links multiple [a v] pairs into an
> entity...which is basically a map. So I don't think that applies here.
>
Except that [e a v t] facts in Datomic are ordered and not necessarily
unique, and that's my part of my point. A collection/stream of variants (or
tuples that contain some manner of [k v] part) are map-like but often have
additional properties, such as ordering.
> GET /example HTTP/1.1
> Host: www.example.com
>
> [:request/method :get]
> [:request/uri "/example"]
> [:request/protocol "HTTP/1.1"]
> [:request/header ["host" "www.example.com"]]
>
> Once again, a ad-hoc encoding. What is "GET", what is "/example". I see
> that datastructure and all I see are hashmaps.
>
> Do it the way ring does ;-)
>
> {:method :get
> :uri "..."
> :headers [...]}
>
And what happens if I want to stop processing the request the moment I hit
the request method? For example:
(fn [req]
(go
(match (<! req)
[:request/method :post] (close! req)
[:request/method :get] (onto-chan req example-response))))
Again, the problem with a map is that it is unordered and fixed. Sometimes
it's useful to process a stream of key/value pairs over time.
--
James Reeves
booleanknot.com
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.