<tyler___>
Smerdyakov: sorry for the stupid question, of course I'm using the ocaml documentation as well
tauop has joined #ocaml
<Smerdyakov>
tyler__, but this is covered in the language reference, and probably in the tutorial as well....
tyler__ has quit [Read error: 110 (Connection timed out)]
b0nk has joined #ocaml
<b0nk>
hi
tyler___ is now known as maym
<tauop>
hi
<b0nk>
i have a silly question
<b0nk>
suppose i've an interface LSystem with a lsystem type declared inside (in the .ml file) as a record
<b0nk>
i have a func which returns a LSystem.lsystem record
<b0nk>
let blah = func ...
<b0nk>
but when i can't access blah.attribute1 for example
<b0nk>
Unbound record field label seed
<b0nk>
:(
<kinners>
record labels have to be fully qualified
<simon->
func sounds funky.
<kinners>
{Lsystem.a = ""; ... etc}
<b0nk>
hum.. i only want to access one attribute
<b0nk>
not to construct the record itself
<kinners>
blah.Lsystem.attribute1 then
<b0nk>
may i paste the LSystem.lsystem type ?
<b0nk>
it's only 5-6 lines long
<Smerdyakov>
No.
<Smerdyakov>
We all already know what we need to know.
<b0nk>
lol
<Smerdyakov>
Explain concisely why what kinners has said doesn't help you if you think it doesn't.
<tauop>
hummmm
<b0nk>
LSystem is the "module" name, lsystem (so LSystem.lsystem) is a record type defined in the Lsystem module. I have a function which returns a LSystem.lsystem record : let thevar = the_func_that_returns_a_lsystem_record() ... I tried thevar.attribute to access one of the attribute of the lsystem record but the compiler doesn't resolve it
<Riastradh>
b0nk, and as kinners said, you need to fully qualify attribute names, i.e. you need to write thevar.LSystem.attribute, not just thevar.attribute.
<b0nk>
ok
<b0nk>
i forgot to explicit every record name in the .mli
<Smerdyakov>
This is the second time today that b0nk has explicitly ignored the exact answer to his question from kinners!
<b0nk>
that's true
<b0nk>
but kinners should have added : "in the .mli" ;P
<b0nk>
just kidding
<b0nk>
thanks again
Axioplase has quit [Remote closed the connection]
maym has left #ocaml []
CiscoKid has joined #ocaml
tauop has quit ["Leaving"]
kinners has quit ["leaving"]
tyl3r has quit [Read error: 54 (Connection reset by peer)]
tyler has joined #ocaml
KrispyKringle has joined #ocaml
<KrispyKringle>
hiya folks. q
<KrispyKringle>
quick question; how would i get the pid of the running process? possible?
<KrispyKringle>
of the program, that is.
<CiscoKid>
Unix.getpid
<KrispyKringle>
sweet, thanks.
<CiscoKid>
yep
<KrispyKringle>
ah, whoops. found it on the website now. :P
<KrispyKringle>
so real basic question (i used to use ocaml and havent for a long time--don't know if i ever knew this or not). Anywho, if I have some function foo that returns a string, and i want to print it (using print_string, no?) then I would want to do print_string foo. But it might complain that This expression has type unit -> string but is here used with type string. How would I resolve that?
<KrispyKringle>
thanks.
<CiscoKid>
What's the code look like around it?
<CiscoKid>
BTW, printf works pretty well. :)
<KrispyKringle>
printf?
<CiscoKid>
Printf.printf "My string: %s\n" somestring
<KrispyKringle>
hmm...cool :P
<KrispyKringle>
could i put a function in for somestring?
<CiscoKid>
Yeah, it's just a function call, but is sort of generated dynamically. It's still statically typed, so %d would cause the compile to fail.
<KrispyKringle>
right
<KrispyKringle>
intresting.
<Riastradh>
The magic is in the type of the first argument. It's not technically a string.
<KrispyKringle>
which, the argument in quotes>
<KrispyKringle>
?
<KrispyKringle>
ah, i know what im donig wrong. im passing the function instead of what it returns. so if i have a function that returns some string, say, if i do `let foo = myfunc', it assigns foo to the function rather than the value. whoops :P
<KrispyKringle>
how do i do it properly?
<KrispyKringle>
(and that's why OCaml is capable of Higher Order Functions, is it not?)
<CiscoKid>
You invoke the function and pass in the return.
<CiscoKid>
What are the parameters to the function?
<KrispyKringle>
none.
<CiscoKid>
All functions take one parameter and return one argumetn.
<CiscoKid>
er, return one value
<KrispyKringle>
ah, so if it takes a unit?
<CiscoKid>
unit is ()
<KrispyKringle>
oh, you go ()
<KrispyKringle>
oops
<CiscoKid>
You have to pass that in.
<KrispyKringle>
thats right
<KrispyKringle>
haha, yeah, i got it.
<KrispyKringle>
im always bad with syntax.
<KrispyKringle>
thanks for the help.
<KrispyKringle>
hey, so ocaml supports nested scopes, right?
<CiscoKid>
OCaml's not too bad with syntax, although a lot of mine starts looking like scheme after a while.
<CiscoKid>
What do you mean by nested scopes?
<CiscoKid>
A binding is valid within the let that declared it.
<KrispyKringle>
right, but one can do a let inside of a let, and redefine a variable defined outside the let?
<KrispyKringle>
well, or define a new one?
<KrispyKringle>
i think you can...
<CiscoKid>
Hmm...I'm not sure. I don't think I'd want to do that. :)
<sundeep>
Snark: i have no idea on how i should resolve the error
<Snark>
you gave a Gsl_matrix.matrix where a [< `A of float array * int * int | `AA of float array array | `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix ] was supposed to go ;-)
<sundeep>
i can't understand what `MF of Gsl_matrix_flat.matrix actually means
<Snark>
I can't help you much more than that, but messages like "This expression has type foo but is used here with type bar"
<smkl>
so you have expr in that place you have an error and you need `M expr
<Snark>
well, you have an object whose type was inferred to be that...
<Snark>
ooh, that's an idea
<sundeep>
so, if they indeed are different types how do i convert one to the other
<Snark>
writing (`MF expr) instead of expr ?
<smkl>
sundeep: what i said, and to other dir: match expr with `M v -> v
<sundeep>
smkl, Snark: i am not sure if i understood what you mean...
monotonom has quit ["Don't talk to those who talk to themselves."]
vezenchio has joined #ocaml
Submarine has left #ocaml []
shammah has joined #ocaml
bk_ has joined #ocaml
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
bk_ has joined #ocaml
monotonom has joined #ocaml
b0nk has quit ["[BX] Get your free warez from ftp://127.0.0.1!"]
skylan_ is now known as skylan
<carm>
val open_out_gen : open_flag list -> int -> string -> out_channel. The int value here is the permission of the file if it needs to be created. However the usually three digit representation seems incorrect. Like "755