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
[ | |
"abogado", | |
"ac", | |
"academy", | |
"accountant", | |
"accountants", | |
"actor", | |
"adult", | |
"ae.org", | |
"agency", |
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
# https://twitter.com/fermatslibrary/status/1385957963429515266 | |
import tables | |
from strutils import toLower | |
const PrimeNumbers = toTable [ | |
('a', 2), | |
('b', 3), | |
('c', 5), | |
('d', 7), |
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
proc Q_rsqrt*(number: float): float = | |
{.emit: """long i; | |
float x2, y; | |
const float threehalfs = 1.5F; | |
x2 = number * 0.5F; | |
y = number; | |
i = * ( long * ) &y; | |
i = 0x5f3759df - ( i >> 1 ); | |
y = * ( float * ) &i; |
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
from macros import toStrLit | |
type myEnum = enum | |
Example = "Hello, world!" | |
macro getName(x: enum): string = | |
x.toStrLit() | |
assert $Example == "Hello, world!" # $ (toString) gets attached string of enum | |
assert Example.getName() == "Example" # getName gets name of enum |