Skip to content

Commit

Permalink
Merge pull request #3 from pveber/drop_fix3
Browse files Browse the repository at this point in the history
bugfix of `drop` (also fixes `skip`)
  • Loading branch information
agarwal committed Jun 18, 2014
2 parents 00432e0 + 7f5e94f commit 725de3c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ CFStream Release Notes

cfstream-1.1.2 2014-06-16
-------------------------
* bugfix on `drop` and `skip`
* Reduced deps to core_kernel instead of core.

cfstream-1.1.1 2014-03-02
Expand Down
3 changes: 2 additions & 1 deletion src/lib/CFStream_stream.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ let rec drop_whilei xs ~f =
let drop_while xs ~f = drop_whilei xs ~f:(const f)

let drop xs ~n =
drop_whilei xs ~f:(fun j _ -> j < n)
let i = ref n in
drop_whilei xs ~f:(fun _ _ -> if !i > 0 then (decr i ; true) else false)

let skip_whilei xs ~f =
drop_whilei xs ~f ;
Expand Down

0 comments on commit 725de3c

Please sign in to comment.