Created
June 16, 2022 08:07
-
-
Save hamzakc/f2dba58a130c3fb61a07900c8572fb77 to your computer and use it in GitHub Desktop.
Seven More Languages in Seven Weeks Exercises - Lua => Fennel
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
;; Exercies 1 | |
;; Write a function called ends_in_3(num) that returns true if the final digit of num is 3, and false otherwise. | |
(fn ends_in_3 [num] | |
(let [num-str (.. "" num)] | |
(let [tbl (icollect [s (string.gmatch num-str "%d")] s)] | |
(if (= "3" (. tbl (length tbl))) | |
true | |
false)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment