Public
Edited
Oct 29, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
parse_trigger = map(
parse_seq(
parse_identifier,
parse_whitespace,
parse_char(["@"]),
parse_whitespace,
parse_one_or_many(map(parse_seq(parse_spec, parse_whitespace), (t) => t[0]))
),
([id, _, __, ___, specs]) => [id, ...specs]
)
Insert cell
parse_trigger("bass @ [{3,4},7] {16,8} ")
Insert cell
function unnest(ast) {
let parallelizations = [];
// ...
}
Insert cell
Insert cell
Insert cell
parse_identifier = parse_regex(/^([_a-z][_0-9a-z]*)/i)
Insert cell
function map(parser, fn) {
return (input) => {
let res = parser(input);
if (res) {
return [fn(res[0]), res[1]];
}
};
}
Insert cell
function parse_regex(r) {
return (input) => {
let m = input.match(r);
if (m) {
return [m[1], input.slice(m[0].length)];
}
};
}
Insert cell
parse_int = map(parse_regex(/^([0-9]+)/i), (str) => parseInt(str, 10))
Insert cell
parse_int("123 bla")
Insert cell
Insert cell
Insert cell
parse_seq(parse_identifier, parse_whitespace)("kelley bla bla")
Insert cell
Insert cell
parse_whitespace(" bla")
Insert cell
[
parse_identifier("kelley bla bla"),
parse_identifier("235"),
parse_identifier(" _bla bla"),
parse_identifier("_bla bla")
]
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more