-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5c14a3
commit 6913ed8
Showing
10 changed files
with
975 additions
and
292 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. | ||
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
(.using | ||
[library | ||
[lux (.except) | ||
[function | ||
[predicate (.only Predicate)]]]]) | ||
|
||
(the with_template (.in_module# .prelude .with_template)) | ||
|
||
... https://en.wikipedia.org/wiki/Numerical_digit | ||
(every .public Digit | ||
(Record | ||
[#character Text | ||
#value Natural])) | ||
|
||
(with_template [,character ,value ,name ,name'] | ||
[(the ,name' | ||
,character) | ||
|
||
(the .public ,name | ||
Digit | ||
[#character ,character | ||
#value ,value])] | ||
|
||
["0" 00 the_00 the_00'] | ||
["1" 01 the_01 the_01'] | ||
|
||
["2" 02 the_02 the_02'] | ||
["3" 03 the_03 the_03'] | ||
["4" 04 the_04 the_04'] | ||
["5" 05 the_05 the_05'] | ||
["6" 06 the_06 the_06'] | ||
["7" 07 the_07 the_07'] | ||
|
||
["8" 08 the_08 the_08'] | ||
["9" 09 the_09 the_09'] | ||
|
||
["A" 10 the_10 the_10'] | ||
["B" 11 the_11 the_11'] | ||
["C" 12 the_12 the_12'] | ||
["D" 13 the_13 the_13'] | ||
["E" 14 the_14 the_14'] | ||
["F" 15 the_15 the_15'] | ||
) | ||
|
||
(the .public (base_02? it) | ||
(Predicate Text) | ||
(`` (when it | ||
(,, (with_template [,digit] | ||
[,digit | ||
true] | ||
|
||
[..the_00'] | ||
[..the_01'] | ||
)) | ||
|
||
else | ||
false))) | ||
|
||
(the .public (base_08? it) | ||
(Predicate Text) | ||
(`` (when it | ||
(,, (with_template [,digit] | ||
[,digit | ||
true] | ||
|
||
[..the_02'] | ||
[..the_03'] | ||
[..the_04'] | ||
[..the_05'] | ||
[..the_06'] | ||
[..the_07'] | ||
)) | ||
|
||
else | ||
(base_02? it)))) | ||
|
||
(the .public (base_10? it) | ||
(Predicate Text) | ||
(`` (when it | ||
(,, (with_template [,digit] | ||
[,digit | ||
true] | ||
|
||
[..the_08'] | ||
[..the_09'] | ||
)) | ||
|
||
else | ||
(base_08? it)))) | ||
|
||
(the .public (base_16? it) | ||
(Predicate Text) | ||
(`` (when it | ||
(,, (with_template [,digit] | ||
[,digit | ||
true] | ||
|
||
[..the_10'] | ||
[..the_11'] | ||
[..the_12'] | ||
[..the_13'] | ||
[..the_14'] | ||
[..the_15'] | ||
)) | ||
|
||
else | ||
(base_10? it)))) |
This file contains 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
Oops, something went wrong.