Ordered words: Difference between revisions

Content deleted Content added
Bernie (talk | contribs)
Added FutureBasic solution
Hout (talk | contribs)
→‎Python: As a fold: Simplified `ordered` function.
Line 3,689:
 
from functools import reduce
from operator import le
import urllib.request
 
Line 3,708 ⟶ 3,709:
return (
(lng, ([w] if n != lng else xs + [w])) if (
ordWordordered(w)
) else nxs
) if lng >= n else nxs
 
 
# ordWordordered :: String -> Bool
def ordWordordered(w):
'''True if the word w is ordered.'''
return reduceall(stillRisingmap(le, w[1:], (True, w[01:]))[0]