Skip to content

Instantly share code, notes, and snippets.

@hamzakc
Created June 16, 2022 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamzakc/f2dba58a130c3fb61a07900c8572fb77 to your computer and use it in GitHub Desktop.
Save hamzakc/f2dba58a130c3fb61a07900c8572fb77 to your computer and use it in GitHub Desktop.
Seven More Languages in Seven Weeks Exercises - Lua => Fennel
;; 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