Bioinformatics/base count: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: bugfix (join_by has been tweaked)) |
m (→Python :: Functional: tidying) |
||
Line 715: | Line 715: | ||
# --------------------------TEST |
# -------------------------- TEST -------------------------- |
||
# main :: IO () |
# main :: IO () |
||
def main(): |
def main(): |
||
Line 735: | Line 735: | ||
# ------------------------ |
# ------------------------ GENERIC ------------------------- |
||
# chunksOf :: Int -> [a] -> [[a]] |
# chunksOf :: Int -> [a] -> [[a]] |
||
Line 754: | Line 754: | ||
of a series of functions. |
of a series of functions. |
||
''' |
''' |
||
def go(f, g): |
|||
def fg(x): |
|||
return f(g(x)) |
|||
return fg |
|||
return reduce(go, fs, lambda x: x) |
|||
Line 770: | Line 771: | ||
# flip :: (a -> b -> c) -> b -> a -> c |
# flip :: (a -> b -> c) -> b -> a -> c |
||
def flip(f): |
def flip(f): |
||
'''The function f with its |
'''The (curried or uncurried) function f with its |
||
arguments reversed. |
arguments reversed. |
||
''' |
''' |