Fork me on GitHub

Made this little throwaway project. Was wondering if anything could be made better? More concise? Thanks in advance!


a few suggestions: • if you're only getting and updating one level deep, you can replace get-in with get and update-in with update and changing the path to just be the key • update calendar does nothing if the provided date isn't found in the calendar. this should be an error and shouldn't be silently ignored • into accepts a transducer. I'm not sure it's better, but booked-events could be written as:

(defn booked-events
  (into (sorted-map)
         (fn [x]
           (get-in x [1 :booked?])))
• for get-next-x-days, the other variable could probably be better named • create-data would be more clear if named something like init-calendargenerate-string doesn't seem to exist? • generally, I would structure it so that a function like get-input would only ever run one iteration and some calling function would handle the looping. ie. separate the step from the loop. • I think read-calendar-input or something like that would be clearer than get-input • generally, :refer :all should be avoided

👍 1

I might also consider a design where the calendar didn't need to be pre-populated. ie. missing dates were assumed to be unbooked