Fork me on GitHub
#funcool
<
2016-10-20
>
martinklepsch21:10:03

Question about struct

(def identical-to
  {:message "does not match"
   :optional true
   :state true
   :validate (fn [state v ref]
               (let [prev (get state ref)]
                 (= prev v)))})
some validators like the one above can be parameterized. Why are these not functions returning the map containing :message and so on and instead to this, slightly odd, argument passing via grouping in vectors?

niwinz22:10:34

@martinklepsch you can define identical-to like a function that return a validator map if you want

niwinz22:10:42

no one stops you to do so 😄

martinklepsch22:10:00

@niwinz right, I can totally do that, I'm just wondering why it's done in a different way in the library

martinklepsch22:10:33

Like I perceive the validator-args-via-vector thing as more complex than functions but I guess there's a reason for it so I'm curious to understand

niwinz22:10:17

Is just a cosmetic feature, that makes reading the scheme more uniform

niwinz22:10:06

But is just a preference, nothing more

niwinz22:10:13

there are no good rationale for this