Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: [Caml-list] using a wiki to answer low level language questions

0 views
Skip to first unread message

Peter Gregory

unread,
Nov 13, 2006, 7:26:15 AM11/13/06
to col...@ccr.jussieu.fr
Francois Colonna wrote:
> Hello,
>
> very often I have great difficulties to understand why I got a
> compilation error in OCaml.
> Instead of polluting this list with low level questions I give the
> erroneous code and the questions
> I have on the wiki page
> http://galileo.lct.jussieu.fr/~frames/WIKI/mediawiki/index.php/OCaml_Difficulty_serialize_list
>
>
> I shall be very grateful if some of you would be interested to go there
> and solve my problem.
>
> François Colonna
>

I don't really think it was too long a problem to post on the mailing
list, and it would probably help others to list the code here anyway:

#let rec serialize_list string_list_a glue_a =
begin
match string_list_a with
[] -> ""
| head::rest -> (glue_with glue_a head (serialize_list rest
glue_a))
end

;;
val serialize_list : string list -> string -> string = <fun>

# serialize_list ["a";"b";"c"] "--";;

- : string = "a--b--c--"


Your problem was simply one of syntax, look at what you wrote:

| head::rest -> glue_with (glue_a head serialize_list( rest glue_a ))

Your function glue_with takes three parameters, not one.

Cheers,
Peter.

> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

0 new messages