List comprehension in a few (non-syntax checked) lines. TL;DR: list comprehension = monadic combinators. let return a = [a] let (>>=) x f = List.(flatten (map f x)) let (>>) x y = x >>= fun () -> y let guard b = if b then [()] else [] With these combinators [ f (x,y) | x <- l ; y <-r ; x=y+1 ] then translates to l >>= fun x -> r >>= fun y -> guard (x=y+1) >> return (f x) Less compact, no doubt, but still reasonably practical. On 7 March 2014 23:12, Simon Cruanes wrote: > Le Fri, 07 Mar 2014, Yotam Barnoy a écrit : > > > I have a question about Batteries Included. Specifically, how do I get > the > > syntax extensions working and which syntax extensions are available? The > > various bits of documentation I've found seemed either contradictory or > did > > not mention any syntax extensions at all. I'm specifically interested in > > things like automatic rope generation and list comprehensions. > > Hi! > > The current version of Batteries is 2.2.0 and its documentation is here: > http://ocaml-batteries-team.github.io/batteries-included/hdoc2/ . As far > as I know, there are no more syntax extensions in Batteries since 2.0.0 > (which explains why it doesn't depend on camlp4). I don't know much > about the "rope generation" you talk about, but list comprehensions are > nicely replaced (imho) by the |> operator: > > List.range 1 `To 10 > |> List.filter (< 5) > |> List.map string_of_int > > You can ask more questions on the Batteries mailing list > ( https://lists.forge.ocamlcore.org/cgi-bin/listinfo/batteries-devel ). > Hope you will find it helpful! > > Cheers, > > -- > Simon > > http://weusepgp.info/ > key 49AA62B6 > fingerprint 949F EB87 8F06 59C6 D7D3 7D8D 4AC0 1D08 49AA 62B6 >