https://github.com/benzap/litter
Number Literals Utility Library in clojure(script)
https://github.com/benzap/litter
clojure clojurescript literals utility
Last synced: 3 months ago
JSON representation
Number Literals Utility Library in clojure(script)
- Host: GitHub
- URL: https://github.com/benzap/litter
- Owner: benzap
- License: epl-1.0
- Created: 2018-10-05T00:21:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-05T00:25:11.000Z (over 6 years ago)
- Last Synced: 2025-03-15T03:42:08.347Z (3 months ago)
- Topics: clojure, clojurescript, literals, utility
- Language: Clojure
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: Litter - Number Literal Utility Library in Clojure(script)
#+AUTHOR: Benjamin Zaporzan
#+DATE: 2018-10-04
#+EMAIL: [email protected]
#+LANGUAGE: en
#+OPTIONS: H:2 num:t toc:t \n:nil ::t |:t ^:t f:t tex:t* What is it for?
To express big numbers in an easier to read way. Especially numbers
with repeating zeros. It can be difficult to read 100000000, when
it could be expressed as (lit/num :100M)
* examplesGeneral Number Literals
#+BEGIN_SRC clojure
(require '[litter.core :as lit])(lit/num "100") ;; 100
(lit/num "100,000") ;; 100000
(lit/num "100,000.2345") ;; 100000.2345
(lit/num "100,000,000") ;; 100000000
(lit/num :100M) ;; 100000000
(lit/num :100M2k20m) ;; 100002000.020
(lit/num :100M20M2k) ;; ERROR
(lit/num "100,000,000,00") ;; ERROR
#+END_SRC