Skip to content

Instantly share code, notes, and snippets.

@kbridge
Created May 6, 2023 04:42
Show Gist options
  • Save kbridge/7d846648327f086e09e4849702b1592e to your computer and use it in GitHub Desktop.
Save kbridge/7d846648327f086e09e4849702b1592e to your computer and use it in GitHub Desktop.
clojure style exercise
;; style 1
(let [console (System/console)
password-char-array (.readPassword console "Password (hidden): " (to-array ()))
password (String. password-char-array)
quoted (fn [s] (str \' s \'))]
(println (quoted password)))
;; style 2
(-> (System/console)
(.readPassword "Password (hidden): " (to-array ()))
(String.)
(#(str \' % \'))
(println))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment