* [Caml-list] camlp4r [ $list:some_list$ ] ?
@ 2004-10-20 22:07 Lukasz Dobrek
2004-10-20 22:37 ` Olivier Andrieu
0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Dobrek @ 2004-10-20 22:07 UTC (permalink / raw)
To: caml-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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] camlp4r [ $list:some_list$ ] ?
2004-10-20 22:07 [Caml-list] camlp4r [ $list:some_list$ ] ? Lukasz Dobrek
@ 2004-10-20 22:37 ` Olivier Andrieu
2004-10-21 6:46 ` Lukasz Dobrek
0 siblings, 1 reply; 3+ messages in thread
From: Olivier Andrieu @ 2004-10-20 22:37 UTC (permalink / raw)
To: dobrek; +Cc: caml-list
> Lukasz Dobrek [Thu, 21 Oct 2004]:
> 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.
This is a camlp4 FAQ :
http://caml.inria.fr/camlp4/manual/manual010.html#toc36
> The question is simple:
> - Why code placed at the end of this letter does not compile. I use
> following command to compile it:
You can't build lists this way, you have to apply the constructors
yourself :
let build_list expr_list =
List.fold_right
(fun x l -> <:expr< [$x$ :: $l$] >>)
expr_list <:expr< [] >>
--
Olivier
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] camlp4r [ $list:some_list$ ] ?
2004-10-20 22:37 ` Olivier Andrieu
@ 2004-10-21 6:46 ` Lukasz Dobrek
0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Dobrek @ 2004-10-21 6:46 UTC (permalink / raw)
To: caml-list
Olivier Andrieu wrote:
> > Lukasz Dobrek [Thu, 21 Oct 2004]:
> > 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.
>
> This is a camlp4 FAQ :
>
> http://caml.inria.fr/camlp4/manual/manual010.html#toc36
>
Shame on me. I haven't read this one. Anyway thanks a lot.
Regards
Lukasz Dobrek
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-10-21 6:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-20 22:07 [Caml-list] camlp4r [ $list:some_list$ ] ? Lukasz Dobrek
2004-10-20 22:37 ` Olivier Andrieu
2004-10-21 6:46 ` Lukasz Dobrek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox