<qknight>
mauke: val listchen : (string * string) list = [("hallo", "asdf")] does not work
<qknight>
Syntax error
<pango>
qknight: it's compiler output, not input
<pango>
qknight: that's what gets displayed if you type your
<pango>
<qknight> let listchen = ["hallo", "asdf"];;
<pango>
btw it's a list is string * string tuples, did you mean a list of strings ?
<qknight>
oh of course
<qknight>
pango: i meant a list of strings
<qknight>
as
<pango>
so use ; instead of ,
<qknight>
["hallo"; "asdf"; [asdf]]
<qknight>
so [0] = hallo; [1] = asdf ...
<qknight>
tnx
Demitar has joined #ocaml
<pango>
qknight: your first example won't work (even after adding quotes, as in ["hallo"; "asdf"; ["asdf"]])
<pango>
qknight: all the elements of a list must have the same type, here some elements are strings while another is a string list
<pango>
qknight: and second, lists don't efficiently allow random access, so [0], [1], etc. are at best a notation. If you want random access, see arrays, or other data types
<qknight>
pango: i know that lists don't allow random access
<qknight>
that was just pseudo-code
<qknight>
thanks anyway
<pango>
fine then
Raziel has quit ["Yo soy goma. Tú eres cola."]
<qknight>
let listchen = ["1: Das weisse Haus"; "2: Pentagon"; "3: Atta"; "4: Muha"];;
<qknight>
let rec listcat l =
<qknight>
match l with
<qknight>
| [e] -> print_string e;
<qknight>
| [] -> invalid_arg "list is empty"
<qknight>
| h :: q -> print_string h; print_string "\n"; let qq = listcat q in print_string "";;
<qknight>
what can i do to remove the >>in print_string ""<<?
<qknight>
i don't need it but somehow i always need the >>in<< word or i get compile errors