Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] camlp4r [ $list:some_list$ ] ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lukasz Dobrek <dobrek@d...>
Subject: [Caml-list] camlp4r [ $list:some_list$ ] ?
Hallo,

Simple question but, it took me already a while and stooped me in the 
middle of something which was suppose to be simple, fast, nice, and easy.

The question is simple:
- Why code placed at the end of this letter does not compile. I use 
following command to compile it:
ocamlc -pp "camlp4r pa_extend.cmo q_MLast.cmo" -I +camlp4 file.ml
I am using ocaml-3.08.1.
While version of this code with Array compiles. It probably has 
something to do with new list constructing semantics in revised syntax
but I really don't get it. Any suggestion are more than welcome.


Here it goes:

(*pp camlp4r *)
open Pcaml;

EXTEND
   GLOBAL: str_item;
   str_item: LEVEL "top"
   [
     [
       "defcat" ; name = ident ;
	"[" ; categories = LIST1 ident SEP "," ; "]" ->
	let string_list_categories =
		List.map ( fun x -> <:expr< $str:x$ >> ) categories in
(*	  <:str_item< value $lid:name$ () =
		Array.iter print_string
		 [| $list:string_list_categories$ |]
           >> *)
	  <:str_item< value $lid:name$ () =
                 List.iter print_string
                  [ $list:string_list_categories$ ]  >>
     ]
   ] ;
   ident:
     [ [ l = LIDENT -> l | l = UIDENT -> l ] ];
END;

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners