This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-24
Channels
- # announcements (1)
- # asami (10)
- # aws (1)
- # babashka (1)
- # beginners (105)
- # cider (13)
- # cljsrn (6)
- # clojure (42)
- # clojure-australia (4)
- # clojure-dev (7)
- # clojure-europe (26)
- # clojure-nl (2)
- # clojure-uk (13)
- # clojurescript (19)
- # code-reviews (3)
- # conjure (18)
- # core-async (4)
- # core-matrix (5)
- # cryogen (3)
- # datomic (27)
- # depstar (21)
- # emacs (2)
- # figwheel-main (9)
- # fulcro (18)
- # helix (7)
- # jobs (3)
- # jobs-discuss (15)
- # juxt (7)
- # kaocha (4)
- # lambdaisland (2)
- # leiningen (11)
- # luminus (1)
- # malli (6)
- # meander (9)
- # minimallist (4)
- # mount (3)
- # off-topic (3)
- # pathom (8)
- # pedestal (28)
- # rdf (13)
- # re-frame (7)
- # reagent (5)
- # shadow-cljs (3)
Made this little throwaway project. Was wondering if anything could be made better? More concise? https://github.com/SantoHerrera/clojureCalendar 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
[calendar]
(into (sorted-map)
(filter
(fn [x]
(get-in x [1 :booked?])))
calendar))
• for get-next-x-days
, the other
variable could probably be better named
• create-data
would be more clear if named something like init-calendar
• generate-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
I might also consider a design where the calendar didn't need to be pre-populated. ie. missing dates were assumed to be unbooked