Skip to content

Instantly share code, notes, and snippets.

@axurright
Last active November 22, 2024 16:13
Show Gist options
  • Select an option

  • Save axurright/2efb3f4ad9c68af05c13cca8dfc2bbf6 to your computer and use it in GitHub Desktop.

Select an option

Save axurright/2efb3f4ad9c68af05c13cca8dfc2bbf6 to your computer and use it in GitHub Desktop.
Some more complex functions in Clojure.
;; A function (non-interactable) that will calculate the area of a triangle (plus a message by you)
(defn triangle [message]
(println "Result: ")
(let [b 8 h 7] (/ (* b h) 2)))
(str message))
(triangle "This is fun!")
;; A function (non-interactable) that will calculate miles to kilometers (with the "Miles: x" message sent by you)
(defn converter [message]
(str message)
(let [miles 65] (* miles 1.6))
(converter "Miles: ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment