This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-30
Channels
- # arachne (23)
- # bangalore-clj (2)
- # beginners (64)
- # boot (20)
- # cider (3)
- # clara (11)
- # cljs-dev (29)
- # cljsrn (10)
- # clojure (143)
- # clojure-brasil (4)
- # clojure-dev (22)
- # clojure-dusseldorf (3)
- # clojure-italy (26)
- # clojure-sanfrancisco (13)
- # clojure-seattle-old (2)
- # clojure-spec (15)
- # clojure-uk (27)
- # clojured (1)
- # clojurescript (52)
- # core-async (13)
- # cursive (2)
- # datomic (106)
- # fulcro (45)
- # garden (1)
- # graphql (11)
- # hoplon (98)
- # jobs (11)
- # juxt (7)
- # keechma (2)
- # leiningen (36)
- # off-topic (39)
- # parinfer (13)
- # re-frame (34)
- # reagent (5)
- # ring (1)
- # rum (4)
- # shadow-cljs (83)
- # sql (1)
- # timbre (1)
- # unrepl (49)
- # vim (1)
- # yada (42)
->!
😂
I have an API where requests contain JSON/EDN objects. These objects (or maps) must have specific keys with specific data formats. So I use clojure.spec to validate these objects. For the documentation of the project I want to describe the format of these objects. What is good way to describe/specify json objects? Diagrams, Tables, Example Objects, prose .... ?
Well, isn't that exactly what Spec is for?
The target audience are non-clojure programmers who will read about it in a blog post or journal/paper. Its possible that they'll understand what the clj spec means but I think it will be a very uncommon way
Would Swagger work for you? It’s quite common way to document API’s, including the models. There’s a tool that can generate swagger from spec. https://github.com/metosin/spec-tools#swagger2-integration
I'm confusing myself and need a sanity check. This function ap
is identical to apply
, except it only takes 2 args right?
(defn ap [f a] (apply f a))
it's a two arg apply, yes
another option would be (defn ap [f a] (.applyTo f a))
+user=> (defn ap [f a] (.applyTo f a))
#'user/ap
+user=> (ap * (range 1 20))
121645100408832000
@bronsa - oh, good point regarding reflection - is there any other drawback to using applyTo directly?
a desire (perhaps misguided) to skip layers of abstraction when convenient
@noisesmith right but applyTo
is never more convenient than apply
:)
it
- is longer to type
- supports less features (`apply` auto coerces to seq, (apply + [1 2 3])
works but not (.applyTo + [1 2 3])
- doesn’t work higher order
yeah, the not converting to seq is a problem
Does anybody know when/where Rich gave his Spec-ulation talk? Dec 2016 Clojure Conj, perhap?
Working on a transcript, and would like to include at least reasonably close dat.
@andy.fingerhut yeah it was the 2016 conj
@andy.fingerhut Discussion about it here https://github.com/matthiasn/talk-transcripts/issues/28
@seancorfield Yep, saw that. Looks like no one has beat me to the punch yet, and I will open a PR proposing adding my transcript there when I've polished it up a bit more.
I am definitely considering using a commercial transcription service soon, however, if the cost is reasonable. It would save me noticeable time to do editing on a draft version rather than creating that draft version myself.
We can extend the STLC to the Lambda cube along three dimensions: 1. values depending on types 2. types dependingon types 3. types depending on values the canonical example for (1) is the id function: \a:* -> \x:a -> x What are the canonical examples of (2) and (3) ?
No idea if this is at all helpful, but type-level numbers, like https://wiki.haskell.org/Peano_numbers are a decent example of (2) vectors with type-specified length are either (2) or (3), depending on whether you're using something like Peano numbers or C++ templates
@U8RL4BDE0 : this is good, according to another resource, (3) is something like: new-array :: int n -> array of size n because the "type", "array of size n", depends on the "value" n