tav` has quit [Read error: 104 (Connection reset by peer)]
tav`` has joined #ocaml
smkl has quit [Read error: 104 (Connection reset by peer)]
smkl has joined #ocaml
Yurik has joined #ocaml
* gl
is back (gone 08:51:48)
owll has joined #ocaml
lebresne has joined #ocaml
lebresne is now known as slyl
slyl has quit [Client Quit]
owll has quit ["Client Exiting"]
skylan has quit [Read error: 113 (No route to host)]
malc has joined #ocaml
malc has quit ["no reason"]
DemiUni has joined #ocaml
<Dieb>
remp_list : string -> string list ref = <fun> / #let a = ref [""];; => a : string list ref = ref [""] / let essai() = a:=remp_list "new";; => Cette expression est de type string list ref, mais est utilisée avec le type string list.
<Dieb>
why have ui this? since remp_list and aa are both string list ref ?
<DemiUni>
It returns a ref but you assign to a.contents
<DemiUni>
either do (if a is mutable) a <- remp_list "new"
<DemiUni>
or do a := !(remp_list "new")
<Dieb>
DemiUni: so a shouldn't b e a ref, but only a list!?
<DemiUni>
What you're doing is equivalent to: a.contents <- remp_list "new";; thus an assignment of a string list ref to a mutable string list entry in a record.
<DemiUni>
a needs to be a ref (or mutable) if you want to assign to it.
<Dieb>
#let essai() = a <- remp_list "new";; => L'identificateur a n'est pas défini.
<Dieb>
let essai() = a:= !remp_list "new";; not better
<DemiUni>
Hmm... didn't look too closely at what you were doing.. =) What do you want the essai () function to do?
<DemiUni>
Assign a new list to a and return the list (or the ref to the list?)?
<Dieb>
sorry, let essai() = a := !(remp_list "new");; work well
<Dieb>
what i wanted to do, is : remp_list is a procedure which give a string list in output. It is used on another procedure where a have to include such a list in another list, which each element is a type { string; int; list} . The remp_list is design to buil the list which is on the type.
<Dieb>
i don't know if i'm clear enought, sorry :(
<Dieb>
bur this work well now. ok, i beleive i understand: i didn't manage correctly refercences. if a and b is ref int, a:=b doesn't work, but a:=1 or a:=!b work well.
<DemiUni>
Yes it's rather simple when you know how it works actually, there is no magic to it.
<Dieb>
this is the base, but i forgotten this. Thank you for your help
<DemiUni>
A ref is built like this: { mutable contents: whatever type }
<DemiUni>
a := b is equivalent to a.contents <- b
<DemiUni>
!a is equivalent to a.contents
<Dieb>
yes. And (maybe i forgot this also) how can you pass references? for example if a and b ref, how can b be = to a? (not the contents) only "pointers"
skylan has joined #ocaml
<smkl>
== tests for pointer equivalence
<Dieb>
ok, thank's a lot
Yurik has quit ["Client Exiting"]
Yurik has joined #ocaml
Yurik has quit ["Client Exiting"]
Dieb has quit [Read error: 110 (Connection timed out)]
Dieb has joined #ocaml
Yurik has joined #ocaml
Yurik has quit [Remote closed the connection]
DemiUni has quit [Remote closed the connection]
sylvain has joined #ocaml
<sylvain>
helloooooooooo
sylvain has quit [Client Quit]
jao has joined #ocaml
pepe has joined #ocaml
drums has joined #ocaml
smkl has quit [Read error: 104 (Connection reset by peer)]
smklsmkl has joined #ocaml
smklsmkl is now known as smkl
smkl has quit [Read error: 104 (Connection reset by peer)]