mattam has quit [Read error: 110 (Connection timed out)]
Iter has joined #ocaml
<wolfman8k>
weee, ocaml is fun =D
mij has quit [Success]
mattam_ is now known as mattam
Hadaka has quit [zelazny.freenode.net irc.freenode.net]
Kugelfang has joined #ocaml
<Kugelfang>
Hello @ all
<Banana>
hello Kugelfang
Naked has joined #ocaml
<Kugelfang>
Banana: have you yet tested the ocaml cvs version
Naked is now known as Hadaka
<Kugelfang>
I'm Gentoo/amd64 developer and we try to get ocaml working on our arch
<Kugelfang>
but all programm that i compile with ocaml just segfault or throw errors like "no memory"
<Banana>
hum...
<Banana>
i bet this is due to C compiler optimisation...
<Kugelfang>
i compiled both with CFLAGS="-O0 "
<Banana>
you should ask mattam as he is the ocaml maintainer for gentoo (ppc at least).
<Kugelfang>
thx
<Kugelfang>
hm, with cvs version, compiling mldonkey gives me a syntax error
<bk_>
some of gentoos dev-ml packages are a little outdated, like ocaml-make
<Kugelfang>
File "tools/zoggy/pa_zog.ml", line 475, characters -72--44:
<Kugelfang>
use of antiquotation syntax deprecated since version 3.05
<Kugelfang>
File "tools/zoggy/pa_zog.ml", line 42, characters 40-41:
<Kugelfang>
This expression has type int but is here used with type Lexing.position
<Kugelfang>
make: *** [pa_zog.cma] Error 2
<wolfman8k>
i'm a newbie, so sorry if this is a stupid question: there is this type, GlTex.texture_id, how can i make a reference of this type?
<Kugelfang>
bk_: i don't even have ocaml-make installed
<bk_>
well i have :>
<Kugelfang>
bk_: is it a requirement ?
<bk_>
no
<Kugelfang>
k
<Banana>
wolfman8k: how doyou create a value of this type ?
<wolfman8k>
Banana: yeah, i think
<Banana>
non that's not what i ask.
<Banana>
what are the related you use to create a value of this type ?
<Banana>
is there a GlTex.texture_id_create() or something ?
<Banana>
or is it just an int ? (or int32 ...)
<wolfman8k>
yes, there is a GlTex.gen_texture()
<wolfman8k>
and it works if i do: let tex = GlTex.gen_texture() in
<wolfman8k>
and then i can call other functions with tex
<Banana>
yes.
<Banana>
so ?
<Banana>
you want a reference on it ?
<wolfman8k>
yes
<Banana>
just let tex = ref(GlTex.gen_texture())) in...
<wolfman8k>
the thing is, i want tex to be a sort of "global variable"
<Banana>
then dont put the in ...
<wolfman8k>
but the problem is that i can't call gen_texture() at the beginning
<wolfman8k>
because that function requires some other functions to be called before it
<Banana>
then call them before.
<Banana>
put your calls in to an init() funtion and then :
<Banana>
let _ = init ()
<wolfman8k>
well, i'd like to be able to have tex initialized with None or something, and then later on in a function use gen_textures() to give it a value
<Banana>
let tex = ...
<Banana>
then you can use options types.
<Banana>
let tex = ref None
<Banana>
and later tex := Some (gen_texture());;
<wolfman8k>
thanks! that seems to work
<Banana>
but be aware that to use a tex you have to use a pattern matching now :
<Banana>
match !tex with Some(t) -> .... | None -> failwith "uninitialized texture";;
_n0cte_ has left #ocaml []
<wolfman8k>
cool, thanks
<Banana>
you should create 2 access functions set__texture and get_texture to do that.
<wolfman8k>
or i could just use the match thing everywhere?
<Banana>
it's against code factorisation principle.
<Banana>
which is a good one.
<wolfman8k>
ok, i understand thanks :)
<Kugelfang>
bye
Kugelfang has left #ocaml []
<wolfman8k>
hm... i'm still having trouble with that match
<wolfman8k>
what is the t supposed to be in Some(t)?
<Snark>
if "Some t" is a "Some integer", then t is of type integer
<wolfman8k>
i get a syntax error if i try: Some(GlTex.texture_id)
<Banana>
texture_id is a type.
<Banana>
you can't do that.
<wolfman8k>
yeah.... i think i need to read over that tutorial a few more times
<Banana>
you have to do Some( v) where v is a value.
<Banana>
(puting global_texture in the scope of set/get only prevents you from accessing it without using set_texture/get_texture, yet keeping it somehow "global").
_fab has quit []
<wolfman8k>
Thanks you!
bzzbzz has joined #ocaml
mij has joined #ocaml
Iter has quit [Read error: 110 (Connection timed out)]
bzzbzz has quit [zelazny.freenode.net irc.freenode.net]
gim has quit [zelazny.freenode.net irc.freenode.net]
cmeme has quit [zelazny.freenode.net irc.freenode.net]
urz has quit [zelazny.freenode.net irc.freenode.net]
maym has quit [zelazny.freenode.net irc.freenode.net]
Hipo has quit [zelazny.freenode.net irc.freenode.net]
cmeme has joined #ocaml
Hipo has joined #ocaml
gim has joined #ocaml
bzzbzz has joined #ocaml
Snark has quit ["Parti"]
urz has joined #ocaml
Lemmih has quit [Read error: 110 (Connection timed out)]
karryall has quit [zelazny.freenode.net irc.freenode.net]
karryall_ has quit [zelazny.freenode.net irc.freenode.net]
det has quit [zelazny.freenode.net irc.freenode.net]
monotonom has joined #ocaml
karryall_ has joined #ocaml
karryall has joined #ocaml
det has joined #ocaml
urz has quit ["[BX] Reserve your copy of BitchX-1.0c20cvs for the Amiga today!"]
kosmikus is now known as kosmikus|away
Hipo has quit ["Translaatio-operaatio."]
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
bk_ has joined #ocaml
demitar__ is now known as Demitar
Demitar has quit [Read error: 104 (Connection reset by peer)]
demitar_ has joined #ocaml
det has quit [zelazny.freenode.net irc.freenode.net]
karryall_ has quit [zelazny.freenode.net irc.freenode.net]
karryall has quit [zelazny.freenode.net irc.freenode.net]
demitar_ has quit [zelazny.freenode.net irc.freenode.net]
mij has quit [zelazny.freenode.net irc.freenode.net]
Hadaka has quit [zelazny.freenode.net irc.freenode.net]
mattam has quit [zelazny.freenode.net irc.freenode.net]
wolfman8k has quit [zelazny.freenode.net irc.freenode.net]
hf_ has quit [zelazny.freenode.net irc.freenode.net]
simon- has quit [zelazny.freenode.net irc.freenode.net]
slashvar[ejcp] has quit [zelazny.freenode.net irc.freenode.net]
demitar_ has joined #ocaml
det has joined #ocaml
karryall has joined #ocaml
karryall_ has joined #ocaml
mij has joined #ocaml
Hadaka has joined #ocaml
mattam has joined #ocaml
wolfman8k has joined #ocaml
hf_ has joined #ocaml
slashvar[ejcp] has joined #ocaml
simon- has joined #ocaml
demitar_ is now known as Demitar
Hipo has joined #ocaml
tyler is now known as p0lartype
vezenchio has quit ["look at you, hacker, a pathetic creature of meat and bone, panting and sweating as you run through my corridors; how can you ]
<wolfman8k>
...challenge a perfect, immortal machine?"
<vegai>
wasn't too hard the last time I destroyed that lady ;P
<wolfman8k>
what's a good extension/scripting language to use with ocaml? lua? python? ocaml itself?
<monotonom>
you may like to consider camlp4
<wolfman8k>
hm...
<Demitar>
pycaml might be a good choice.
<Demitar>
In general you don't want to try to use caml as a script language unless you intend to compile the scripts and dynlink them.
segphault has joined #ocaml
<Demitar>
The real problem being that you cannot unload dynlinked code.
<segphault>
i'm trying to figure out quotations, and i'm having some problems, I assume there is something i'm suposed to include that i'm not... i'm getting "Refernce to undefined global `Quotation'" any suggestions?
<Demitar>
Who defines the Quotation module/constructor?
<segphault>
its a camlp4 thing. i'm using "-I +camlp4" on the command line, but it hasnt helped.
<Demitar>
Is it in a separate module perhaps?
<karryall>
segphault: what are trying to do writing a quotation ? parsing a file with quotation ?
<segphault>
experimenting with language extension
<karryall>
hmm I find syntax extension nicer for that than quotations
monotonom has quit ["Don't talk to those who talk to themselves."]
hf_ has quit [Remote closed the connection]
monotonom has joined #ocaml
segphault has quit [Read error: 110 (Connection timed out)]
maihem has joined #ocaml
maihem has quit ["Read error: 54 (Connection reset by chocolate)"]
bzzbzz_ has joined #ocaml
bzzbzz_ has left #ocaml []
JPL-Justin-away has quit [Remote closed the connection]
<wolfman8k>
hm... does ocaml have some sort of operator overloading or function overloading?
<mellum>
wolfman8k: no
<karryall>
wolfman8k: no
<wolfman8k>
can i paste 3 lines here?
<karryall>
but you can define new operators
<karryall>
suez
<karryall>
sure
<wolfman8k>
this is what i try:
<wolfman8k>
type vector = { x : float; y : float; z : float };;
<wolfman8k>
let (+.) vec1 vec2 =
<wolfman8k>
{ x = vec1.x +. vec2.x; y = vec1.y +. vec2.y; z = vec1.z +. vec2.z }
<wolfman8k>
the only problem is that now i can't use +. for regular float addition
<mellum>
wolfman8k: then don't do that. Use +! or something
<wolfman8k>
it would be cool if ocaml would call the correct +. function based on the types of the parameters
<mellum>
wolfman8k: not possible
<karryall>
it can't since it determines the types of the parameter from the fact you apply +. on them !
<wolfman8k>
hm... that's deep
<wolfman8k>
btw, am i doing the right thing with my vector type?
<wolfman8k>
(cause in c++ i would use a class)
<karryall>
yes, apart from using +.
<wolfman8k>
hm... should i write all my vector functions in a seperate module then to avoid name clashes?
<karryall>
well if you use operators then there's little point in doing that
<karryall>
because you cannot use operators defined inside a module unless you open it
<wolfman8k>
hm...
<wolfman8k>
but i will also have functions length, squared_length, normal
<karryall>
also, if you put the record type define inside the module, field access becomes painful and verboe unless you open the module
<wolfman8k>
hm...
<wolfman8k>
if i want something like: a_float *! a_vector and also a_vector *! a_float, then do i need 2 different operators?
<mellum>
wolfman8k: of course
<wolfman8k>
so i will need like, *! and *@ ?
<mellum>
I would provide only one.
<wolfman8k>
hm.. which one? :)
<mellum>
after all, vector spaces also define only one.
<mellum>
scalar * vector, typically.
<wolfman8k>
hm... should i make the x,y,z fields of the vector mutable?
<mellum>
wolfman8k: doesn't seem terribly useful. Usually, you change all three anyway
<wolfman8k>
ok thanks. what about distinguishing between unary and binary - like operators?
<karryall>
ocaml uses ~- and ~-. as unary operators
<wolfman8k>
thanks
<wolfman8k>
hm... but i can do: let test = -. 3.0
<karryall>
yes that's because parser tries to be smart about this
<karryall>
but it also works if you write let test = ~-. 3.0 :)
<wolfman8k>
then is there some way i can use -! for both: vec1 -! vec2 and -! vec1 ?
<wolfman8k>
or should i just stick with ~-! vec1 then?
<karryall>
you'll have to use ~-!
<wolfman8k>
ok thanks. i just hope that OCaml's awesome power will justify it's ugly syntax :P
<karryall>
hehe
<wolfman8k>
i guess it wasn't really meant for this kind of numerical computing
<karryall>
not really
<karryall>
it's decent, but not optimal
<wolfman8k>
btw, is there some paste site that does syntax highlighting for OCaml?
GreyLensman has joined #ocaml
Iter has joined #ocaml
GreyLensman has quit [Read error: 113 (No route to host)]
<wolfman8k>
hm... now i have a big problem
<wolfman8k>
i added a new type:
<wolfman8k>
type quaternion = { w : float; x : float; y : float; z : float };;
<wolfman8k>
but now when i try to give a vector expression, { x = 1.0; y = 1.0; z = 1.0; }, then i get error: Some record field labels are undefined: w
GreyLensman has joined #ocaml
<bk_>
when creating a new record from a record type, you have to assign a value to each part of of that record
<wolfman8k>
the problem is that i have two record types that have some members that are the same name
<bk_>
in the same module `
<bk_>
?
<wolfman8k>
yes
<bk_>
oh
<wolfman8k>
maybe i should use classes instead of records?
<bk_>
hmm i don't see why you would want to do that