Skip to content

Instantly share code, notes, and snippets.

@jeremyheiler
Last active December 18, 2015 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyheiler/5864452 to your computer and use it in GitHub Desktop.
Save jeremyheiler/5864452 to your computer and use it in GitHub Desktop.
Options...
;; Straighforward
(defn handle-helo
[session command]
[(-> session
(reset-session)
(assoc :client-host (:domain command)))
{:code 250 :text (:server-host session)}])
;; State monad style
;; Not sure if command needs to be closed over, though.
(defn handle-helo
[command]
(fn [session]
[{:code 250 :text (:server-host session)}
(-> session (reset-session) (assoc :client-host (:domain command)))]))
;; This only makes sense if handle-reply returns something useful in this context
(defn handle-helo
[handle-reply command]
(fn [session]
(handle-reply {:code 250 :text (:server-host session)})
(-> session (reset-session) (assoc :client-host (:domain command)))))
(defn handle-helo
[session command]
(-> session
(reset-session)
(assoc :client-host (:domain command))
(assoc :reply {:code 250 :text (:server-host session)})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment