S-expressions: Difference between revisions

Content added Content deleted
Line 3,693: Line 3,693:
const quoteTokens = q =>
const quoteTokens = q =>
// Alternating unquoted and quoted segments.
// Alternating unquoted and quoted segments.
s => s.split(q).map(
s => s.split(q).flatMap(
(k, i) => even(i) ? (
(k, i) => even(i) ? (
k
Boolean(k) ? (
) : `${q}${k}${q}`
[k]
) : []
) : [`${q}${k}${q}`]
);
);


Line 3,833: Line 3,835:
// of f to the seed value x, terminating when
// of f to the seed value x, terminating when
// that result returns true for the predicate p.
// that result returns true for the predicate p.
f => x => {
f => {
let v = x;
const go = x =>
p(x) ? (
x
) : go(f(x));


while (!p(v)) {
return go;
v = f(v);
}

return v;
};
};