Last active
December 18, 2015 23:49
-
-
Save jeremyheiler/5864452 to your computer and use it in GitHub Desktop.
Options...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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