Abbreviations, automatic: Difference between revisions

Content deleted Content added
Hout (talk | contribs)
→‎{{header|Python}}: Added a variant (functional composition)
Hout (talk | contribs)
→‎Python Functional: (some tidying of main function)
Line 1,587:
return next(
len(a[0]) for a in map(
lambda x: compose(nub)(map_map(lambda y: ''.join(y), xconcat)),
transpose(map(inits, xs))
) if n == len(a)
Line 1,608:
def compose(g):
return lambda f: lambda x: g(f(x))
 
 
# concat :: [String] -> String
def concat(xs):
return ''.join(xs)
 
 
Line 1,620 ⟶ 1,625:
def lines(s):
return s.splitlines()
 
 
# map :: (a -> b) -> [a] -> [b]
def _map(f):
return lambda xs: list(map(f, xs))