repeat takes an
element and produces an infinite list of just that element.
Prelude> take 10 (repeat 10) [10,10,10,10,10,10,10,10,10,10] Prelude> Prelude> take 10 (repeat "Hello") ["Hello","Hello","Hello","Hello","Hello","Hello","Hello","Hello","Hello","Hello"] Prelude> Prelude> take 10 (repeat [2, 3, 5, 7, 11]) [[2,3,5,7,11],[2,3,5,7,11],[2,3,5,7,11],[2,3,5,7,11],[2,3,5,7,11],[2,3,5,7,11],[2,3,5,7,11],[2,3,5,7,11],[2,3,5,7,11],[2,3,5,7,11]]
No comments:
Post a Comment