Version française
Home     About     Download     Resources     Contact us    
Browse thread
List comprehensions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: List comprehensions

I didn't know OCaml had list comprehensions built-in:

$ ocaml camlp4oof.cma
        Objective Caml version 3.10.0

        Camlp4 Parsing version 3.10.0

# [x + 2*x + x/2 | x <- [1; 2; 3; 4]];;
- : int list = [3; 7; 10; 14]
#

Cool! :-)

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e