Skip to content

Instantly share code, notes, and snippets.

@reevik
Created February 14, 2022 16:05
Show Gist options
  • Save reevik/9335339a240c1466dc635b942097afca to your computer and use it in GitHub Desktop.
Save reevik/9335339a240c1466dc635b942097afca to your computer and use it in GitHub Desktop.
;; Multimethod definition showing that the run
;; might have multiple informations. The identity
;; function is used as dispatcher function to
;; determine which implementation of run is to be
;; called
(defmulti run identity)
;; The run method implementation for temp.
(defmethod run "temp"
[city day]
(get-temp city day))
;; Reads humidity.
(defmethod run "humidity"
[city day]
(get-humidity city day))
;; Reads wind.
(defmethod run "windspeed"
[city day]
(get-windspeed city day))
;; you are encouraged to add more functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment