Sparkline in unicode: Difference between revisions
m
→{{header|Python}}: (Simplified main to single print of assembled string)
m (→{{header|AppleScript}}: Eliminated one map (by functor law) at top level) |
m (→{{header|Python}}: (Simplified main to single print of assembled string)) |
||
Line 1,848:
# main :: IO ()
def main():
compose(compose(unlines)(sparkLine))(readFloats),
[▼
"1
"1.5, 0.5 3.5, 2.5 5.5, 4.5 7.5, 6.5"
Line 1,871 ⟶ 1,872:
def Nothing():
return {'type': 'Maybe', 'Nothing': True}
# compose (<<<) :: (b -> c) -> (a -> b) -> a -> c
def compose(g):
return lambda f: lambda x: g(f(x))
Line 1,908 ⟶ 1,914:
re.split('[\s,]+', s)
))
# unlines :: [String] -> String
def unlines(xs):
return '\n'.join(xs)
|