Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Little Twelve Toes
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Cameron Price
October 27, 2016
Programming
88
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Little Twelve Toes
Extending Elixir to support base-12 numbering
Cameron Price
October 27, 2016
More Decks by Cameron Price
See All by Cameron Price
Make it Fast: The Power of Benchmarking
cameronp
2
46
Other Decks in Programming
See All in Programming
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.6k
APNsからLive Activityを開始する話
yumnumm
0
160
残高管理から台帳サービスへの進化
artoy
1
190
Jetpack Compose Mechanisms
skydoves
2
720
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
180
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
22
22k
パーソナライズPodcastを作った話
repunit11
0
140
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.7k
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
130
phperだってパンチカードでコーディングしたい
o0h
PRO
0
290
プロダクトコードからライブラリの境界を見つける
elmetal
PRO
0
110
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
970
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Prompt Engineering for Job Search
mfonobong
0
500
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
Product Roadmaps are Hard
iamctodd
55
13k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Crafting Experiences
bethany
1
380
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Amusing Abliteration
ianozsvald
1
340
Transcript
Little Twelve-Toes Extending Elixir to Support Base-12 Numbers
Little who?
None
None
None
If only this had been the norm…
Better??
Yes!
10 = 5 * 2
10 = 5 * 2 12 = 3 * 2
* 2
10 = 5 * 2 12 = 3 * 2
* 2 = 3 * 4 = 2 * 6
1,2,3,4,5,6,7,8,9,X,E, 10,11,12,13,14,15,16,17,18,19,1X, 1E,20
But this is kinda… uncomfortable, isn’t it?
Yeah, because the English language is base-10 also…
Solution: a new language for numbers
0..9 : The same 10 : X (pronounced ‘dec’) 11
: E (pronounced ‘el’) 12 : 10 (pronounced ‘do’)
13: 11 (do one) 14 :12 (do two) etc.. 24
: 20 (two do)
10: do 100: gro 1000: mo 10000: do-mo
Now we can say: 32X7 is “three mo two gro
dec do seven”
Now we can say: 32X7 is “three mo two gro
dec do seven” Easy peasy…
What’s this gotta do with Elixir?
Well, I got to wondering, how extensible is Elixir?
Introducing: Dozenex (https://github.com/cameronp/ dozenex)
In an ideal world: Decimal: 15 Hex: 0x0F Dozenal: 0d13
Unfortunately… it doesn’t look like you can add new number
formats
Compromise: Sigils!
def sigil_d(s, []), do: s |> String.split(".") |> _construct def
_construct([w]), do: w |> Dozenex.Integer. construct
iex(2)> ~d(13E) %Dozenex.Integer{digits: [1, 3, 11]} iex(3)>
defimpl String.Chars, for: Dozenex.Integer do def to_string(%Dozenex.Integer{digits: digits}) , do:
digits |> Dozenex.Integer. _convert_to_char_list |> Kernel.to_string end defimpl Inspect, for: Dozenex.Integer do def inspect(di, _opts), do: "~d(#{di})" end
iex(2)> ~d(13E) ~d(13E) iex(3)>
iex(6)> ~d(13E) |> Dozenex.Math.add(~d(22X)) ~d(369)
iex(7)> ~d(13E) |> Dozenex.to_doz_words "one gro three do el"
Ok, what’s missing?
NYI • Infix operators for +, -, *, /, and
..
NYI • Infix operators for +, -, *, /, and
.. • Floating point support
NYI • Infix operators for +, -, *, /, and
.. • Floating point support • Mixed Dozenal / Decimal math
PR’s welcome! (cameronp/ dozenex)
Learn more: • http://dozenal.org/ (The Dozenal Society of America) •
https://en.wikipedia.org/wiki/Duodecimal • https://en.wikipedia.org/wiki/Decimal#Other_bases
Thanks! I am cameronp on github, twitter, medium, gmail, and
the elixir slack team.