Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,17 @@
(function (cFrom, cTo) {
function cRange(cFrom, cTo) {
var iStart = cFrom.charCodeAt(0);
return Array.apply(
null, Array(cTo.charCodeAt(0) - iStart + 1)
).map(function (_, i) {
return String.fromCharCode(iStart + i);
});
}
return cRange(cFrom, cTo);
})('a', 'z');

View file

@ -0,0 +1 @@
["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

View file

@ -0,0 +1,22 @@
(function (lstRanges) {
function cRange(cFrom, cTo) {
var iStart = cFrom.codePointAt(0);
return Array.apply(
null, Array(cTo.codePointAt(0) - iStart + 1)
).map(function (_, i) {
return String.fromCodePoint(iStart + i);
});
}
return lstRanges.map(function (lst) {
return cRange(lst[0], lst[1]);
});
})([
['a', 'z'],
['🐐', '🐟']
]);

View file

@ -0,0 +1,2 @@
[["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"],
["🐐", "🐑", "🐒", "🐓", "🐔", "🐕", "🐖", "🐗", "🐘", "🐙", "🐚", "🐛", "🐜", "🐝", "🐞", "🐟"]]

View file

@ -0,0 +1,4 @@
var letters = []
for (var i = 97; i <= 122; i++) {
letters.push(String.fromCodePoint(i))
}

View file

@ -0,0 +1,55 @@
(() => {
// enumFromTo :: Enum a => a -> a -> [a]
const enumFromTo = (m, n) => {
const [intM, intN] = [m, n].map(fromEnum),
f = typeof m === 'string' ? (
(_, i) => chr(intM + i)
) : (_, i) => intM + i;
return Array.from({
length: Math.floor(intN - intM) + 1
}, f);
};
// GENERIC FUNCTIONS ------------------------------------------------------
// compose :: (b -> c) -> (a -> b) -> (a -> c)
const compose = (f, g) => x => f(g(x));
// chr :: Int -> Char
const chr = x => String.fromCodePoint(x);
// ord :: Char -> Int
const ord = c => c.codePointAt(0);
// fromEnum :: Enum a => a -> Int
const fromEnum = x => {
const type = typeof x;
return type === 'boolean' ? (
x ? 1 : 0
) : type === 'string' ? ord(x) : x;
};
// map :: (a -> b) -> [a] -> [b]
const map = (f, xs) => xs.map(f);
// show :: a -> String
const show = x => JSON.stringify(x);
// uncurry :: Function -> Function
const uncurry = f => args => f.apply(null, args);
// unlines :: [String] -> String
const unlines = xs => xs.join('\n');
// unwords :: [String] -> String
const unwords = xs => xs.join(' ');
// TEST -------------------------------------------------------------------
return unlines(map(compose(unwords, uncurry(enumFromTo)), [
['a', 'z'],
['α', 'ω'],
['א', 'ת'],
['🐐', '🐟']
]));
})();