Re: Idiomatic program for someone new to Clojure

2020-12-30 Thread Jakub HolĂ˝
I am late to the party but you might find https://blog.jakubholy.net/clojure-common-beginner-mistakes/ useful. It also links to a few very valuable resources. On Thursday, December 17, 2020 at 12:42:41 AM UTC+1 Derek Troy-West wrote: > Hello James, > > Aditya links to one of Stuart Sierra's

Re: Idiomatic program for someone new to Clojure

2020-12-16 Thread Derek Troy-West
Hello James, Aditya links to one of Stuart Sierra's Do's and Don't posts. That series of posts really influenced my basic Clojure style and I'd suggest reading them all: https://stuartsierra.com/tag/dos-and-donts, they're (mostly!) great and simple advice. Best, Derek On Tuesday, December

Re: Idiomatic program for someone new to Clojure

2020-12-15 Thread aditya....@gmail.com
On Wednesday, December 16, 2020 at 3:12:22 AM UTC+5:30 jamesl...@gmail.com wrote: > So I think I can answer my first question. That particular line in > `pipeline-build-count` is doing associative destructing > . > And you

Re: Idiomatic program for someone new to Clojure

2020-12-15 Thread Peter Strömberg
Seconding aditya's advice here. I can truly recommend watching this talk about solving problems the Clojure way: https://youtu.be/vK1DazRK_a0 Interestingly, he applies it on a JavaScript code example. Which makes it all that much more powerful. On Tue, 15 Dec 2020 at 22:42, James Lorenzen

Re: Idiomatic program for someone new to Clojure

2020-12-15 Thread James Lorenzen
So I think I can answer my first question. That particular line in `pipeline-build-count` is doing associative destructing . And you didn't have to do the `as response` but like you said in your comment, you are just doing

Re: Idiomatic program for someone new to Clojure

2020-12-15 Thread James Lorenzen
Thanks for the suggestions aditya. I definitely like where you are headed. I have a few questions. This syntax in `pipeline-build-count` method looks confusing to me: > [{:keys [body] :as response}] ;; destructuring for convenience and function API documentation Would you mind breaking that

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

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