code: function takeWhile(pred) {
      return function(xs) {
        var idx = 0;
        while (idx < xs.length && pred (xs[idx])) idx += 1;
        return xs.slice (0, idx);
      };
    }
docs: # takeWhile :: (a -> Boolean) -> Array a -> Array a . . Discards the first element that does not satisfy the predicate, . and all subsequent elements. . . See also [`dropWhile`](#dropWhile). . . ```javascript . > S.takeWhile (S.odd) ([3, 3, 3, 7, 6, 3, 5, 4]) . [3, 3, 3, 7] . . > S.takeWhile (S.even) ([3, 3, 3, 7, 6, 3, 5, 4]) . [] . ```