Re: User input validations, design doubt

2017-02-10 Thread Rastko Soskic
Hey, thanks, I like your idea of utilizing closure as poor's man object (or vice versa if you like :) ) to encapsulate particular validators. However, one note is that I was opting for a more dynamism/flexibility like simply associating field with set of arbitrary composed set of validators. B

Re: User input validations, design doubt

2017-02-08 Thread Herwig Hochleitner
Of course, for performance you can optimize that apply+hash-map+interleave (or even your reduce) into reduce+transients, e.g. by using map-vals .​ -- You received this message because you are

Re: User input validations, design doubt

2017-02-08 Thread Herwig Hochleitner
2017-02-08 23:14 GMT+01:00 Rastko Soskic : > (let [fns [(fn ([] :empty) ([x] "x")) (fn ([] :format) ([y] "y"))] val > "field value"] > (reduce #(assoc % (%2) (%2 val)) {} fns)) The advantage in this approach is that you can get the keys from a set of validators, but you still need some outside l