Re: Private multimethods possible?

2017-01-10 Thread Meikel Brandmeyer (kotarak)
Am Dienstag, 10. Januar 2017 01:19:16 UTC+1 schrieb Didier: > > How would you declare a namespace within a namespace? Or two namespaces in > the same file? > > You can do so quite easily. (ns foo.bar) (defmulti a :dispatch) (defn b [x] (str "Called a. This was the result: " (a x

Simple clojure example improvements sought

2017-01-10 Thread hiskennyness
Whenever I code something like this I get the feeling a clojure guru could do it more simply, and I love learning new tricks. Here is my simple (real-world, btw) problem and solution. Is there a better way? ;; Problem: given optimized* json maps (* to avoid duplicating keys): (def optij {:name

Re: Simple clojure example improvements sought

2017-01-10 Thread Francis Avila
On Tuesday, January 10, 2017 at 9:27:24 AM UTC-6, hiskennyness wrote: > > Whenever I code something like this I get the feeling a clojure guru could > do it more simply, and I love learning new tricks. > > Here is my simple (real-world, btw) problem and solution. Is there a > better way? > > ;;

Re: Simple clojure example improvements sought

2017-01-10 Thread Beau Fabry
With specter: (map-indexed (fn [i name] (sp/transform sp/MAP-VALS #(nth % i) optij)) (:name optij)) => ({:name :tom, :age 1, :tone :do} {:name :dick, :age 2, :tone :re} {:name :harry, :age 3, :tone :mi}) Without: (map-indexed (fn [i name] (into {} (map (fn [[k v]] [k (nth v i)]) optij))) (:na

Re: Simple clojure example improvements sought

2017-01-10 Thread Beau Fabry
sorry that last nth should've been (nth % i nil) On Tuesday, January 10, 2017 at 11:37:22 AM UTC-8, Beau Fabry wrote: > > With specter: > > (map-indexed (fn [i name] (sp/transform sp/MAP-VALS #(nth % i) optij)) > (:name optij)) > => ({:name :tom, :age 1, :tone :do} {:name :dick, :age 2, :tone :re

[ANN] Ring 1.5.1 released to fix path traversal vulnerability

2017-01-10 Thread James Reeves
There is a path traversal vulnerability in Ring that affects applications that serve resources from the filesystem. It does not affect Ring sites deployed as uberjars. Versions affected: Every version prior to 1.5.1; 1.6.0-beta1 to 1.6.0-beta6 Fixed versions: 1.5.1, 1.6.0-beta7 Link: https://git

Re: Simple clojure example improvements sought

2017-01-10 Thread hiskennyness
On Tuesday, January 10, 2017 at 1:59:05 PM UTC-5, Francis Avila wrote: > > > > On Tuesday, January 10, 2017 at 9:27:24 AM UTC-6, hiskennyness wrote: >> >> Whenever I code something like this I get the feeling a clojure guru >> could do it more simply, and I love learning new tricks. >> >> Here i

Re: Simple clojure example improvements sought

2017-01-10 Thread hiskennyness
On Tuesday, January 10, 2017 at 2:37:22 PM UTC-5, Beau Fabry wrote: > > With specter: > > (map-indexed (fn [i name] (sp/transform sp/MAP-VALS #(nth % i) optij)) > (:name optij)) > => ({:name :tom, :age 1, :tone :do} {:name :dick, :age 2, :tone :re} > {:name :harry, :age 3, :tone :mi}) > One li

Re: Simple clojure example improvements sought

2017-01-10 Thread Beau Fabry
Haha, the one line was more an artifact of me entering it that way than a recommendation, if I was committing to master it would probably look like (map-indexed (fn [person-num _person_name] (->> optij (map (fn [[attribute-name attribute-vals]] {attribute-name (nth attribute-vals p

Re: [ANN] Ultra v0.5.1 - a Leiningen plugin for a superior development environment

2017-01-10 Thread Mars0i
Very nice. Thank you. One question because my ignorance about how to configure plugins in general--I hope you don't mind. Where would I put this: {:ultra {:repl {:width 180 :map-delimiter "" :extend-notation true :print-meta true

Re: [ANN] Ultra v0.5.1 - a Leiningen plugin for a superior development environment

2017-01-10 Thread Mars0i
One more question--should have included it before. Is there a way to change the print width apart from in profile.clj or project.clj, e.g. with a function in the repl. That way I resize the terminal to see more on each line, I wouldn't have to exit out and change the width. Thanks- -- You r

Re: [ANN] Ultra v0.5.1 - a Leiningen plugin for a superior development environment

2017-01-10 Thread W. David Jarvis
Hey there! To answer your first question, I keep this sort of configuration in my ~/.lein/profiles.clj. That file looks like this right now: {:user {:ultra {:repl true} :plugins [[venantius/ultra "0.5.1"] [lein-pprint "1.1.2"]]}} To answer your second question -- the pr