Bioinformatics/base count: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: bugfix (join_by has been tweaked))
Line 715: Line 715:




# --------------------------TEST---------------------------
# -------------------------- TEST --------------------------
# main :: IO ()
# main :: IO ()
def main():
def main():
Line 735: Line 735:




# -------------------------GENERIC-------------------------
# ------------------------ GENERIC -------------------------


# chunksOf :: Int -> [a] -> [[a]]
# chunksOf :: Int -> [a] -> [[a]]
Line 754: Line 754:
of a series of functions.
of a series of functions.
'''
'''
return lambda x: reduce(
def go(f, g):
lambda a, f: f(a),
def fg(x):
fs[::-1], 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.
'''
'''