Series: haskell
haskell
5 lines
· Updated 2026-02-03
exercise_7.hs
haskell/Week_6_Lab/exercise_7.hs
-- Define the riffle function
riffle :: [a] -> [a] -> [a]
riffle [] ys = ys -- If the first list is empty, return the second list
riffle xs [] = xs -- If the second list is empty, return the first list
riffle (x:xs) (y:ys) = x : y : riffle xs ys -- Alternate elements from both lists recursively
Related articles
haskell
haskell
Updated 2026-02-03
Adding.hs
Adding.hs — haskell source code from the haskell learning materials (haskell/Adding.hs).
Read article →
haskell
haskell
Updated 2026-02-03
Area.hs
Area.hs — haskell source code from the haskell learning materials (haskell/Area.hs).
Read article →
haskell
haskell
Updated 2026-02-03
Chess.hs
Chess.hs — haskell source code from the haskell learning materials (haskell/Chess.hs).
Read article →
haskell
haskell
Updated 2026-02-03
ChessGraphics.hs
ChessGraphics.hs — haskell source code from the haskell learning materials (haskell/ChessGraphics.hs).
Read article →
haskell
haskell
Updated 2026-02-03
Examples.hs
Examples.hs — haskell source code from the haskell learning materials (haskell/Examples.hs).
Read article →
haskell
haskell
Updated 2026-02-03
Fibonacci.hs
Fibonacci.hs — haskell source code from the haskell learning materials (haskell/Fibonacci.hs).
Read article →