Fork me on GitHub
#off-topic
<
2018-01-30
>
qqq07:01:38

is there a nice way to condense 'dispatch' down to 3 chars? 🙂

qqq15:01:36

found the APL programmer 🙂

qqq09:01:50

as short hand for 'send' ?

fellshard09:01:54

Yes, though sadly also likely for 'second' in some langs...

burke15:01:58

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 .... ?

val_waeselynck15:01:36

Well, isn't that exactly what Spec is for?

burke15:01:42

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

valtteri05:01:35

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

qqq16:01:18

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))

noisesmith16:01:21

it's a two arg apply, yes

noisesmith16:01:08

another option would be (defn ap [f a] (.applyTo f a))

noisesmith16:01:55

+user=> (defn ap [f a] (.applyTo f a))
#'user/ap
+user=> (ap * (range 1 20))
121645100408832000

bronsa16:01:37

but don’t use applyTo :)

bronsa16:01:52

esp as using it in ap like that will slow down things considerably due to reflection

qqq16:01:02

these days, I can't figure out how I ever wrote code without unit tests

qqq16:01:17

there are massive rewrites that I simply would not dare do without a test stuite

noisesmith16:01:54

@bronsa - oh, good point regarding reflection - is there any other drawback to using applyTo directly?

bronsa16:01:13

it’s not HO

bronsa16:01:18

why would you use it over apply?

noisesmith16:01:56

a desire (perhaps misguided) to skip layers of abstraction when convenient

dpsutton16:01:06

higher order?

bronsa17:01:51

@noisesmith right but applyTo is never more convenient than apply :)

bronsa17:01:50

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

noisesmith17:01:53

yeah, the not converting to seq is a problem

andy.fingerhut20:01:46

Does anybody know when/where Rich gave his Spec-ulation talk? Dec 2016 Clojure Conj, perhap?

andy.fingerhut20:01:05

Working on a transcript, and would like to include at least reasonably close dat.

sundarj21:01:57

@andy.fingerhut yeah it was the 2016 conj

andy.fingerhut21:01:04

@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.

andy.fingerhut21:01:16

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.

qqq23:01:59

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) ?

bellis03:01:27

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

qqq07:01:41

@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