![]() |
|
Navigation |
Synopsis Take elements from the front of the list as long as a predicate is true.
Function
list[&T] takeWhile(list[&T] lst, bool (&T a) take)
Usage
import List;
Examples
rascal>import List; ok rascal>bool isEven(int a) = a mod 2 == 0; bool (int): bool isEven(int); rascal>takeWhile([2,4,6,8,1,2,3,4,5],isEven); list[int]: [2,4,6,8] Questions
Question [1].
![]() ![]()
Question [2].
![]() ![]()
Question [3].
![]() ![]() ![]() |