Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn trim-0
- "Trim away all extra 0 in front of a number represented as a string.
- 00123 -> 123, 00000 -> 0"
- [text]
- (loop [l text]
- (let [x (first l)
- xs (rest l)]
- (cond
- (= x \0) (recur xs)
- (= x nil) "0"
- :else (clojure.string/join l)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement