Last active
November 22, 2024 16:13
-
-
Save axurright/2efb3f4ad9c68af05c13cca8dfc2bbf6 to your computer and use it in GitHub Desktop.
Some more complex functions in Clojure.
This file contains hidden or 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
| ;; 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