3 ms·
IMO it's much closer to the ideal way to write the function, which would be something like: fn stringify(item) => item.is_a(String) then item else
by pansa2 2y ago
IMO it's much closer to the ideal way to write the function, which would be something like:
fn stringify(item) =>
item.is_a(String) then item else
item.value.convert(item.conversion).format(item.format_spec)
fn f(template) => template.map(stringify).join()
- pphysch 2y agoBy what definition of "ideal"? You just hid all the complexity in those undefined `convert` and `format` methods.
- pansa2 2y agoThe original code does the same! All the real work is inside `convert` and `format`, it just adds another layer of complexity on top. The ideal version has the same behaviour and shows that the extra complexity is unnecessary.