Skip to content

Commit

Permalink
Lemonade 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
foretspaisibles committed Jun 16, 2016
2 parents a8fdb84 + 1e60397 commit 79cf24d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt

PACKAGE= lemonade
VERSION= 0.5.0
VERSION= 0.6.0
OFFICER= [email protected]

.sinclude "Makefile.config"
Expand Down
2 changes: 1 addition & 1 deletion opam/opam
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
opam-version: "1.2"
maintainer: "[email protected]"
authors: "Michael Grünewald"
version: "0.5.0"
version: "0.6.0"
license: "CeCILL-B"
homepage: "https://github.com/michipili/lemonade"
bug-reports: "https://github.com/michipili/lemonade/issues"
Expand Down
16 changes: 11 additions & 5 deletions src/lemonade_List.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ module MethodsMonad = Mixture_Monad.Make(Basis)
include Basis
include MethodsMonad

let pp_print f pp m =

let pp_print f ff lst =
let open Format in
let sep = ref "" in
fprintf pp "[";
List.iter (fun x -> fprintf pp "%s%a" (!sep) f x; sep := "; ") m;
fprintf pp "]"
let flag = ref false in
let loop item =
if !flag then fprintf ff ";@ ";
flag := true;
fprintf ff "%a" f item
in
fprintf ff "@[<hov 1>[";
List.iter loop lst;
fprintf ff "]@]"


module T(M:Mixture_Monad.S) =
Expand Down
2 changes: 1 addition & 1 deletion src/lemonade_Stream.ml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ struct
let not_p x =
not(p x)
in
from (fun _ -> junk_while not_p m >>= fun () -> peek m)
from (fun _ -> junk_while not_p m >>= fun () -> get m)

let filter_map f m =
let rec next serial =
Expand Down
20 changes: 20 additions & 0 deletions testsuite/testStream.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,24 @@ let () =
SStream.fold ( + ) stream 0)
()
(Success.Success (2 + 4 + 6 + 8));

assert_success_int "of_list"
(fun () ->
SStream.fold
( + )
(SStream.of_list [1; 2; 3; 4; 5])
0)
()
(Success.Success 15);


assert_success_int "filter"
(fun () ->
SStream.fold
( + )
(SStream.filter (fun x -> x mod 2 = 1)
(SStream.of_list [1; 2; 3; 4; 5]))
0)
()
(Success.Success 9);
]

0 comments on commit 79cf24d

Please sign in to comment.