Word break problem: Difference between revisions
Content deleted Content added
→{{header|Javascript}}: Disaggregated tokenTrees on model of Python draft |
m →{{header|Javascript}}: (Minor simplification by currying) |
||
Line 210: | Line 210: | ||
wds.includes(s) ? ( |
wds.includes(s) ? ( |
||
[Node(s, [])] |
[Node(s, [])] |
||
) : bindList(wds, |
) : bindList(wds, next(s)); |
||
const next = |
const next = s => w => |
||
s.startsWith(w) ? ( |
s.startsWith(w) ? ( |
||
parse(w, go(s.slice(w.length))) |
parse(w, go(s.slice(w.length))) |