This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-21
Channels
- # announcements (7)
- # babashka (16)
- # beginners (174)
- # biff (7)
- # calva (20)
- # cider (3)
- # clerk (6)
- # cljsrn (4)
- # clojure (98)
- # clojure-europe (57)
- # clojure-italy (3)
- # clojure-nl (1)
- # clojure-portugal (1)
- # clojure-spec (15)
- # clojure-uk (7)
- # code-reviews (3)
- # cursive (23)
- # data-science (1)
- # datomic (26)
- # dev-tooling (2)
- # emacs (5)
- # figwheel-main (4)
- # fulcro (3)
- # honeysql (20)
- # hyperfiddle (20)
- # malli (8)
- # membrane (31)
- # nextjournal (5)
- # pathom (1)
- # polylith (20)
- # re-frame (14)
- # reitit (8)
- # releases (2)
- # shadow-cljs (50)
- # specter (2)
- # sql (22)
- # xtdb (5)
A noob naming question, that I guess doesn't really have an answer, but I thought I'd try anyways. Consider:
(s/def ::triple (s/cat :e string? :a string? :v string?))
Now I may call this vec a triple:
["e", "a", "v"]
But what should I call the (s/conform ::triple)
version of it?
{:e "e", :a "a", :v "v"}
I am thinking parsed-triple
or conformed-triple
, but I wonder if there's a current idiom. If I have some functions that work on one type vs another, I worry about wonky names.named-triple
or just record
https://clojure.org/guides/spec#_collections mentions Conforms to map with named keys based on the cat tags
. I would add more naming options like tagged-triple
or named-triple
. Python has named tuple
which looks similar
Why should order matter after conforming with the spec?
If you're already using tripple as a name, then name it tagged or named tripple as well instead of tuple IMO
The word tuple
means “finite ordered list”. https://en.wikipedia.org/wiki/Tuple
It can be vague that named
predicate drops the “ordered” characteristic. :-)
From the same article: > Many programming languages offer an alternative to tuples, known as https://en.wikipedia.org/wiki/Record_(computer_science), featuring unordered elements accessed by label.
It is even matching with clojure.core/record 🙂