Re: Idiomatic program for someone new to Clojure

2020-12-14 Thread Brandon R
Hey James, Another small suggestion is you can just pass println to map, since it takes 1 argument in your case. (map println (sort builds)) But here, since you just want to perform side effects, maybe run! would be a better function to use. (run! println (sort builds)) This would cause it to

Re: Idiomatic program for someone new to Clojure

2020-12-14 Thread Justin Smith
a small suggestion: you don't need to nest let inside let, a clause can use previous clauses: (defn get-latest-build [pipeline] (let [response (fetch-pipeline pipeline) json (parse-string (:body response) true) [pipeline] (:pipelines json)] (:counter pipeline also

Idiomatic program for someone new to Clojure

2020-12-14 Thread James Lorenzen
Hello all, This is my first Clojure program and I was hoping to get some advice on it since I don't know any experienced Clojure devs. I'm using it locally to print the latest build numbers for a list of projects. ``` (ns jlorenzen.core (:gen-class) (:require [clj-http.client :as client])

Re: Idiomatic program for someone new to Clojure

2020-12-14 Thread James Lorenzen
Very cool everyone. This is exactly the kind of feedback I was hoping for. I'm going through Clojure for the Brave and I hadn't made it to the macros chapter yet. That single threading macro is pretty sweet! Thanks everyone! On Monday, December 14, 2020 at 11:00:02 AM UTC-6 brando...@gmail.com

Re: Idiomatic program for someone new to Clojure

2020-12-14 Thread aditya....@gmail.com
I'd try to separate the "I/O or side-effecting" parts from the "purely data processing" parts. This makes the program much easier to test --- the "purer" the code, the better it is. This also helps tease apart domain-agnostic parts from domain-specialised parts, which is useful, because