Word break problem: Difference between revisions
Content deleted Content added
→{{header|Javascript}}: Disaggregated tokenTrees on model of Python draft |
|||
Line 185:
=={{header|Javascript}}==
Composing a solution from generic functions.
{{Trans|
<lang javascript>(() => {
'use strict';
Line 204:
// tokenTrees :: [String] -> String -> [Tree String]
const tokenTrees = (wds,
const go = s =>
wds.includes(s) ? (
[Node(s, [])]
) : bindList(wds, w => next(s, w));
const next = (s, w)
) :
return
▲ ) : [];
▲ );
};
|