Jump to content

List comprehensions: Difference between revisions

→‎{{header|OCaml}}: add camlp4 impl
(Added Java implementation)
(→‎{{header|OCaml}}: add camlp4 impl)
Line 1,520:
 
etc..
 
A standard OCaml distribution also includes a number of camlp4 extensions, including one that provides list comprehensions:
<lang ocaml>
# #camlp4o;;
# #require "camlp4.listcomprehension";;
/home/user//.opam/4.06.1+trunk+flambda/lib/ocaml/camlp4/Camlp4Parsers/Camlp4ListComprehension.cmo: loaded
# [ x * 2 | x <- [1;2;3;4] ];;
- : int list = [2; 4; 6; 8]
# [ x * 2 | x <- [1;2;3;4]; x > 2 ];;
- : int list = [6; 8]</lang>
 
=={{header|Oz}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.