-
Notifications
You must be signed in to change notification settings - Fork 19
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
f8b6e98
commit 3bb9452
Showing
4 changed files
with
27 additions
and
14 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,25 @@ | ||
""" | ||
This file contains utility functions that are not specific to the | ||
library, but are used throughout. | ||
""" | ||
|
||
@generated function fieldnames_equal(::Type{T1}, ::Type{T2}) where {T1,T2} | ||
# Needs to be a generated function as might not be inlined | ||
return Base.fieldnames(T1) == Base.fieldnames(T2) | ||
end | ||
|
||
const SUPERSCRIPT_MAPPING = ('⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹') | ||
const INTCHARS = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') | ||
|
||
function to_superscript(s::AbstractString) | ||
chars = map(replace(s, "//" => "ᐟ")) do c | ||
if c ∈ INTCHARS | ||
SUPERSCRIPT_MAPPING[parse(Int, c)+1] | ||
elseif c == '-' | ||
'⁻' | ||
else | ||
c | ||
end | ||
end | ||
return join(chars) | ||
end |
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